Prof A Olowofoyeku (The African Chief) wrote:
On 23 Feb 2005 at 5:02, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
On 22 Feb 2005 at 17:01, Frank Heckenbach wrote:
Prof A Olowofoyeku (The African Chief) wrote:
It seems that "{$R-}" does not work in units to turn off range checking, and that one has to use it in the main program. Is this by design?
No, this "works" for me (says 11). Can you give an example?
[...]
It works in simple programs like this. It does not work in a big and complicated program that I have, while it works in another big and complicated program. I will continue to investigate ...
Are you sure the range error occurs in the unit with `{$R-}' (not e.g., in a calling or called unit or the RTS)?
You find out, you can:
compile the program with debug info (`-g')
run the program (not the compiler) with `--gpc-rts=-Eerror.log' as the first option
look the the file `error.log' after a runtime error and pipe it though `addr2line -e path-to-your-executable'
This will show the routines called at the time of error. If the one before the error handling routines (in error.pas) is also in the RTS, it might be an RTS range-check error which we'll have to fix.
I don't really understand these things, so I'll give you the results - error.log: value out of range (error #300 at 442b71) 442b71 Routines called: 44fa7c 44fb61 44e1ec 442b71 43d041 401cff 4026d3 421551 421509 41feeb 41c63a 77d48708 77d487ea 77d4b742 77d4b7aa
Output of "addr2line -e instdemo.exe < error.log" : ??:0 d:/gpc/obj/objects.pas:2816 ??:0 D:/gpc/win32/<implicit code>:400 D:/gpc/win32/<implicit code>:400 D:/gpc/win32/<implicit code>:400 d:/gpc/obj/objects.pas:2816 d:/gpc/win32/cclasses.pas:826 d:/gpc/win32/instdemo.pas:171 d:/gpc/win32/instdemo.pas:274 d:/gpc/win32/cwindows.pas:2056 d:/gpc/win32/cwindows.pas:2031 d:/gpc/win32/cwindows.pas:1770 d:/gpc/win32/cwindows.pas:860 ??:0 ??:0 ??:0 ??:0
What does this all mean?
Did you build the RTS with `-g'? I suppose not, so the RTS entries cannot be resolved by addr2line and are (for some strange reasons) reported as `<implicit code>:400'.
But since there are only three such entries (I get four in my test, but it may depend on optimization settings and perhaps backend versions), I suppose they correspond to the error handling routines (with a `-g' RTS, we'd know more certainly). This suggests that the range check error is indeed raised in line 2816 (+/-1 due to GPC line inaccuracies) of objects.pas (and not in a RTS routine called from there). Are you sure this part was compiled with `{$R-}'? What does this code do?
Frank