digitalmars.D.bugs - [Issue 9138] New: Code optimization results in a wrong value
- d-bugmail puremagic.com (35/35) Dec 10 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9138
- d-bugmail puremagic.com (12/12) Dec 11 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9138
- d-bugmail puremagic.com (10/10) Dec 12 2012 http://d.puremagic.com/issues/show_bug.cgi?id=9138
http://d.puremagic.com/issues/show_bug.cgi?id=9138 Summary: Code optimization results in a wrong value Product: D Version: D1 & D2 Platform: x86_64 OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: david.eckardt sociomantic.com --- Comment #0 from David Eckardt <david.eckardt sociomantic.com> 2012-12-10 11:39:05 PST --- Compiling this code example with -O makes the assertion fail: --- module opt; int f ( int x ) { int n = x <= 0; for (auto i = x; i; i /= 10) { } return n; } void main ( ) { assert(f(0)); } --- Omitting the 'for' loop or the "i /= 10" or reading n after the 'for' loop makes the example run correctly. Changing the types of x and n and the return type of f() doesn't change the behaviour as well as assigning the value of the "f(0)" call to a variable and passing that variable to assert(). Debugging shows that n is 0. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 10 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9138 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |maxim maxim-fomin.ru Resolution| |WORKSFORME --- Comment #1 from Maxim Fomin <maxim maxim-fomin.ru> 2012-12-11 00:05:24 PST --- It work with -O option with git head dmd. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 11 2012
http://d.puremagic.com/issues/show_bug.cgi?id=9138 David Eckardt <david.eckardt sociomantic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D1 & D2 |1.057 --- Comment #2 from David Eckardt <david.eckardt sociomantic.com> 2012-12-12 05:00:58 PST --- OK, apparently a DMD 1 bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 12 2012