Bug 7806 – ICE(gloop.c) iterating with idouble, when compiling with -O

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2012-03-31T20:37:00Z
Last change time
2013-10-05T16:40:31Z
Keywords
ice
Assigned to
nobody
Creator
slayerbeast

Attachments

IDFilenameSummaryContent-TypeSize
1083bug.dcode that produces the bugtext/x-dsrc205

Comments

Comment #0 by slayerbeast — 2012-03-31T20:37:22Z
Created attachment 1083 code that produces the bug The program attached compiles and works normally, unless compiled with optimizations enabled: $ dmd -O bug.d Internal error: backend/gloop.c 3400 --- compiler: DMD64 D Compiler v2.058 OS: gentoo linux x86_64
Comment #1 by bearophile_hugs — 2012-04-01T03:47:57Z
On Windows 32 bit, with DMD 2.059head it doesn't crash, but it outputs: Without -O: -2 -2 -1.9375 -2 -1.875 -2 -1.8125 -2 -1.75 -2 ... 1.75 2 1.8125 2 1.875 2 1.9375 2 2 2 With -O: -0 -9.88131e-324 -0 -9.88131e-324 -0 -9.88131e-324 -0 -9.88131e-324 -0 -9.88131e-324 -0 -9.88131e-324 -0 -9.88131e-324 ...
Comment #2 by clugdbug — 2012-04-03T06:58:35Z
Code in the attachement ---- import std.stdio; void main() { for (idouble i = -2i; i <= 2i; i += .125i) for (double r = -2; r <= 2; r += .0625) { cdouble c = r + i; writeln(c); } } ---
Comment #3 by bugzilla — 2013-10-04T12:40:44Z
A simpler version without all the templates: import core.stdc.stdio; void main() { for (idouble i = -2i; i <= 2i; i += .125i) for (double r = -2; r <= 2; r += .0625) { cdouble c = r + i; printf("%g %gi\n", c.re, c.im); } } Which does not produce an internal error with -O, but does go into an infinite loop when the compiled program is executed.
Comment #4 by bugzilla — 2013-10-04T13:22:43Z
Comment #5 by github-bugzilla — 2013-10-05T12:25:46Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ad9a300d9257105a1b8cab1443c2273d442ea04a fix Issue 7806 - ICE(gloop.c) iterating with idouble, when compiling with -O https://github.com/D-Programming-Language/dmd/commit/3e2986e09d14a90b8c0e20b15f92b586886b80d0 Merge pull request #2627 from WalterBright/fix7806 fix Issue 7806 - ICE(gloop.c) iterating with idouble, when compiling wit...
Comment #6 by github-bugzilla — 2013-10-05T12:34:26Z
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/be315758f5342ad3fc3172c6f087e01cfe50ef07 Merge pull request #2627 from WalterBright/fix7806 fix Issue 7806 - ICE(gloop.c) iterating with idouble, when compiling wit...