Thread overview
[Issue 2216] New: bad code generation for static arrays of zero length static arrays
Jul 10, 2008
d-bugmail
Jul 11, 2008
d-bugmail
Aug 14, 2008
d-bugmail
July 10, 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@digitalmars.com
        ReportedBy: tomas@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.


-- 

July 11, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2216


tomas@famolsen.dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |trivial




------- Comment #1 from tomas@famolsen.dk  2008-07-11 13:53 -------
Marking as trivial. Just return zero if stride==0.


-- 

August 14, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2216


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2008-08-14 02:59 -------
Fixed dmd 1.034 and 2.018


--