Bug creation and email sending has been disabled, file new bugs at gcc.gnu.org/bugzilla
Bug 21 - ICE on calling function with delegate literal containing 'new'
Summary: ICE on calling function with delegate literal containing 'new'
Status: RESOLVED WONTFIX
Alias: None
Product: GDC
Classification: Unclassified
Component: gdc (show other bugs)
Version: 4.7.x
Hardware: x86_64 Linux
: --- major
Assignee: Iain Buclaw
URL:
Depends on:
Blocks:
 
Reported: 2012-10-26 19:32 CEST by hsteoh
Modified: 2012-10-27 15:55 CEST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hsteoh 2012-10-26 19:32:44 CEST
void addOp(void* delegate() impl) { }

static this() {
        addOp({ return new B(); });
}

$ gdc -I. -O3 -g3 -frelease -c -o veclist.o veclist.d
veclist.d:5: Error: undefined identifier B
cc1d: /usr/src/gcc-4.7/gcc-4.7-4.7.2/src/gcc/d/dfrontend/cast.c:1727: virtual Expression* FuncExp::inferType(Type*, int, TemplateParameters*): Assertion `typen->deco' failed.
cc1d: internal compiler error: Aborted
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


This error seems very dependent on the exact compilation flags; replacing -frelease with -funittest, for example, *seems* to make it go away. But I suspect the problem is still there; it just doesn't show up. This is the same bug that I posted about on the forum; I was unable to reduce it last time because I was running with -funittest, and past a certain code size the problem becomes hidden. Furthermore, I found that separate compilation vs. bulk compilation isn't the real issue; separate compilation with -frelease also triggers this bug.

Also, the undefined identifier B in the original code is actually defined (under a different name, the exact name doesn't appear to matter -- the void* was originally a base class of B). But the problem seems to disappear upon reduction unless I keep an undefined identifier there. So this bug is NOT merely a problem with undefined identifiers, in the original code it's defined but still ICE's.

During the early stages of code reduction, the above ICE was randomly alternating with a memory corruption error. I couldn't isolate the memory corruption, but I did manage to isolate the typen->deco ICE.
Comment 1 hsteoh 2012-10-26 19:47:15 CEST
Hmm. I managed to reproduce the bug with minimal command-line arguments:

gdc -c veclist.d

also produces the ICE.
Comment 2 Iain Buclaw 2012-10-27 00:57:35 CEST
looks like an FE bug.  Did you try DMD 2.060 first?
Comment 3 hsteoh 2012-10-27 01:44:12 CEST
This problem doesn't happen on DMD (or at least, it doesn't manifest itself), that's why I reported it against GDC instead of DMD. I just tried dmd 2.060 and it seems fine.
Comment 4 Iain Buclaw 2012-10-27 09:53:19 CEST
(In reply to comment #3)
> This problem doesn't happen on DMD (or at least, it doesn't manifest itself),
> that's why I reported it against GDC instead of DMD. I just tried dmd 2.060 and
> it seems fine.

Right, now try it with 2.059. :-)
Comment 5 hsteoh 2012-10-27 15:55:36 CEST
You're right, this bug is in dmd 2.059.