digitalmars.D.bugs - [Issue 10382] New: Regression (2.059): ICE when catching illegal type
- d-bugmail puremagic.com (61/61) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (7/7) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (14/17) Jun 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (11/11) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (9/9) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (10/10) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
- d-bugmail puremagic.com (6/6) Jun 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10382
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Summary: Regression (2.059): ICE when catching illegal type Product: D Version: future Platform: All OS/Version: All Status: NEW Keywords: ice Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: doob me.com The following results in a segmentation fault: void main () { try { int b = 3; } catch (int a) { } } I think the problem is that the compiler doesn't perform semantic analyzes in all cases on catch statements. https://github.com/D-Programming-Language/dmd/blob/master/src/statement.c#L4561 If the if-statement and return is removed from statement.c#L4561 everything works correctly. This guard for the semantic analyze was added for a reason, in this commit: c28df7d72e72f6c0c3bb389538afb1871b7ad15c DMD checks the "type" instance variable to determine if the semantic analyze has been run for a given statement. The problem in this case is this piece of code: https://github.com/D-Programming-Language/dmd/blob/master/src/parse.c#L4641 This will set "type" on the Catch statement in the constructor. When the compiler then comes to run the semantic analyze on the Catch statement it thinks it's already been run. To me it seems it's not reliable to check "type" if the semantic analyze has been run. Perhaps add a new flag? The ICE will only happen if there's some code in the try-statement. If I remove the code in the try-statement I can basically put whatever I want in the catch-statement, that is syntactically correct, without the compiler complaining. This compiles fine: void main () { try { } catch (int sdf) { asd; a * + 4; a b; } } I'm a bit surprised that this regression has been available for so long. I actually only found it by inspecting the source code of DMD. Then I was able to produce a test case. Seems people always write their catch-statements correctly :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Link to the commit introducing the guard: https://github.com/D-Programming-Language/dmd/commit/c28df7d72e72f6c0c3bb389538afb1871b7ad15c -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Kenji Hara <k.hara.pg gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull Version|future |D2Link to the commit introducing the guard: https://github.com/D-Programming-Language/dmd/commit/c28df7d72e72f6c0c3bb389538afb1871b7ad15cMy past bug fix for bug 7814 was essentially incorrect, because it was caused by bug 10049. https://github.com/D-Programming-Language/dmd/pull/2190 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a80d2893f693f9dbe87fb2528d79287c1ef52bf4 fix Issue 10382 - ICE when catching illegal type https://github.com/D-Programming-Language/dmd/commit/1f0af1f141caa1bc8e67116821e6cca84dae8b88 [REG2.059] Issue 10382 - ICE when catching illegal type -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/60e5b0a5b1196a71bfe5cef4f67a05ac22d9975f [REG2.059] Issue 10382 - ICE when catching illegal type -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10382 Thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 17 2013