digitalmars.D.bugs - [Issue 2923] New: bug with -inline
- d-bugmail puremagic.com (57/57) May 02 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2923
- d-bugmail puremagic.com (25/25) May 15 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2923
- d-bugmail puremagic.com (12/12) Jul 09 2009 http://d.puremagic.com/issues/show_bug.cgi?id=2923
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 digitalmars.com ReportedBy: xurux1-mail 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 ! ! ! ! ! ! ! ! ! */ --
May 02 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2923 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au Summary|bug with -inline |-O generates bad code for | |?: Severity|normal |regression Reduced test case: dmd bug.d //OK dmd -O bug.d // fails. Raising severity -- this is a VERY nasty bug. All the outer for loop does is prevent constant folding. With -O enabled, the wrong branch of ?: gets taken. void main() { for (int j=1; j<2; j++) { int x = (j<0) ? -j : j; int q=0; for (int i=0; i<x; i++) ++q; assert(q!=0); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 15 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2923 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 02:49:09 PDT --- Fixed dmd 1.046 and 2.031 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 09 2009