[fpc-pascal]Strange indexing problem - gdb or fpc?
Pierre Muller
pierre at freepascal.org
Mon Apr 22 09:17:15 CEST 2002
At 06:38 22/04/2002 , JOHN COPPENS a écrit:
>Hi...
>
>I'm debugging (trying to) a program, was nearing the problem, and
>found this strange behaviour:
>
>820 rconst[r+1] := x;
>(gdb) print RCONST[0] // Still 0
>$5 = 0
>(gdb) print R
>$6 = 0 // Was initialized like this
>(gdb) print X
>$7 = 0.29999999999999999 // New value
>(gdb) next // Execute the rconst[r+1] := x
>821 realindex := 1;
>(gdb) print RCONST[0]
>$8 = 0.29999999999999999 // Should've been in [1]!!!
>(gdb) print R
>$9 = 0 // R is 0, so r+1 = 1
>(gdb) print X
>$10 = 0.29999999999999999
>
> realarray = array[1..rmax] of real;
> rconst: realarray;
>
>BTW, RCONST[1] is 0 after the operation. Any ideas?
>
>Is this because C arrays are 0 based? I checked the Docs, they don't
>mention this problem...
You need to givemore info, so that we can help you out.
1) Could you please send a short complete source
for your problem so that we can compile it also?
2) On which OS are you working?
3) Which version of GDB do you use?
4) What current language do you use?
I can maybe help (as I wrote the pascal language support for GDB)
after you give us these informations.
More information about the fpc-pascal
mailing list