digitalmars.D.bugs - [Issue 4238] New: Segfault(statement.c): with(typeof(int))
- d-bugmail puremagic.com (38/38) May 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4238
- d-bugmail puremagic.com (24/24) May 26 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4238
- d-bugmail puremagic.com (12/12) Jun 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4238
http://d.puremagic.com/issues/show_bug.cgi?id=4238
Summary: Segfault(statement.c): with(typeof(int))
Product: D
Version: 1.020
Platform: Other
OS/Version: Windows
Status: NEW
Keywords: ice-on-invalid-code, patch
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: clugdbug yahoo.com.au
TEST CASE:
-----
void bug4237()
{
int s;
with(typeof(s)) {}
}
----
PATCH (D2 svn 502):
// WithStatement::semantic. line 3639: segfaults because toDsymbol(sc)
// returns null.
{ TypeExp *es = (TypeExp *)exp;
- sym = es->type->toDsymbol(sc)->isScopeDsymbol();
+ Dsymbol *dsym = es->type->toDsymbol(sc);
+ sym = dsym ? dsym->isScopeDsymbol() : NULL;
if (!sym)
{ error("%s has no members", es->toChars());
body = body->semantic(sc);
return this;
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4238
Darn it, waited to long before hitting submit, and another bug snuck in before
this one -- test case should be changed to bug4238(). <g>.
Anyway, if you add one line to the patch, it fixes bug 1413. I was actually
trying to generate a case where 1413 matters, but failed. But I found this case
instead.
PATCH (D2 svn 502):
// WithStatement::semantic. line 3639: segfaults because toDsymbol(sc)
// returns null.
{ TypeExp *es = (TypeExp *)exp;
- sym = es->type->toDsymbol(sc)->isScopeDsymbol();
+ Dsymbol *dsym = es->type->toDsymbol(sc);
+ sym = dsym ? dsym->isScopeDsymbol() : NULL;
if (!sym)
{ error("%s has no members", es->toChars());
+ if (body)
body = body->semantic(sc);
return this;
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 26 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4238
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |FIXED
11:59:09 PDT ---
http://www.dsource.org/projects/dmd/changeset/566
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 28 2010









d-bugmail puremagic.com 