| Bug ID | 141 |
|---|---|
| Summary | Signed integer overflow handled incorrectly |
| Product | GDC |
| Version | 4.9.x |
| Hardware | All |
| OS | All |
| Status | NEW |
| Severity | critical |
| Priority | Normal |
| Component | gdc |
| Assignee | ibuclaw@gdcproject.org |
| Reporter | code@klickverbot.at |
This
---
bool foo(int a) {
return a > (a + 1);
}
---
produces
---
_D4test3fooFiZb:
xorl %eax, %eax
ret
---
using the GDC 4.9.0 from the Arch Linux repositories.
However, the spec (http://dlang.org/expression.html) says: "If both operands
are of integral types and an overflow or underflow occurs in the computation,
wrapping will happen." There is no mention that this does not apply to signed
integral types as well.