Assertion failure: '!cases' on line 2620 in file 'statement.c'
Don
nospam at nospam.com
Thu Jan 13 07:10:35 PST 2011
%u wrote:
> == Quote from Don (nospam at nospam.com)'s article
>> It's in a switch statement somewhere.
>> It sounds as though this is a bug which involves multiple files, so
>> it'll be difficult to reduce it.
>> If you're able to compile DMD, change this line in statement.c line 2620:
>> Statement *SwitchStatement::semantic(Scope *sc)
>> {
>> //printf("SwitchStatement::semantic(%p)\n", this);
>> tf = sc->tf;
>> + if (cases) error("xxx");
>> assert(!cases); // ensure semantic() is only run once
>> and then you'll get the line number where the error is.
>
> Yay for first time compiling dmd :)
Sorry you had to do that!
>
>> If you can provide the function which contains the switch statement,
>> there's a chance I could reproduce it.
>
> I've got something better.. a minimal version :)
> Which even crashes through bud.
Awesome!
I'll track this sucker down so it doesn't hit anyone else.
>
> ----
> module main;
>
> enum E { A = 0 };
>
> struct S{
> int i;
>
> static S func( S s, E e ){
> switch( e ) //<---------- here
> {
> default:return s;
> }
> }
>
> static const S s_def = { 1 };
> //static const S A = func(s_def, E.A ); // forward reference error + crash
> //static const S[1] ARR = [ E.A : func(s_def, E.A )]; // error : xxx + crash
> }
>
> void main(){}
> ----
> To test all this I switched from 1.065 to 1.066; just to make sure it hadn't been
> fixed already.
> And now my project won't compile any more even though bud+1.065 will happily do so..
> bud+ 1.066 gives me the following (no crash though)
>
> Max # of fixups = 89
> Max # of fixups = 4
> Max # of fixups = 112
> Max # of fixups = 17
> Max # of fixups = 2871
> Max # of fixups = 233
> Max # of fixups = 138
> Max # of fixups = 7
> Max # of fixups = 353
> Max # of fixups = 446
> Max # of fixups = 5
> Max # of fixups = 4117
> Max # of fixups = 37
> Max # of fixups = 288
> Max # of fixups = 330
> Max # of fixups = 338
> Max # of fixups = 144
> Max # of fixups = 660
> Max # of fixups = 51
> Max # of fixups = 4
> Max # of fixups = 220
> Max # of fixups = 2765
> Max # of fixups = 12
> Max # of fixups = 5
> Max # of fixups = 5564
> Max # of fixups = 2714
> Internal error: backend\cgobj.c 2424
>
> What does that mean?
The DMD makefile compiles in debug mode by default. It prints some
useless 'fixups' junk. You need to compile with make -fwin32.mak release
or make -flinux.mak release
to make a release compiler. But, not important, you can go back to using
an official compiler again. <g>
The internal error means it's now crashing in the backend, rather than
the frontend. Not an improvement!
More information about the Digitalmars-d-learn
mailing list