Bug 5932 – Internal error: s2ir.c 339

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-05-05T16:07:00Z
Last change time
2015-06-09T05:10:42Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2011-05-05T16:07:36Z
Compiling the code: -------------------------- void checkops(T...)( T ops ) { static assert( 0 ); } void receive(T...)( T ops ) { checkops( ops ); get( ops ); } void get(T...)( T vals ) { void onStandardMsg() { foreach( t; T ) { } } } void test() { assert( !__traits( compiles, { receive( (long x) {}, (int x) {} ); } ) ); } ------------------------- Produces the error: Internal error: s2ir.c 339 What's likely happening is semantic() is not run on onStandardMsg(), which is likely caused by the __traits(compile failing, and yet marking semantic() as having been run.
Comment #1 by clugdbug — 2011-05-06T01:47:34Z
This is probably related to bug 4910, and also to bug 4269 ("invalid type accepted if evaluated while errors are gagged") There's a problem with the gagging system. One difficulty is that if there has been a forward reference, CTFE needs to run semantic3 on the function. If errors are gagged from inside VarDeclaration::semantic, the gagging should only apply to CTFE; the semantic3 errors should not be gagged. The problem is, the gagging system doesn't have any mechanism for ungagging. If we instantiated a template from inside is(typeof()), semantic errors should be gagged; we don't yet know if the template will be instantiated. Let's call this an investigative template instantiation. This is recursive; any template instantiated from inside a investigative template is also investigative. BUT, any semantic run on anything other than a investigative template should NOT be gagged. The simple incrementing and decrementing of global.gag doesn't quite work. The other side of the problem is bug 4269: failed templates are not removed. If there is an attempt to instantiate them from a non-gagged state, the original (previously suppressed) error messages should be shown.
Comment #2 by clugdbug — 2011-09-15T07:46:34Z
Reduced test case fails also on D1.070 (again with ICE(s2ir.c). On D2.054 and later, this test case hits bug 6675 ICE(glue.c) instead. ====== void receive(T)() { static assert( 0 ); get( 7 ); } void get(T)( T val ) { void onStandardMsg() { foreach( t; T ) { } } } static assert(!is(typeof( { receive!(int)(); }() )));
Comment #3 by bugzilla — 2011-09-20T13:16:40Z