1144 – ICE(template.c) template mixin causes DMD crash

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1144 - ICE(template.c) template mixin causes DMD crash
Summary: ICE(template.c) template mixin causes DMD crash
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 All
: P2 regression
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
Reported: 2007年04月14日 13:40 UTC by Alex
Modified: 2014年04月18日 09:12 UTC (History)
3 users (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Alex 2007年04月14日 13:40:18 UTC
template testHelper( A ... )
{
	char []testHelper()
	{
		char []result;
		foreach( t; a )
		{
			result ~= "int " ~ t ~ ";\r\n";
		}
		return result;
	}
}
template test( A ... )
{
	const char []test = testHelper( A );
}
int main( char [][]args )
{
	mixin( test!( "hello", "world" ) );
	return 0;
}
Comment 1 Thomas Kühne 2007年04月23日 12:56:33 UTC
Added to DStress as
http://dstress.kuehne.cn/nocmpile/m/mixin_34_A.d 
Comment 2 Walter Bright 2007年04月27日 14:57:11 UTC
Fixed DMD 1.014
Comment 3 Don 2009年04月19日 03:36:25 UTC
This is fixed in DMD2.028 but not in 1.042.
Assertion failure: 'i < parameters->dim' on line 806 in file 'template.c'
Comment 4 Don 2009年09月12日 11:58:52 UTC
This is the test case which is failing in dstress:
char[] testHelper(A ...)(){
 char[] result;
 	 foreach(t; a){
 	 result ~= "int " ~ t ~ ";\n";
 	 }
 	 return result;
}
 	
 	int main(){
 	 mixin( testHelper!( "hello", "world" )() );
 	 return 0;
 	}
Note that in the foreach(), it's 'a' instead of 'A'. So it's a bad test, which is actually an instance of bug 2229 (which I've just patched). The bug here was indeed fixed in 1.014.
Comment 5 Robert Clipsham 2009年11月07日 07:52:58 UTC
The dstress test is failing again in dmd 1051:
dmd: template.c:4017: Identifier* TemplateInstance::genIdent(): Assertion `0' failed.
That DStress case is correct, it's in nocompile/, so shouldn't compile.
Comment 6 Robert Clipsham 2009年11月07日 07:54:22 UTC
*** Issue 3482 has been marked as a duplicate of this issue. ***
Comment 7 Don 2009年11月07日 14:49:53 UTC
(In reply to comment #5)
> The dstress test is failing again in dmd 1051:
> dmd: template.c:4017: Identifier* TemplateInstance::genIdent(): Assertion `0'
> failed.
> 
> That DStress case is correct, it's in nocompile/, so shouldn't compile.
Yes, but it's testing bug 2229, not the one which was originally reported here. I'm closing this one, and re-opening the other.
BTW it's not a regression. Bug 2229 was never fixed properly.


AltStyle によって変換されたページ (->オリジナル) /