-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Issue 24295 - [betterC] ICE with new int[] #15982
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 run digger -- build "stable + dmd#15982" |
cc @teodutu |
The stable branch is frozen now |
compiler/src/dmd/expressionsem.d
Outdated
if (global.params.betterC || !sc.needsCodegen()) | ||
if (global.params.betterC && sc.needsCodegen()) | ||
{ | ||
error(exp.loc, "expression `%s` allocates with the GC and cannot be used with switch `-betterC`", exp.toChars()); |
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.
Need something better than referencing switches that don't exist in error messages. #15747
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.
Perhaps we need an enum that maps fields in dmd.globals.Params
to their corresponding CLI option name. That way GDC and LDC can override DMD-specific CLI option names in one place without requiring ugly conditional code like #15747.
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 version(IN_GCC)
is awful. However, it is not the scope of this PR to replace it.
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.
fair enough
@@ -5115,7 +5115,13 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor | |||
tb = tb.isTypeDArray().next.toBasetype(); | |||
} | |||
|
|||
if (global.params.betterC || !sc.needsCodegen()) |
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.
Can we stop using betterC as a gate for semantic decision paths and use more granular params?
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, we should remove the betterC
from dmd.globals.Params
and only use dmd.globals.Params.use{ModuleInfo,TypeInfo,Exceptions}
in the frontend. The only place that should concern itself with whether -betterC
was passed on the command-line is the driver and except for seetting dmd.globals.Params.use{ModuleInfo,TypeInfo,Exceptions}
it is only needed too know whether to link Druntime and Phobos.
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.
yes please!!
@ibuclaw @PetarKirov @ntrel I have addressed your concerns. |
No description provided.