Maurice Lombardi wrote:
Toby Ewing wrote:
In the end the problem wasn't in the list work at all. Way earlier in the program, I'd allocated memory for an array [1..x], then accessed it as [0..x]. On freeing the memory, I guess something funny was set up in the memory manager that came back to bite me way later.
So... is there a compiler option I could have set that would have told me about this illegal memory access?
_No array index checking_ in gpc up to now unfortunately
Franck, You have said some time ago that check of array addresses was not so important ... You said also in an other mail that you were not fond of numeric analysis ...
Correcting this is in my opinion the most urgent thing to do after the 2.1 release.
Chiming in with a 'me too'. What is needed is a way to check expressions as they are built, and prior to storing or using to index. It should look something like "check(min,max):boolean" This can be applied to subranges and indices, in fact whereever the compiler has knowledge of extreme allowable values (this includes case indices). If the machine model is a stack machine the model for this is easy.
In the long run the efficiency aspects can be ameliorated by deciding where NOT to call the checking code. This is where the numeric analysis comes in.
For arrays one of the preliminary operations is always to subtract the lower bound, so this can be combined with the check operation. Or you can look at it as being a check of a single value after manipulating into something zero based, but I think the lack of generality there will bite sooner or later.