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

2013-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #1 from Stephan 2013-01-24 08:06:00 PST --- During debugging, I actually looked at the value of every single local variable, and you can actually see how the value of some variables (for example "a") changes from one iteration to t

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

2013-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #2 from Stephan 2013-01-24 10:00:41 PST --- I just checked: The bug definitely was introduced with version 2.061! With dmd version 2.060, everything works fine, with and without the "-O" switch. -- Configure issuemail: http://d.p

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

2013-01-24 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 Walter Bright changed: What|Removed |Added CC||bugzi...@digitalmars.com Seve

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

2013-01-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #3 from Walter Bright 2013-01-25 00:30:21 PST --- I can't reproduce this with the latest dmd. I'll upload a new beta tomorrow you can try. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You

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

2013-01-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #4 from Stephan 2013-01-25 05:01:07 PST --- (In reply to comment #3) > I can't reproduce this with the latest dmd. I'll upload a new beta tomorrow > you > can try. What actually seems to be corrupted are the precompiled executabl

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

2013-01-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #5 from Stephan 2013-01-25 06:53:50 PST --- (In reply to comment #3) > I can't reproduce this with the latest dmd. I'll upload a new beta tomorrow > you > can try. Sorry to jump back and forth here. I have to again correct my pre

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

2013-01-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #6 from Walter Bright 2013-01-25 10:37:02 PST --- When I compile and run separately, it works fine. You should also clarify whether you are using -m64 or not. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?t

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

2013-01-25 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #7 from Stephan 2013-01-25 10:43:26 PST --- Right, I use the 64bit model. And I tested this on OSX and on linux, with same outcomes on both platforms. It's frustating that you can't reproduce. Thanks for responding quickly on this

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

2013-01-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #8 from Don 2013-01-28 01:01:42 PST --- BTW you might be interested in std.numeric.findRoot, which is the root-finding-by-bracketing algorithm (in contrast to "Brent's algorithm" which is minima-finding-by-bracketing). In terms of n

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

2013-01-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #9 from Don 2013-01-28 01:03:34 PST --- ...and I can reproduce your bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---

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

2013-01-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #10 from Don 2013-01-28 01:13:35 PST --- I think there is an uninitialized variable in there. When I compile with -O, if I run the same executable multiple times, sometimes it passes, sometimes it fails. -- Configure issuemail: ht

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

2013-01-28 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #11 from Stephan 2013-01-28 06:57:56 PST --- Hi Don, glad to hear that you can reproduce the bug! I tested initializing all variables by hand, and the bug still occurs. Thanks for the suggestion to use std.numeric. Looks very usef

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

2013-01-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 Don changed: What|Removed |Added Keywords||wrong-code --- Comment #12 from Don 2013-01-29

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

2013-01-29 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 Don changed: What|Removed |Added Keywords||ice OS/Version|Mac OS X

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

2013-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #14 from Don 2013-01-30 00:20:15 PST --- ICE, further reduced: -- void bug9387a(double x) { } void ice9387() { double x = 0.3; double r = x*0.1; double q = x*0.1 + r; double p = x*0.1 + r*0.2; if ( q

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

2013-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #15 from Don 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() {

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

2013-01-30 Thread d-bugmail
/bfa5d0f0ba80c7ff6e0d67806714763584666fb2 fix Issue 9387 - Compiler switch -O changes behavior of correct code -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---

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

2013-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #17 from Walter Bright 2013-01-30 14:42:56 PST --- https://github.com/D-Programming-Language/dmd/pull/1584 Thanks, Don, for the minimizations which made it easy for me to find the problem. It was not a regression, although it look

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

2013-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #18 from Stephan 2013-01-30 15:29:45 PST --- Don and Walter, thanks for reducing the code and fixing the bug, all on a very short timescale! This is going to be a very important fix for me. Using the optimization switch is critical

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

2013-01-30 Thread d-bugmail
/06d991f039eab23561398aea4ea764ea49a6dea4 fix Issue 9387 - Compiler switch -O changes behavior of correct code https://github.com/D-Programming-Language/dmd/commit/9f3ab3f0b4713bd12a3ada71ca783bab1edae663 Merge pull request #1584 from WalterBright/b45 fix Issue 9387 - Compiler switch -O changes behavior of correct code -- Configure

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

2013-01-30 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 Walter Bright changed: What|Removed |Added Status|NEW |RESOLVED Resolution|

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

2013-01-31 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=9387 --- Comment #20 from Don 2013-01-31 00:52:53 PST --- > Don and Walter, thanks for reducing the code and fixing the bug, all on a very short timescale! Thanks. Optimizer bugs get top priority, and this was the one of the worst bugs of all time.