www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Assertion failure: '!cases' on line 2620 in file 'statement.c'

reply %u <e ee.com> writes:
Assertion failure: '!cases' on line 2620 in file 'statement.c'

This is what I got from trying to build my project(30+ modules) without bud.
Jan 12 2011
parent reply %u <e ee.com> writes:
Should I post it as a bug, even though I have no code to accompany it?
I have no clue as to where to start my directed search for a minimal case.
Jan 12 2011
next sibling parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
%u <e ee.com> wrote:

 Should I post it as a bug, even though I have no code to accompany it?
 I have no clue as to where to start my directed search for a minimal  
 case.

Please do post it, yes. As for searching, if you are willing to share the code , others may be willing to do the search. -- Simen
Jan 12 2011
prev sibling next sibling parent reply Don <nospam nospam.com> writes:
%u wrote:
 Should I post it as a bug, even though I have no code to accompany it?
 I have no clue as to where to start my directed search for a minimal case.

Can you post the entire source code? It's important that it be reproducible. It doesn't need to be minimal - someone else can reduce it.
Jan 12 2011
parent reply %u <e ee.com> writes:
== Quote from Don (nospam nospam.com)'s article
 %u wrote:
 Should I post it as a bug, even though I have no code to accompany it?
 I have no clue as to where to start my directed search for a minimal case.

It's important that it be reproducible. It doesn't need to be minimal - someone else can reduce it.

I crashed it again :) Sorry, can't share the code.. I don't really have any time atm, look at it again tomorrow.
Jan 12 2011
parent reply Don <nospam nospam.com> writes:
%u wrote:
 == Quote from Don (nospam nospam.com)'s article
 %u wrote:
 Should I post it as a bug, even though I have no code to accompany it?
 I have no clue as to where to start my directed search for a minimal case.

It's important that it be reproducible. It doesn't need to be minimal - someone else can reduce it.

I crashed it again :) Sorry, can't share the code..

Bummer.
 I don't really have any time atm, look at it again tomorrow.

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. If you can provide the function which contains the switch statement, there's a chance I could reproduce it.
Jan 13 2011
parent reply %u <e ee.com> writes:
== Quote from Don (nospam 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 :)
 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. ---- 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?
Jan 13 2011
parent reply Don <nospam nospam.com> writes:
%u wrote:
 == Quote from Don (nospam 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!
Jan 13 2011
parent reply %u <e ee.com> writes:
== Quote from Don (nospam nospam.com)'s article
 Yay for first time compiling dmd :)


Had to learn that once anyway :) Maybe I'll even be able to take a stab at fixing bugs someday..
Jan 13 2011
parent Don <nospam nospam.com> writes:
%u wrote:
 == Quote from Don (nospam nospam.com)'s article
 Yay for first time compiling dmd :)


Had to learn that once anyway :) Maybe I'll even be able to take a stab at fixing bugs someday..

<g> Added your bug as: http://d.puremagic.com/issues/show_bug.cgi?id=5453
Jan 14 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 1/13/11, Don <nospam nospam.com> wrote:
 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.

Ugh, I just realized I was using DMD in debug mode by mistake for the last couple of weeks. Thanks for the info (I should have looked this up).
Jan 13 2011