Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
May 04, 2009 [Issue 2935] New: ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2935 Summary: ICE(out.c) using struct with constructor as function default argument Product: D Version: 2.029 Platform: PC OS/Version: Windows Status: NEW Keywords: ice-on-valid-code Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: clugdbug@yahoo.com.au This is a variation of bug 2437, but ICEs in a completely different place. --- struct Foo{ int z; this(int a){z=a;} } void bar(Foo a = Foo(1)){ } void foo() { bar(); } --- Internal error: ..\ztc\out.c 1199 -- |
September 02, 2009 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #1 from Don <clugdbug@yahoo.com.au> 2009-09-02 12:15:57 PDT --- Same root cause as bug 2437, and the same simple patch fixes it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 03, 2009 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|patch | --- Comment #2 from Don <clugdbug@yahoo.com.au> 2009-09-03 00:29:40 PDT --- Not patched yet, see bug 2437 for details. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 06, 2009 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Rob Jacques <sandford@jhu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |sandford@jhu.edu --- Comment #3 from Rob Jacques <sandford@jhu.edu> 2009-10-05 21:03:51 PDT --- Note that struct defaults using either opAssign or static opCall do not seem to be affected by this bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 14, 2009 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |2korden@gmail.com --- Comment #4 from Don <clugdbug@yahoo.com.au> 2009-10-14 07:45:46 PDT --- *** Issue 3399 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
December 25, 2009 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 --- Comment #5 from Koroskin Denis <2korden@gmail.com> 2009-12-25 07:15:59 PST --- *** Issue 3648 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 12, 2010 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #6 from Don <clugdbug@yahoo.com.au> 2010-04-12 13:01:45 PDT --- PATCH: I think it's enough to change tocsym.c, VarDeclaration::toSymbol(), around line 201. If it's a CTFE variable, it's shouldn't be marked as an extern. t->Tcount++; - if (isDataseg()) + if (isDataseg() && !isCTFE()) { if (isThreadlocal()) { /* Thread local storage */ TYPE *ts = t; ts->Tcount++; // make sure a different t is allocated -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 27, 2010 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2010-04-27 08:49:55 PDT --- The problem is a semantic one. Default arguments are evaluated in the context of the function declaration, not where it's used. So, the temporary generated by the constructor is created in global space! The patch tries to force it back into the function scope, but that doesn't work as you can see if you change foo() to: void foo() { bar(); bar(); } as it fails trying to allocate the same symbol twice. Not sure what the correct solution is at the moment. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 27, 2010 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 --- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2010-04-27 09:04:17 PDT --- The problem is the code here in expression.c funcParameters(): arg = p->defaultArg; arg = arg->copy(); <-- Danger, Will Robinson! arg = arg->resolveLoc(loc, sc); arguments->push(arg); The arg->copy() is the problem, as it will copy any DeclarationExp's resulting in multiple declarations with the same name. A correct fix will be to do what DeclarationExp::doInline() does, which is for any non-static declarations, create another declaration. A new expression tree walker has to be built to accomplish this. Perhaps a good approach is to create a generic walker that accepts a lambda function to operate on each node. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 27, 2010 [Issue 2935] ICE(out.c) using struct with constructor as function default argument | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2935 --- Comment #9 from Walter Bright <bugzilla@digitalmars.com> 2010-04-27 11:37:45 PDT --- changeset 452 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation