Thread overview
BUG?
Jan 30, 2004
Stephan Wienczny
Jan 30, 2004
imr1984
Re: BUG!
Jan 30, 2004
Stephan Wienczny
Re: BUG? Assert in StringExp::compare(Object*);
Jan 30, 2004
J C Calvarese
Re: BUG! Assert in StringExp::compare(Object*);
Jan 30, 2004
Stephan Wienczny
Jan 30, 2004
J C Calvarese
Jan 30, 2004
Stephan Wienczny
January 30, 2004
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.

January 30, 2004
?


January 30, 2004
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

January 30, 2004
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.
> 
dmd\src\dmd\expression.c (line 1191)

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/
January 30, 2004
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.
>>
> dmd\src\dmd\expression.c (line 1191)
> 
> 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

January 30, 2004
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.
>>>
>> dmd\src\dmd\expression.c (line 1191)
>>
>> 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!
It didn't show up in my newsreader until AFTER I posted!
(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/
January 30, 2004
J C Calvarese wrote:
> 
> I was only trying to help...
> 

Thanks for your time!