http://d.puremagic.com/issues/show_bug.cgi?id=3736
Summary: corrupted struct returned by function with optimizations (-O) Product: D Version: 2.030 Platform: Other OS/Version: Windows Status: NEW Keywords: wrong-code Severity: regression Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: s...@extrawurst.org --- Comment #0 from Stephan Dilly <s...@extrawurst.org> 2010-01-23 10:02:04 PST --- building the following code with -O corrupts the return value of getFoo. sorry could not reduce it more: import std.stdio; struct Foo { float x=0; } struct Bar { Foo p0; Foo p1; } Bar a = {Foo(0),Foo(400)}; Foo getFoo(Foo _pos) { Bar stillok = a; float d0 = (a.p0.x - _pos.x); float d1 = (a.p0.x - _pos.x); if( d0 > d1 ) { return stillok.p0; } else { return stillok.p1; } } void main() { writefln("%s", getFoo( Foo(100) ).x ); } // prints 6.91062e-39 under dmd2039 // prints 3.2372e-39 under dmd2030 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------