Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
April 08, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 John Colvin <john.loughran.colvin@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|segmentation fault when |ICE when using tuple over |using tuple over member |member variable in more |variable in more than one |than one method |method | -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 10:40:50 UTC --- (In reply to comment #0) > test.d: > > template Tuple(Stuff ...) { > alias Stuff Tuple; > } > struct S { > int i; > alias Tuple!i t; > void a() { > auto x = t; > } > void b() { > auto x = t; > } > } > gdc -c test.d: > > ldc_sf.d: In member function ‘ldc_sf.S.b’: That should say: "test.d: In member function: test.S.b" :o) > ldc has a similar error: https://github.com/ldc-developers/ldc/issues/266 So it's likely a wrong-code bug in the D frontend then. -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #2 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 11:25:48 UTC --- (In reply to comment #0) > test.d: > > template Tuple(Stuff ...) { > alias Stuff Tuple; > } > struct S { > int i; > alias Tuple!i t; > void a() { > auto x = t; > } > void b() { > auto x = t; > } > } Tracked down to the following: void a() { // OK: 'this' has decl context of 'a' (int) x = tuple(this.i); } void b() { // WRONG: 'this' has decl context of 'a' (int) x = tuple(this.i); } -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #3 from John Colvin <john.loughran.colvin@gmail.com> 2013-04-09 11:43:02 UTC --- (In reply to comment #1) > (In reply to comment #0) > > test.d: > > > > template Tuple(Stuff ...) { > > alias Stuff Tuple; > > } > > struct S { > > int i; > > alias Tuple!i t; > > void a() { > > auto x = t; > > } > > void b() { > > auto x = t; > > } > > } > > gdc -c test.d: > > > > ldc_sf.d: In member function ‘ldc_sf.S.b’: > > That should say: "test.d: In member function: test.S.b" > > :o) sorry, copied the code from the original ldc bug and the error from my own terminal, hence the different file-names. > > ldc has a similar error: https://github.com/ldc-developers/ldc/issues/266 > > So it's likely a wrong-code bug in the D frontend then. however, dmd appears not to have the bug. -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #4 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 13:07:59 UTC --- (In reply to comment #3) > (In reply to comment #1) > > (In reply to comment #0) > > > test.d: > > > > > > template Tuple(Stuff ...) { > > > alias Stuff Tuple; > > > } > > > struct S { > > > int i; > > > alias Tuple!i t; > > > void a() { > > > auto x = t; > > > } > > > void b() { > > > auto x = t; > > > } > > > } > > > gdc -c test.d: > > > > > > ldc_sf.d: In member function ‘ldc_sf.S.b’: > > > > That should say: "test.d: In member function: test.S.b" > > > > :o) > > sorry, copied the code from the original ldc bug and the error from my own terminal, hence the different file-names. > > > > ldc has a similar error: https://github.com/ldc-developers/ldc/issues/266 > > > > So it's likely a wrong-code bug in the D frontend then. > > however, dmd appears not to have the bug. That's because dmd is VERY lax about wrong code. And will accept ANY old garbage. Example from last year, caused ICE in GDC and LDC because you can't convert void to boolean. void foo() { } if (false || foo()) /* ... */; So no, saying that dmd does not have the bug is NOT helpful in 90% of cases that cause the compiler to ICE. -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 13:16:47 UTC --- (In reply to comment #2) > (In reply to comment #0) > > test.d: > > > > template Tuple(Stuff ...) { > > alias Stuff Tuple; > > } > > struct S { > > int i; > > alias Tuple!i t; > > void a() { > > auto x = t; > > } > > void b() { > > auto x = t; > > } > > } > > > Tracked down to the following: > > void a() { > // OK: 'this' has decl context of 'a' > (int) x = tuple(this.i); > } > > void b() { > // WRONG: 'this' has decl context of 'a' > (int) x = tuple(this.i); > } Looks like TupleExp's are cached and re-used. This is why when the TupleExp::semantic ran in b() has a parent of 'a' -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #6 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 13:41:15 UTC --- (In reply to comment #5) > (In reply to comment #2) > > (In reply to comment #0) > > > test.d: > > > > > > template Tuple(Stuff ...) { > > > alias Stuff Tuple; > > > } > > > struct S { > > > int i; > > > alias Tuple!i t; > > > void a() { > > > auto x = t; > > > } > > > void b() { > > > auto x = t; > > > } > > > } > > > > > > Tracked down to the following: > > > > void a() { > > // OK: 'this' has decl context of 'a' > > (int) x = tuple(this.i); > > } > > > > void b() { > > // WRONG: 'this' has decl context of 'a' > > (int) x = tuple(this.i); > > } > > > Looks like TupleExp's are cached and re-used. This is why when the TupleExp::semantic ran in b() has a parent of 'a' Fix - Not sure if there are any other cases where this could happen. --- a/gcc/d/dfrontend/expression.c +++ b/gcc/d/dfrontend/expression.c @@ -5200,7 +5200,7 @@ TupleExp::TupleExp(Loc loc, TupleDeclaration *tup) if (o->dyncast() == DYNCAST_EXPRESSION) { Expression *e = (Expression *)o; - if (e->op == TOKdsymbol) + if (e->op == TOKdsymbol || e->op == TOKdotvar) e = e->syntaxCopy(); exps->push(e); } -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 09, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 --- Comment #7 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-09 14:58:56 UTC --- https://github.com/D-Programming-Language/dmd/pull/1880 -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
April 12, 2013 [Bug 49] ICE when using tuple over member variable in more than one method | ||||
---|---|---|---|---|
| ||||
http://bugzilla.gdcproject.org/show_bug.cgi?id=49 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #8 from Iain Buclaw <ibuclaw@gdcproject.org> 2013-04-12 12:35:24 UTC --- https://github.com/D-Programming-GDC/GDC/commit/ea160b7aeae321603062977e883ac8def3c7deaa -- Configure bugmail: http://bugzilla.gdcproject.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are watching all bug changes. |
Copyright © 1999-2021 by the D Language Foundation