[Issue 3736] corrupted struct returned by function with optimizations (-O)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Feb 10 00:58:31 PST 2010


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



--- Comment #4 from Don <clugdbug at yahoo.com.au> 2010-02-10 00:58:30 PST ---
Here is a test case which fails in DMC 8.42n. It hits the breakpoint when
compiled with -O.
----------
struct Foo {
    int x;
};

Foo getFoo(Foo irrelevant) {
    Foo p;
    p.x=400;
    if ( p.x > p.x )
        return irrelevant;
    else
        return p;        
}

void main() {
   Foo z;
   z.x=0;
   int y = getFoo( z ).x;
   if (y!=400) _asm int 3;
}
----------

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