[Issue 8091] Optimizer generates wrong code when reducing comparisons.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 12 23:56:50 PDT 2012


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



--- Comment #1 from Kasumi Hanazuki <k.hanazuki at gmail.com> 2012-05-12 23:58:16 PDT ---
more simplification:

----

int solve(int n) {
    int a = (n == 0) ? 1 : (n == 1) ? 1 : 0;
    return (a != 0) ? a : 0;
}

void main() {
    assert(solve(0) ==  1);
    assert(solve(1) ==  1); // fails with -O
    assert(solve(2) ==  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