[Issue 9387] Compiler switch -O changes behavior of correct code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 30 03:58:24 PST 2013


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



--- Comment #15 from Don <clugdbug at yahoo.com.au> 2013-01-30 03:58:21 PST ---
And a reduction for the wrong-code case. This sometimes segfaults but usually
hangs. Looks like the saved RBX register gets trampled:

double brent(double x) { return x; }

void wrong9387()
{
    for (int iter=0; iter<1; iter++) {
        double v =2.94;
        if (brent(v)<= 2.9) { return; }
        double w = 2.97;
        double r = (0.2-w) * 0.1;
        double q = (0.2-v) * 0.1 - r;
        double p = 0.7*q - (0.2-v)*0.3;
        if (q > 0.0) p = -p;
        q = brent(q);
        double d = p-q;
        if (2.94 + d)
            w = v -v;
        brent(w);
    }
}

void main()
{
  wrong9387();
}

-- 
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