www.digitalmars.com         C & C++   DMDScript  

D - BUG?

reply Stephan Wienczny <wienczny web.de> writes:
When compiling I get this error.
I've not yet found which sourcelines produce it.
Walter do you have a clue what it could be?

dmd: expression.c:1191: virtual int StringExp::compare(Object*): 
Assertion `0' failed.
Jan 30 2004
next sibling parent reply imr1984 <imr1984_member pathlink.com> writes:
?
Jan 30 2004
parent Stephan Wienczny <wienczny web.de> writes:
imr1984 wrote:
 ?
 
 

Looking at the source of expression.c, its obvious what is wrong. I'm using a dchar and there is "not yet" an compare function for UTF32, although I use Linux and wchar_t is UTF32..... Stephan
Jan 30 2004
prev sibling parent reply J C Calvarese <jcc7 cox.net> writes:
Stephan Wienczny wrote:
 When compiling I get this error.
 I've not yet found which sourcelines produce it.
 Walter do you have a clue what it could be?
 
 dmd: expression.c:1191: virtual int StringExp::compare(Object*): 
 Assertion `0' failed.
 

Maybe you're comparing an object's string to another string? Apparently sz (whatever that is) isn't 1 or 2, so it's a situation that Walter didn't plan for, but he planned for it enough to put an assert in there... I think whatever happened is a bug since the compiler should have at least indicated WHERE it occurred (and hopefully WHY, too) in your source. If you could post some code that exhibits this problem, someone may be able to help you snip it down to a clear error report. excerpt from dmd\src\dmd\expression.c (around 1191)... int StringExp::compare(Object *obj) { // Used to sort case statement expressions so we can do an efficient lookup StringExp *se2 = (StringExp *)(obj); // This is a kludge so isExpression() in template.c will return 5 // for StringExp's. if (!se2) return 5; assert(se2->op == TOKstring); int len1 = len; int len2 = se2->len; if (len1 == len2) { switch (sz) { case 1: return strcmp((char *)string, (char *)se2->string); case 2: return wcscmp((wchar_t *)string, (wchar_t *)se2->string); case 4: /* not implemented */ default: assert(0); /* ****** line 1191 ****** */ } } return len1 - len2; } -- Justin http://jcc_7.tripod.com/d/
Jan 30 2004
parent reply Stephan Wienczny <wienczny web.de> writes:
J C Calvarese wrote:
 Stephan Wienczny wrote:
 
 When compiling I get this error.
 I've not yet found which sourcelines produce it.
 Walter do you have a clue what it could be?

 dmd: expression.c:1191: virtual int StringExp::compare(Object*): 
 Assertion `0' failed.

Maybe you're comparing an object's string to another string? Apparently sz (whatever that is) isn't 1 or 2, so it's a situation that Walter didn't plan for, but he planned for it enough to put an assert in there... I think whatever happened is a bug since the compiler should have at least indicated WHERE it occurred (and hopefully WHY, too) in your source. If you could post some code that exhibits this problem, someone may be able to help you snip it down to a clear error report. excerpt from dmd\src\dmd\expression.c (around 1191)... int StringExp::compare(Object *obj) { // Used to sort case statement expressions so we can do an efficient lookup StringExp *se2 = (StringExp *)(obj); // This is a kludge so isExpression() in template.c will return 5 // for StringExp's. if (!se2) return 5; assert(se2->op == TOKstring); int len1 = len; int len2 = se2->len; if (len1 == len2) { switch (sz) { case 1: return strcmp((char *)string, (char *)se2->string); case 2: return wcscmp((wchar_t *)string, (wchar_t *)se2->string); case 4: /* not implemented */ default: assert(0); /* ****** line 1191 ****** */ } } return len1 - len2; }

See my other post! case 1: UTF8 case 2: UTF16 case 4: UTF32 //dchar on Linux I've got some expression like this one: if ((cast(Operator)(curiter.Value)).value == ".") mit Value definiert als class Operator { dchar Value(); } p.s.: freinhand geschrieben, da sourcen gerade nicht vorhanden
Jan 30 2004
parent reply J C Calvarese <jcc7 cox.net> writes:
Stephan Wienczny wrote:

 J C Calvarese wrote:
 
 Stephan Wienczny wrote:

 When compiling I get this error.
 I've not yet found which sourcelines produce it.
 Walter do you have a clue what it could be?

 dmd: expression.c:1191: virtual int StringExp::compare(Object*): 
 Assertion `0' failed.

Maybe you're comparing an object's string to another string? Apparently sz (whatever that is) isn't 1 or 2, so it's a situation that Walter didn't plan for, but he planned for it enough to put an assert in there... I think whatever happened is a bug since the compiler should have at least indicated WHERE it occurred (and hopefully WHY, too) in your source. If you could post some code that exhibits this problem, someone may be able to help you snip it down to a clear error report. excerpt from dmd\src\dmd\expression.c (around 1191)... int StringExp::compare(Object *obj) { // Used to sort case statement expressions so we can do an efficient lookup StringExp *se2 = (StringExp *)(obj); // This is a kludge so isExpression() in template.c will return 5 // for StringExp's. if (!se2) return 5; assert(se2->op == TOKstring); int len1 = len; int len2 = se2->len; if (len1 == len2) { switch (sz) { case 1: return strcmp((char *)string, (char *)se2->string); case 2: return wcscmp((wchar_t *)string, (wchar_t *)se2->string); case 4: /* not implemented */ default: assert(0); /* ****** line 1191 ****** */ } } return len1 - len2; }

See my other post!

(Maybe I took too long writing my reply. Sorry! :))
 case 1: UTF8
 case 2: UTF16
 case 4: UTF32 //dchar on Linux
 
 I've got some expression like this one:
 
 if ((cast(Operator)(curiter.Value)).value == ".")
 
 mit Value definiert als
 class Operator
 {
 dchar Value();
 }
 
 p.s.: freinhand geschrieben, da sourcen gerade nicht vorhanden
 

I was only trying to help... -- Justin http://jcc_7.tripod.com/d/
Jan 30 2004
parent Stephan Wienczny <wienczny web.de> writes:
J C Calvarese wrote:
 
 I was only trying to help...
 

Thanks for your time!
Jan 30 2004