Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
June 16, 2013 [Issue 10382] New: Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from Jacob Carlborg <doob@me.com> 2013-06-16 07:56:19 PDT --- 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: ------- |
June 16, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | http://d.puremagic.com/issues/show_bug.cgi?id=10382 --- Comment #1 from Jacob Carlborg <doob@me.com> 2013-06-16 08:00:18 PDT --- 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: ------- |
June 17, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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 |D2 --- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2013-06-16 18:36:36 PDT --- (In reply to comment #1) > Link to the commit introducing the guard: > > https://github.com/D-Programming-Language/dmd/commit/c28df7d72e72f6c0c3bb389538afb1871b7ad15c My 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: ------- |
June 17, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | http://d.puremagic.com/issues/show_bug.cgi?id=10382 --- Comment #3 from github-bugzilla@puremagic.com 2013-06-17 14:25:57 PDT --- 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 Merge pull request #2190 from 9rnsr/fix10382 [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: ------- |
June 17, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | http://d.puremagic.com/issues/show_bug.cgi?id=10382 --- Comment #4 from github-bugzilla@puremagic.com 2013-06-17 14:27:13 PDT --- Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/60e5b0a5b1196a71bfe5cef4f67a05ac22d9975f Merge pull request #2190 from 9rnsr/fix10382 [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: ------- |
June 17, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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: ------- |
June 18, 2013 [Issue 10382] Regression (2.059): ICE when catching illegal type | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | http://d.puremagic.com/issues/show_bug.cgi?id=10382 --- Comment #5 from Jacob Carlborg <doob@me.com> 2013-06-17 23:52:43 PDT --- Thanks. -- 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