Thread overview
ICE: template.c:806: failed assertion `i < parameters->dim'
Oct 28, 2009
Jacob Carlborg
Oct 28, 2009
Don
Oct 28, 2009
Jacob Carlborg
Oct 28, 2009
Jacob Carlborg
Oct 28, 2009
Don
Oct 28, 2009
grauzone
Oct 29, 2009
Don
October 28, 2009
I have quite a big project and when I compile it I get this internal compiler error: template.c:806: failed assertion `i < parameters->dim'.
I don't know what could cause that error so I don't know where to look in my code to try to produce a small test case and report an issue. I'm using quite a lot of templates, template mixins and string mixins.

I'm using dmd v1.045, I also get the same error with the latest ldc with this backtrace:

Assertion failed: (i < parameters->dim), function deduceFunctionTemplateMatch, file /Users/doob/development/d/ldc/ldc/dmd/template.c, line 816.
0   ldc               0x00bea798 llvm::sys::RWMutexImpl::writer_release() + 312
1   ldc               0x00beb231 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 1393
2   libSystem.B.dylib 0x955072bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1789889903
4   libSystem.B.dylib 0x9557b23a raise + 26
5   libSystem.B.dylib 0x95587679 abort + 73
6   libSystem.B.dylib 0x9557c3db __assert_rtn + 101
7   ldc               0x000a0911 TemplateDeclaration::deduceFunctionTemplateMatch(Loc, Objects*, Expression*, Expressions*, Objects*) + 2129
8   ldc               0x000a11fa TemplateDeclaration::deduceFunctionTemplate(Scope*, Loc, Objects*, Expression*, Expressions*, int) + 250
9   ldc               0x00041981 CallExp::semantic(Scope*) + 1009
10  ldc               0x000942f2 ReturnStatement::semantic(Scope*) + 386
11  ldc               0x0009146f CompoundStatement::semantic(Scope*) + 191
12  ldc               0x00048c83 FuncDeclaration::semantic3(Scope*) + 1875
13  ldc               0x0009a8b6 TemplateInstance::semantic3(Scope*) + 182
14  ldc               0x000a26c0 TemplateInstance::semantic(Scope*) + 1440
15  ldc               0x00042844 CallExp::semantic(Scope*) + 4788
16  ldc               0x000942f2 ReturnStatement::semantic(Scope*) + 386
17  ldc               0x0009146f CompoundStatement::semantic(Scope*) + 191
18  ldc               0x00048c83 FuncDeclaration::semantic3(Scope*) + 1875
19  ldc               0x00007b81 AttribDeclaration::semantic3(Scope*) + 113
20  ldc               0x000979e6 AggregateDeclaration::semantic3(Scope*) + 150
21  ldc               0x00064886 Module::semantic3(Scope*) + 166
22  ldc               0x0010185f main + 4223
23  ldc               0x00004036 start + 54
24  ldc               0x00000011 start + 18446744073709535249
October 28, 2009
Jacob Carlborg wrote:
> I have quite a big project and when I compile it I get this internal compiler error: template.c:806: failed assertion `i < parameters->dim'.
> I don't know what could cause that error so I don't know where to look in my code to try to produce a small test case and report an issue. I'm using quite a lot of templates, template mixins and string mixins.

Bugzilla 2229. Was fixed in DMD1.049.
There have been about 60 ICE bugs fixed since 1.045.
I want to find out what the regressions are that are stopping people from using the latest DMD -- it's time for the ICE age to end.
October 28, 2009
On 10/28/09 16:32, Don wrote:
> Jacob Carlborg wrote:
>> I have quite a big project and when I compile it I get this internal
>> compiler error: template.c:806: failed assertion `i < parameters->dim'.
>> I don't know what could cause that error so I don't know where to look
>> in my code to try to produce a small test case and report an issue.
>> I'm using quite a lot of templates, template mixins and string mixins.
>
> Bugzilla 2229. Was fixed in DMD1.049.
> There have been about 60 ICE bugs fixed since 1.045.
> I want to find out what the regressions are that are stopping people
> from using the latest DMD -- it's time for the ICE age to end.

