[Issue 4869] auto return + inheritance + modules = compiler crashes(toctype.c)

2010-09-22 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4869


Walter Bright bugzi...@digitalmars.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||bugzi...@digitalmars.com
 Resolution||FIXED


--- Comment #5 from Walter Bright bugzi...@digitalmars.com 2010-09-22 
16:18:38 PDT ---
http://www.dsource.org/projects/dmd/changeset/684

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4869] auto return + inheritance + modules = compiler crashes(toctype.c)

2010-09-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4869



--- Comment #3 from Don clugd...@yahoo.com.au 2010-09-14 23:57:45 PDT ---
This is happening because semantic3() isn't run on the base class function.
Bug 3602 has a similar root cause.

A workaround is to use the function in module b.d. This forces semantic3 to be
run on 'fun'.
void workaround(Derived d)
{
   auto k = d.fun();
}


Mitigation patch (turns it into rejects-valid):
-
tocsym.c, line 349, FuncDeclaration::toSymbol()

s = symbol_calloc(id);
slist_add(s);
+// Ensure function has a return value
+if (type-ty == Tfunction  !((TypeFunction *)type)-next)
+{
+error(Internal Compiler Error. See Bugzilla 4869.);
+// Prevent a later crash
+((TypeFunction *)type)-next = Type::tint32;
+}
{
s-prettyIdent = toPrettyChars();
s-Sclass = SCglobal;
symbol_func(s);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4869] auto return + inheritance + modules = compiler crashes(toctype.c)

2010-09-15 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4869


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

   Keywords||patch


--- Comment #4 from Don clugd...@yahoo.com.au 2010-09-15 05:06:45 PDT ---
Proper patch. The assert in comment 2 should still be added.


toobj.c line 790. ClassDeclaration::toObjFile(). Ensure each function has had
semantic3 run on it, if the return type is still unknown. (Ideally, this should
happen earlier on, but better late than never).

for (; i  vtbl.dim; i++)
{
FuncDeclaration *fd = ((Dsymbol *)vtbl.data[i])-isFuncDeclaration();

//printf(\tvtbl[%d] = %p\n, i, fd);
if (fd  (fd-fbody || !isAbstract()))
{   
+// Ensure function has a return value (Bugzilla 4869)
+if (fd-type-ty == Tfunction  !((TypeFunction
*)fd-type)-next)
+{
+assert(fd-scope);
+fd-semantic3(fd-scope);
+}
Symbol *s = fd-toSymbol();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4869] auto return + inheritance + modules = compiler crashes

2010-09-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4869


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

 CC||clugd...@yahoo.com.au


--- Comment #1 from Don clugd...@yahoo.com.au 2010-09-14 20:52:39 PDT ---
Not a regression. This fails on 2.026 and later.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 4869] auto return + inheritance + modules = compiler crashes(toctype.c)

2010-09-14 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=4869


Don clugd...@yahoo.com.au changed:

   What|Removed |Added

Summary|auto return + inheritance + |auto return + inheritance +
   |modules = compiler crashes  |modules = compiler
   ||crashes(toctype.c)


--- Comment #2 from Don clugd...@yahoo.com.au 2010-09-14 21:02:06 PDT ---
The segfault should be turned into an ICE with this code: toctype.c, line 254
TypeFunction::toCtype()

if (varargs != 1)
t-Tflags |= TFfixed;
ctype = t;
+assert(next);
t-Tnext = next-toCtype();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---