Thread overview
[Issue 5656] New: dmd fails to compile optimized foreach over a big enum
Feb 28, 2011
Don
Feb 28, 2011
Max Samukha
Feb 28, 2011
Don
Feb 28, 2011
Max Samukha
Mar 03, 2011
Don
February 26, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656

           Summary: dmd fails to compile optimized foreach over a big enum
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jens.k.mueller@gmx.de


--- Comment #0 from jens.k.mueller@gmx.de 2011-02-26 14:28:45 PST ---
Created an attachment (id=923)
Test program that fails to compile

Compiling the attached file with
$ dmd -O -c test.d
fails with
Internal error: ../ztc/blockopt.c 619

If you disable the optimization it works, i.e.
$ dmd -c test.d

If the enum contains more than 197 elements it fails. Don't know why this number. Though such a big enum may be very artificial, you can run into the same problem if you nest foreach of smaller enums (see the commented out code in the attached file).

$ dmd | head -1
Digital Mars D Compiler v2.051

I could not reproduce the problem in dmd v2.039. But it also exists in v2.047. I haven't checked any dmd between v2.039 and v2.047.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |clugdbug@yahoo.com.au


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2011-02-28 00:54:23 PST ---
Please test this on 2.052. I'm almost certain this is a duplicate of bug 4379. In general, please don't report crashing bugs without testing on the latest compiler. They are given a very high priority, so a large number of them are fixed in every release.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656



--- Comment #2 from jens.k.mueller@gmx.de 2011-02-28 01:31:57 PST ---
You're right. It does work with dmd v2.052.
I only searched for similar bug reports but I didn't find any (I'll guess the
fixed ones are not searched by default.). Sorry. Next time I do better.
Thanks very much.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656


Max Samukha <samukha@voliacable.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha@voliacable.com


--- Comment #3 from Max Samukha <samukha@voliacable.com> 2011-02-28 01:46:38 PST ---
Don, may I ask you to rethink the way you prioritize bugs? You seem to go for ICE bugs regardless of their importance for real use of the compiler. Something is not right if wrong-code, artificially elicited or easy to work around ICE bugs are prioritized over really critical non-ICE ones like http://d.puremagic.com/issues/show_bug.cgi?id=3516. 3516 is *very* important for anyone who uses destructible structs. It makes structs unusable while many of the recently fixed ICEs are trivial to work around. BTW, it has 24 votes, which means people really care.

Thank you!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656



--- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-02-28 04:41:03 PST ---
(In reply to comment #3)
> Don, may I ask you to rethink the way you prioritize bugs? You seem to go for ICE bugs regardless of their importance for real use of the compiler. Something is not right if wrong-code, artificially elicited or easy to work around ICE bugs are prioritized over really critical non-ICE ones like http://d.puremagic.com/issues/show_bug.cgi?id=3516. 3516 is *very* important for anyone who uses destructible structs. It makes structs unusable while many of the recently fixed ICEs are trivial to work around. BTW, it has 24 votes, which means people really care.

Yes, I know, that one has been top of the list for more than a year. But it's
hard! Really hard!
For reference, this is my current list of top ten bugs:

4854 Regression(2.047, Mac 10.5 only) writefln Segmentation fault if no globals
3516 Destructor not called on temporaries
314 [module] Static, renamed, and selective imports are always public

4714 Cannot return ref this when struct has invariant
= 3273 Regression(2.031) struct invariant + dtor fails to compile (no line
number)
= 1251 Final template class w/ constructor and invariant causes compile error
= 3973 out contracts fail with ref return types
4269 Regression(2.031) invalid type accepted if evaluated while errors are
gagged
[design issue] Signature of opEquals

*All* of these are very difficult bugs. I have spent a lot of time on each one
of them.
Then comes a pile of wrong-code bugs, starting with:
1350 delegate literal inside tuple; wrong values

The reason for the focus on wrong-code and ICE bugs, is that they often indicate fundamental problems with the compiler. In particular, I have zero tolerance for back-end bugs.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 28, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656



--- Comment #5 from Max Samukha <samukha@voliacable.com> 2011-02-28 11:08:26 PST ---
(In reply to comment #4)

> Yes, I know, that one has been top of the list for more than a year. But it's hard! Really hard!

You will cope with it!

> For reference, this is my current list of top ten bugs:
> 
> 4854 Regression(2.047, Mac 10.5 only) writefln Segmentation fault if no globals
> 3516 Destructor not called on temporaries
> 314 [module] Static, renamed, and selective imports are always public
> 
> 4714 Cannot return ref this when struct has invariant
> = 3273 Regression(2.031) struct invariant + dtor fails to compile (no line
> number)
> = 1251 Final template class w/ constructor and invariant causes compile error
> = 3973 out contracts fail with ref return types
> 4269 Regression(2.031) invalid type accepted if evaluated while errors are
> gagged
> [design issue] Signature of opEquals
> 
> *All* of these are very difficult bugs. I have spent a lot of time on each one
> of them.
> Then comes a pile of wrong-code bugs, starting with:
> 1350 delegate literal inside tuple; wrong values
> 
> The reason for the focus on wrong-code and ICE bugs, is that they often indicate fundamental problems with the compiler. In particular, I have zero tolerance for back-end bugs.

I understand. One fundamental problem fixed is better than a million of hacks stacked on a broken foundation. Thanks for the work you are doing.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5656


Don <clugdbug@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #6 from Don <clugdbug@yahoo.com.au> 2011-03-03 00:39:59 PST ---
*** This issue has been marked as a duplicate of issue 4379 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------