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

[stable] Fix Bugzilla 24599 - Wrongly elided TypeInfo emission #15868

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

kinke
Copy link
Contributor

@kinke kinke commented Nov 27, 2023

Reverting #14844, which caused such missing TypeInfos, and making sure the special TypeInfo members are fully analyzed and ready for codegen (otherwise hitting an assertion).


Currently just checking if it breaks CI somewhere.

@dlang-bot
Copy link
Contributor

dlang-bot commented Nov 27, 2023

Thanks for your pull request and interest in making D better, @kinke! 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
24599 regression [REG2.103] Wrongly elided TypeInfo emission leading to undefined symbols at link-time

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#15868"

if (sd.semanticRun < PASS.semantic3done)
{
import dmd.semantic3 : semanticTypeInfoMembers;
semanticTypeInfoMembers(sd);
Copy link
Member

Choose a reason for hiding this comment

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

Is this a sensible place to run sema

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are about to emit the functions here, so we need sema3.

@RazvanN7
Copy link
Contributor

@kinke is there a bugzilla issue for this? Or do you have a test that I can reproduce? I'm kind of surprised that this doesn't break any code at there, since IIRC this was needed to advance work on templating the druntime hooks.

@kinke
Copy link
Contributor Author

kinke commented Jan 10, 2024

@RazvanN7: Nope sorry, no issue yet; the problem occurs in a private codebase, and unfortunately one of the largest/most complicated ones at Symmetry, so I'm not exactly looking forward to setting up an involved dustmite session. ;)

@RazvanN7
Copy link
Contributor

I see. I'm just wondering what's the best way to proceed here. If I merge the revert, I'm gonna have to find a different fix for Issue 23650, but without a test case I risk on breaking your code again. If I don't merge it, your code stays broken.

@kinke
Copy link
Contributor Author

kinke commented Jan 11, 2024

I'm gonna have to find a different fix for Issue 2365

I think this can only be properly fixed by re-designing the way struct TypeInfos (and the special TypeInfo member functions) are emitted in DMD, adopting the LDC way (I've changed this some years ago, no more TypeInfo issues since then AFAICT: ldc-developers/ldc#3491). The main change there is that the struct TypeInfo emission has been moved to the codegen/glue layer - whenever the symbol is needed during codegen (so no CTFE usages, or usages in purely speculative contexts), it is emitted into the referencing object file (as a COMDAT, so that the linker folds duplicates across object files), instead of trying to decide whether to add a TypeInfoDeclaration to module members in the frontend, with brittle isSpeculativeType() (unused by LDC) logic etc.

LDC emits the special TypeInfo member functions (xopEquals, xopCmp, xtoHash) into the object file containing the struct declaration, so that those are guaranteed to be available. Only the TypeInfo_Struct symbol is lazily emitted into every referencing object file.

@kinke kinke changed the title Draft: Tentative fix for missing struct TypeInfo symbols Fix Bugzilla 24599 - Wrongly elided TypeInfo emission Jun 11, 2024
@kinke
Copy link
Contributor Author

kinke commented Jun 11, 2024

@RazvanN7: Okay, I finally found some time and motivation to dustmite our problem, filing an issue and updating this PR accordingly.

@kinke kinke marked this pull request as ready for review June 11, 2024 10:33
@kinke kinke requested a review from ibuclaw as a code owner June 11, 2024 10:33
@kinke kinke added the 72h no objection -> merge The PR will be merged if there are no objections raised. label Jun 15, 2024
@kinke kinke changed the base branch from master to stable July 2, 2024 14:30
@kinke kinke changed the title Fix Bugzilla 24599 - Wrongly elided TypeInfo emission [stable] Fix Bugzilla 24599 - Wrongly elided TypeInfo emission Jul 2, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
@kinke
Copy link
Contributor Author

kinke commented Jul 2, 2024

[just rebased onto stable to make this part of D v2.110; I was on vacation and missed the merge window]

@kinke kinke merged commit 7ab98b9 into dlang:stable Jul 2, 2024
73 checks passed
thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
thewilsonator pushed a commit to thewilsonator/dmd that referenced this pull request Oct 7, 2024
Reverting dlang#14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).
RazvanN7 added a commit that referenced this pull request Oct 7, 2024
* Document template instance duplication status as part of its field documentation. (#16643)

* Fix Bugzilla 24599 - Wrongly elided TypeInfo emission (#15868)

Reverting #14844, which caused such missing TypeInfos, *and* making
sure the special TypeInfo members are fully analyzed and ready for
codegen (otherwise hitting an assertion for the real-world project).

* Reorganize backend build files to match target and make more similar per line (#16672)

* Remove redundant suggestions on linker errors (#16711)

* Fix bugzilla 24337 - Segfault when printing an int[] cast from a string (#16729)

* Add BitFieldStyle.Gcc_Clang_ARM

Required for 32-bit ARM, and non-Apple 64-bit ARM targets.

The only difference to `Gcc_Clang` is that anonymous and 0-length
bit-fields do contribute to the aggregate alignment.

Caught by existing proper C interop tests in
runnable_cxx/testbitfields.d on such targets. The hardcoded bad tests
in runnable/{bitfieldsposix64.c,dbitfieldsposix64.d} however now fail
after the fix, on such targets again.

* [refactor to `TargetC.contributesToAggregateAlignment(BitFieldDeclaration)` hook]

* Fix Bugzilla Issue 24687 - [REG2.110] Cannot cast string-imports to select overload anymore

* Also make deprecationSupplemental adhere to error limit (#16779)

Co-authored-by: Dennis Korpel <[email protected]>

* Fix bugzilla 24699 - [REG2.108] No short-circuit evaluation of mixing template bool argument

* Fix bugzilla 24731 - IFTI cannot handle integer expressions (#16822)

* Fix Bugzilla Issue 24760 - ICE on variadic after default argument

* Fix bugzilla 24790 - -vcg-ast ICE on lowered assign exp (#16914)

Co-authored-by: Dennis Korpel <[email protected]>

* Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917)

Co-authored-by: Dennis Korpel <[email protected]>

* Fix bugzilla 24431 - dmd -vcg-ast crashes printing failed template in… (#16916)

---------

Co-authored-by: Richard (Rikki) Andrew Cattermole <[email protected]>
Co-authored-by: Martin Kinkelin <[email protected]>
Co-authored-by: Dennis <[email protected]>
Co-authored-by: Martin Kinkelin <[email protected]>
Co-authored-by: Martin Kinkelin <[email protected]>
Co-authored-by: RazvanN7 <[email protected]>
Co-authored-by: Dennis Korpel <[email protected]>
Co-authored-by: Dennis Korpel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
72h no objection -> merge The PR will be merged if there are no objections raised. auto-merge Bug Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants