Overflow check not removed, if addition of zero constant is optimized away
Original Reporter info from Mantis: Vincent
-
Reporter name: Vincent Snijders
Original Reporter info from Mantis: Vincent
- Reporter name: Vincent Snijders
Description:
The compiler removes the addition of a constant with value zero from an expression, but it doesn't not the remove the overflow check which belongs to it.
This check is done with the flags resulting of a previous addition/compare/substract/whatever.
See generated assembler
# [21] z := zero + y;
movl U_P$OVERFLOWBUG_Y,%eax
jnb .Lj12
call FPC_OVERFLOW
.Lj12:
movl %eax,U_P$OVERFLOWBUG_Z
Steps to reproduce:
See attached program.
Mantis conversion info:
- Mantis ID: 8573
- OS: Windows
- OS Build: XP Home SP2
- Platform: i386
- Fixed in version: 2.2.0
- Fixed in revision: 7009 (#ab22fd42)
- Target version: 2.2.0