Toby Ewing wrote:
Hi, all
"Joe da Silva" wrote:
Speaking of optimization, are you using any "heavy" optimization settings that may be giving side-effects?
I wondered about that. I've tried various compiler options, including everything from lots to no optimization. No difference.
CBFalconer wrote:
Toby Ewing wrote:
I agree that the problem is that PSelf is apparently not a valid pointer. I don't understand what you're saying about New. Is New not stable or trustworthy?
Perfectly stable and trustworthy.
I had hoped so, but my most recent checking suggests otherwise. Granted this is a cheap and dirty test, but noticing that my pointers were generally incrementing by 32, I put in a new field, checker : longCard, and some new lines for checking:
Procedure LInsert(var Root : PRec; var x, y, z : shortCard); {Local to NumLatt. Insert a new record at the beginning of list Root} var temp : PRec; begin New(temp); with temp^ do begin rx := x; ry := y; rz := z; checker := longCard(Root); next := Root; if ((Root <> Nil) and ((longCard(temp) - longCard(Root)) <> 32)) then begin writeln(' funny size '); readln; end; end; Root := temp; end; {LInsert}
Currently, I get no "funny size" messages until I've passed through the list 15 times. On pass 15, two records have funny sizes. On pass 16, two records have funny sizes, and the program crashes. So the problem may stem from what is being allocated in New.
Not germane, especially under DJGPP, where the malloc is filling holes released during the runtime initialization. These can be located all over.
Simplify your basic list handling and publish the whole thing. It is highly suspect, because you are in the habit of making copies of pointers in a rather undisciplined manner. You are not working with the lists you think you are.