[Issue 2923] -O generates bad code for ?:

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 15 08:40:42 PDT 2009


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au
            Summary|bug with -inline            |-O generates bad code for
                   |                            |?:
           Severity|normal                      |regression




--- Comment #1 from Don <clugdbug at 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: -------


More information about the Digitalmars-d-bugs mailing list