Skip to content

Conversation

@dkorpel
Copy link
Contributor

@dkorpel dkorpel commented Mar 28, 2025

Getting rid of void initialization because it's bug prone: #21099

There's more, but I picked these ones first because they are:

  • redundant (because they were initialized immediately afterwards)
  • __gshared (so they get 0 initializated anyway)
  • small / not performance critical

@dkorpel dkorpel added Severity:Refactoring No semantic changes to code Compiler:Backend glue code, optimizer, code generation labels Mar 28, 2025
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @dkorpel! 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

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

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 "master + dmd#21107"

@dkorpel dkorpel marked this pull request as ready for review March 28, 2025 14:16
Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

Apart from the void initialised union members, this looks good.

@dkorpel dkorpel force-pushed the backend-void-init branch from 5b979a7 to f3377cb Compare March 28, 2025 23:29
@dkorpel dkorpel merged commit 712cc9b into dlang:master Mar 29, 2025
41 of 42 checks passed
@dkorpel dkorpel deleted the backend-void-init branch March 29, 2025 10:48
shivangshukla7020 pushed a commit to shivangshukla7020/dmd that referenced this pull request Mar 30, 2025
* backend: Remove some void/unsafe initialization

* Remove isZeroInit checks since bootstrap compiler lacks that trait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Compiler:Backend glue code, optimizer, code generation Severity:Refactoring No semantic changes to code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants