Fix Issue 20318 - Illegal instruction (core dumped)#10517
Fix Issue 20318 - Illegal instruction (core dumped)#10517dlang-bot merged 1 commit intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @RazvanN7! 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 "master + dmd#10517" |
Codecov Report
@@ Coverage Diff @@
## master #10517 +/- ##
==========================================
- Coverage 1.81% 1.81% -0.01%
==========================================
Files 148 148
Lines 77438 77440 +2
==========================================
Hits 1405 1405
- Misses 76033 76035 +2
Continue to review full report at Codecov.
|
Geod24
left a comment
There was a problem hiding this comment.
Doesn't look like a compilable test is what's needed there, but rather a runnable.
|
I don't get it. This was an ICE that was triggered without my patch by the testcase that I added. How can it not be covered? |
It looks like someone destroyed the coverage: https://codecov.io/gh/dlang/dmd/commits It's on 1.8% |
|
code coverage issue fixed here: #10520 |
|
Is there any way to restart codecov? |
|
Yes, you need to restart the respective build (CircleCi). I just did so for you. |
|
Nice work! I do like your explanation in the opening message here. Can you boil it down to its essence and add it as a comment to the code? Because it isn't obvious. |
Thank you!
Done. |
|
Wouldn't it be better to make the call to Lines 1676 to 1678 in a7017a9 And then assert that |
|
@PetarKirov That was my first thought also, but the call to |
|
Fair enough |
When an exception is thrown, typically it is allocated and managed by the garbage collector: the compiler replaces the expression with a call to a druntime hook, in this situation
_d_newclass. If the code is compiled withprofile=gcthe hook is further replaced with a call to another hookd_newclass_tracethat collects some stats and later calls_d_newclass.If the above code is compiled with
-dip1008the exception no longer uses the gc to be managed; it is manually managed in druntime via reference counting. So if-dip1008and-profile=gcare used together the following thing happens: (1) the exception throwing line is rewritten to a call to_d_newthrowin druntime which does the refcount initialization for the exception then (2)toTraceGCin dmd is called that replaces any allocation hooks with trace allocation hooks. Since_d_newthrowdoes not do any gc allocations and therefore does not have an associated trace function,toTraceGCgets confused and asserts.The fix is to simply return from toTraceGC if the hook is not a gc allocation hook.