www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 141] New: Signed integer overflow handled incorrectly

Date: Thu, 17 Jul 2014 12:55:13 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"

http://bugzilla.gdcproject.org/show_bug.cgi?id=141

            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.

-- 
You are receiving this mail because:
You are watching all bug changes.
Jul 17 2014