Skip to content
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

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

RazvanN7
Copy link
Contributor

@RazvanN7 RazvanN7 commented Jan 2, 2024

No description provided.

@dlang-bot
Copy link
Contributor

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 verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

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

Auto-close Bugzilla Severity Description
24295 regression [betterC] ICE with new int[]

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "stable + dmd#15982"

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Jan 2, 2024

cc @teodutu

@dkorpel
Copy link
Contributor

dkorpel commented Jan 2, 2024

The stable branch is frozen now

@dkorpel dkorpel removed the auto-merge label Jan 2, 2024
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());
Copy link
Member

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

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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())
Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please!!

@RazvanN7
Copy link
Contributor Author

RazvanN7 commented Jan 3, 2024

@ibuclaw @PetarKirov @ntrel I have addressed your concerns.

@dlang-bot dlang-bot merged commit eee0396 into dlang:stable Jan 3, 2024
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants