[Issue 20903] New: seg fault on long signed divide overflow

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 7 09:27:12 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20903

          Issue ID: 20903
           Summary: seg fault on long signed divide overflow
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

The following:

  long test() {
    long r = 0x8000_0000_0000_0000L;
    long x = -1L;
    return r / x; // crashes here
  }

  import core.stdc.stdio;

  int main() {
    printf("result: %llx\n", test());
    return 0;
  }

crashes when compiled with -O on 64 bit code.

--


More information about the Digitalmars-d-bugs mailing list