Thanks, I'll try the latest DMD.
October 28, 2009
On 10/28/09 16:32, Don wrote:
> Jacob Carlborg wrote:
>> I have quite a big project and when I compile it I get this internal
>> compiler error: template.c:806: failed assertion `i < parameters->dim'.
>> I don't know what could cause that error so I don't know where to look
>> in my code to try to produce a small test case and report an issue.
>> I'm using quite a lot of templates, template mixins and string mixins.
>
> Bugzilla 2229. Was fixed in DMD1.049.
> There have been about 60 ICE bugs fixed since 1.045.
> I want to find out what the regressions are that are stopping people
> from using the latest DMD -- it's time for the ICE age to end.

I haven't been using any later version because of various known regressions, I think they've been solved know. I tried to compile Tango trunk with DMD trunk and it failed with:

/Users/doob/development/d/tango-trunk/build/user/../../user/tango/io/compress/BzipStream.d(270): Error: var has no effect in expression (w)

It's returning a value in a void function.

I don't know if it's a regression that hasn't been solved or if it's something wrong with Tango.
October 28, 2009
Jacob Carlborg wrote:
> On 10/28/09 16:32, Don wrote:
>> Jacob Carlborg wrote:
>>> I have quite a big project and when I compile it I get this internal
>>> compiler error: template.c:806: failed assertion `i < parameters->dim'.
>>> I don't know what could cause that error so I don't know where to look
>>> in my code to try to produce a small test case and report an issue.
>>> I'm using quite a lot of templates, template mixins and string mixins.
>>
>> Bugzilla 2229. Was fixed in DMD1.049.
>> There have been about 60 ICE bugs fixed since 1.045.
>> I want to find out what the regressions are that are stopping people
>> from using the latest DMD -- it's time for the ICE age to end.
> 
> I haven't been using any later version because of various known regressions, I think they've been solved know. I tried to compile Tango trunk with DMD trunk and it failed with:
> 
> /Users/doob/development/d/tango-trunk/build/user/../../user/tango/io/compress/BzipStream.d(270): Error: var has no effect in expression (w)
> 
> It's returning a value in a void function.
> 
> I don't know if it's a regression that hasn't been solved or if it's something wrong with Tango.

The compiler now catches a few bugs that used to slip past before. Just change the "return w;" into "return;".
October 28, 2009
Don wrote:
> Jacob Carlborg wrote:
>> I have quite a big project and when I compile it I get this internal compiler error: template.c:806: failed assertion `i < parameters->dim'.
>> I don't know what could cause that error so I don't know where to look in my code to try to produce a small test case and report an issue. I'm using quite a lot of templates, template mixins and string mixins.
> 
> Bugzilla 2229. Was fixed in DMD1.049.
> There have been about 60 ICE bugs fixed since 1.045.
> I want to find out what the regressions are that are stopping people from using the latest DMD -- it's time for the ICE age to end.

Very nicely put!

Andrei
October 28, 2009
Don wrote:
> Jacob Carlborg wrote:
>> On 10/28/09 16:32, Don wrote:
>>> Jacob Carlborg wrote:
>>>> I have quite a big project and when I compile it I get this internal
>>>> compiler error: template.c:806: failed assertion `i < parameters->dim'.
>>>> I don't know what could cause that error so I don't know where to look
>>>> in my code to try to produce a small test case and report an issue.
>>>> I'm using quite a lot of templates, template mixins and string mixins.
>>>
>>> Bugzilla 2229. Was fixed in DMD1.049.
>>> There have been about 60 ICE bugs fixed since 1.045.
>>> I want to find out what the regressions are that are stopping people
>>> from using the latest DMD -- it's time for the ICE age to end.
>>
>> I haven't been using any later version because of various known regressions, I think they've been solved know. I tried to compile Tango trunk with DMD trunk and it failed with:
>>
>> /Users/doob/development/d/tango-trunk/build/user/../../user/tango/io/compress/BzipStream.d(270): Error: var has no effect in expression (w)
>>
>> It's returning a value in a void function.
>>
>> I don't know if it's a regression that hasn't been solved or if it's something wrong with Tango.
> 
> The compiler now catches a few bugs that used to slip past before. Just change the "return w;" into "return;".

I thought that was a feature?
October 29, 2009
grauzone wrote:
> Don wrote:
>> Jacob Carlborg wrote:
>>> On 10/28/09 16:32, Don wrote:
>>>> Jacob Carlborg wrote:
>>>>> I have quite a big project and when I compile it I get this internal
>>>>> compiler error: template.c:806: failed assertion `i < parameters->dim'.
>>>>> I don't know what could cause that error so I don't know where to look
>>>>> in my code to try to produce a small test case and report an issue.
>>>>> I'm using quite a lot of templates, template mixins and string mixins.
>>>>
>>>> Bugzilla 2229. Was fixed in DMD1.049.
>>>> There have been about 60 ICE bugs fixed since 1.045.
>>>> I want to find out what the regressions are that are stopping people
>>>> from using the latest DMD -- it's time for the ICE age to end.
>>>
>>> I haven't been using any later version because of various known regressions, I think they've been solved know. I tried to compile Tango trunk with DMD trunk and it failed with:
>>>
>>> /Users/doob/development/d/tango-trunk/build/user/../../user/tango/io/compress/BzipStream.d(270): Error: var has no effect in expression (w)
>>>
>>> It's returning a value in a void function.
>>>
>>> I don't know if it's a regression that hasn't been solved or if it's something wrong with Tango.
>>
>> The compiler now catches a few bugs that used to slip past before. Just change the "return w;" into "return;".
> 
> I thought that was a feature?

It's OK for a void function to return another void function, and it's OK if the expression has side-effects. The situations which have been disallowed are ones where the compiler used to completely ignore the expression, generating no code at all. It's now treated exactly the same as if you wrote:

 w;
 return;

The bug was that although the compiler has always done that transformation, it wasn't running the semantic pass on it.