[fpc-devel] Potentially a slight little overflow issue in nx86mat.pas
Skybuck Flying
skybuck2000 at hotmail.com
Fri Apr 8 05:36:10 CEST 2011
Hello,
There could be a slight little overflow issue in unit "nx86mat.pas"
Line 174:
current_asmdata.asmlists[al_typedconsts].concat(tai_const.create_32bit(-(1
shl 31)));
Explanation of potential bug:
1 shl 31 results in 2147483648 which is already an integer overflow.
It is then tried to be negated towards -2147483648 which would be valid.
Question in this case is what does free pascal do ?
Does it convert the calculation towards 64 bit ? and then down casts it to
32 bit... that seems a bit unlikely to me...
Though I can imagine the compiler doing that inside itself for constants and
then finally assigning the legal constant to "the/an integer"...
The mind wonders.. ;) =D
Bye,
Skybuck.
More information about the fpc-devel
mailing list