Wrong code generation with optimization level 2 and above (i386 win32)
Original Reporter info from Mantis: Michal Gawrycki @michalgw
-
Reporter name: Michal Gawrycki
Original Reporter info from Mantis: Michal Gawrycki @michalgw
- Reporter name: Michal Gawrycki
Description:
Invalid code is generated for the following expression:
# [16] if (TR.Val = 10) or ((TR.Val = 5) and (TR.Next^.Val = 5)) then
cmpl $10,%eax
je .Lj3
movl U_$P$TESTBUG_$$_TR+4,%edx
movl (%edx),%edx
xorl $5,%edx
xorl $5,%eax
orl %eax,%edx
jne .Lj5
Last two comparisons seem to be linked together. If I understand correctly, last comparison (TR.Next^.Val = 5) should only be performed if result of second comparison (TR.Val = 5) is true. In this case, the TR.Next field is null and causes an AV exception.
Mantis conversion info:
- Mantis ID: 37780
- OS: Win32
- OS Build: 10
- Platform: i386
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 46905 (#aa75d39a)