[Issue 2216] New: bad code generation for static arrays of zero length static arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 10 14:07:40 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2216

           Summary: bad code generation for static arrays of zero length
                    static arrays
           Product: D
           Version: 1.029
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: tomas at famolsen.dk


simple test case:

int[0][10] arr;
printf("%u\n", &arr[9] - &arr[0]);

Output: Floating point exeption

The crash happens due to the pointer subtraction dividing by size 0:

AST: (&arr[9] - &arr[0]) / 0

this should just print a 0.


-- 



More information about the Digitalmars-d-bugs mailing list