-
-
Notifications
You must be signed in to change notification settings - Fork 422
Try to fix issue 19831 without understanding by copying the behavior from __dmd_personality_v0 #2602
Conversation
|
Thanks for your pull request and interest in making D better, @FeepingCreature! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub fetch digger
dub run digger -- build "stable + druntime#2602" |
73f75a9 to
61419a4
Compare
|
oh no they're passing |
|
Note from IRL: @ibuclaw looked it over and thinks it's basically sound, he might have some time tomorrow at the Hackathon to get it documented a bit better. |
|
Note that I only wrote the original Windows exception chaining, I don't know anything about how the Linux exception handler works. Does this bug apply to Windows as well? |
|
Walter also said that exception chaining should be removed and we should go back to C++ and crashing on throw-in-finally. I must strenuously object to at least that last part - (I found this bug when I was looking at a case where I wanted to see the chained exception btw, and was upset it wasn't shown.) |
|
Re Windows: I tried with wine+DMDwin32 and at least in that configuration, the problem does not occur. |
|
I think there needs to be a few more tests. See eh.d exception chaining tests, but adapt as you do here to trigger the bug. |
|
I don't understand what you mean. You already can't |
|
ping @ibuclaw |
|
@FeepingCreature there is a slight distinction between those tests and this test. In eh.d you have: This test is: I think that those tests could be copied to your new test file and amended as needed to check that the various weird chain cases and this mix well. |
|
I'll take a look tomorrow. |
61419a4 to
33f3ea3
Compare
|
@ibuclaw Is this better? It's hard to write comments and tests for code that I don't understand how it works. Since you said you did (:+1:), are the comments right like this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, and tests look good.
| //printf("start: %p '%.*s'\n", ehobject, ehobject.classinfo.info.name.length, ehobject.classinfo.info.name.ptr); | ||
| for (ExceptionHeader* ehn = eh.next; ehn; ehn = ehn.next) | ||
| { | ||
| // like __dmd_personality_v0, don't combine when the exceptions are from different functions | ||
| // (fixes issue 19831, exception thrown and caught while inside finally block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note, if a function has been partitioned, this will also not match.
However this will never happen with dmd, and gdc turns off partitioning unless the optimization is explicitly requested on the command line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This broke runnable/eh.d for LDC [with its slight modifications in this file]. The testsuite passes again when NOT breaking here as long as currentLsd is null (if (currentLsd && currentLsd != ehn.languageSpecificData) ...), but I have no idea whether that's correct. @ibuclaw: any thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it be null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT, each ExceptionHeader.languageSpecificData starts out with null and is only set after finding a matching handler/catch in the search phase (and only for D exceptions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the lsda is known since the beginning of the personality function, you could either eagerly set it, or pass it onto getClassInfo to initialize cuurentLsd with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the question is rather 'why does DMD have no problem with it'. I'll pass it through; pls ping me if GDC has problems too, so that we can come up with something here upstream.
|
I would like to see a test where the exception is thrown in one function and caught in another. If this works, your PR has my blessing. |
33f3ea3 to
1d8f700
Compare
|
@donc See |
1d8f700 to
5c330d3
Compare
|
LGTM. |
|
As this fixes a severity major bug it should go in stable, unless you don't feel confident about doing so. |
… to __dmd_personality_v0 (ignoring in-flight exceptions that we haven't collided with yet)
5c330d3 to
7a3d881
Compare
After dlang#2602; no idea why DMD doesn't have a problem with it.
NOT feeling good about this. Seems to work though???
Mostly opening this PR so tests get run.
This was not arrived at through any kind of insight, but mostly by flailing around.
Ping @donc . Help us Don Clugston, you're our only hope.
edit: @kinke ping? ("No. There is another.")