Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 02, 2009 [Issue 2923] New: bug with -inline | ||||
---|---|---|---|---|
| ||||
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 15, 2009 [Issue 2923] -O generates bad code for ?: | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 --- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-05-15 08:40:41 PDT --- 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: ------- |
July 09, 2009 [Issue 2923] -O generates bad code for ?: | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | 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 --- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2009-07-09 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: ------- |
Copyright © 1999-2021 by the D Language Foundation