extract this and run compile.sh to cause the segfault
application/x-gzip
86066
Comments
Comment #0 by cruxic — 2010-09-25T08:42:15Z
Created attachment 775
extract this and run compile.sh to cause the segfault
The dmd compiler segfaults when compiling the attached code. Extract the
archive and run compile.sh. dmd v2.048 on Ubuntu 10.04 32bit.
Please overlook my messy and error riddled D code as I'm actually in the
process of converting a Vala program to D.
Comment #1 by bearophile_hugs — 2010-09-25T10:33:24Z
I suggest you to slowly reduce the code, until it's just few lines of code.
Comment #2 by cruxic — 2010-09-26T21:03:32Z
Okay. I can reduce it if you need me to. Or does D have a debugging tool where you can simply run the program under the debugger and it will show you where the segfault came from?
Comment #3 by clugdbug — 2010-09-27T00:41:56Z
It's OK, I'm able to reproduce it.
TEST CASE
---------
void bug4938()
{
try
{
return 0;
}
catch (Undefined4938 ee)
{
return 3;
}
}
-----------
PATCH
statement.c, line 4132.
-----------
int TryCatchStatement::blockExit()
{
assert(body);
int result = body->blockExit();
int catchresult = 0;
for (size_t i = 0; i < catches->dim; i++)
{
Catch *c = (Catch *)catches->data[i];
+ if (c->type == Type::terror)
+ continue;
catchresult |= c->blockExit();
/* If we're catching Object, then there is no throwing
*/
+ assert(c->type->toBasetype()->isClassHandle());
Identifier *id = c->type->toBasetype()->isClassHandle()->ident;