[Issue 2923] New: bug with -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 2 11:45:27 PDT 2009


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

           Summary: bug with -inline
           Product: D
           Version: 1.043
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: xurux1-mail at yahoo.de


adding the -inline option produces wrong output, both with
Digital Mars D Compiler v1.043,
Digital Mars D Compiler v2.029
on windows.

import std.stdio; //writefln

int my_abs(int i) {
  return i<0 ? -i : i;
}

void main(char[][] args) {
  int rows=9;
  int mid=5;
  for (int j=0; j<rows; j++) {
    int leadSpaces=my_abs((mid-1)-j);
    for (int i=0; i<leadSpaces; i++)
      writef("-");               
    //writefln("%d:%d",j,leadSpaces);
    writefln("!");
  }
}
/*
CORRECT:
C:\dev\d>dmd -release -O -run compiler_bug1.d
----!
---!
--!
-!
!
-!
--!
---!
----!

WRONG:
C:\dev\d>dmd -release -O -inline -run compiler_bug1.d
!
!
!
!
!
!
!
!
!
*/


-- 



More information about the Digitalmars-d-bugs mailing list