about summary refs log tree commit diff
path: root/compiler/rustc_codegen_gcc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-11-09 10:52:03 +0100
committerGitHub <noreply@github.com>2024-11-09 10:52:03 +0100
commit6e05afd744ab339fd1fa09e7206bb908242c5cff (patch)
tree7281dd3daa4dad0ba540d6bc8bb6193a9368702f /compiler/rustc_codegen_gcc
parentb9d4ef16c9845306f14c327c1cf86049e9f58dc3 (diff)
parent35a913b968eb9ad3a271f72fcc1bcd168bb572a4 (diff)
downloadrust-6e05afd744ab339fd1fa09e7206bb908242c5cff.tar.gz
rust-6e05afd744ab339fd1fa09e7206bb908242c5cff.zip
Rollup merge of #132745 - RalfJung:pointee-info-inside-enum, r=DianQK
pointee_info_at: fix logic for recursing into enums

Fixes https://github.com/rust-lang/rust/issues/131834

The logic in `pointee_info_at` was likely written at a time when the null pointer optimization was the *only* enum layout optimization -- and as `Variant::Multiple` kept getting expanded, nobody noticed that the logic is now unsound.

The job of this function is to figure out whether there is a dereferenceable-or-null and aligned pointer at a given offset inside a type. So when we recurse into a multi-variant enum, we better make sure that all the other enum variants must be null! This is the part that was forgotten, and this PR adds it.

The reason this didn't explode in many ways so far is that our references only have 1 niche value (null), so it's not possible on stable to have a multi-variant enum with a dereferenceable pointer and other enum variants that are not null. But with `rustc_layout_scalar_valid_range` attributes one can force such a layout, and if `@the8472's` work on alignment niches ever lands, that will make this possible on stable.
Diffstat (limited to 'compiler/rustc_codegen_gcc')
0 files changed, 0 insertions, 0 deletions