diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2024-06-26 13:27:50 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2024-07-31 00:59:13 +0000 |
| commit | 4067795d8c88fd38f3295fc4f9fc2658ea4d9ff7 (patch) | |
| tree | e3ba108f0faadec92bb39fe1685f9c34c6755670 | |
| parent | 98c1ea8e82e276a42159c5ff75d3581ed33e7bec (diff) | |
| download | rust-4067795d8c88fd38f3295fc4f9fc2658ea4d9ff7.tar.gz rust-4067795d8c88fd38f3295fc4f9fc2658ea4d9ff7.zip | |
Do not intern if we have provenance.
| -rw-r--r-- | compiler/rustc_mir_transform/src/gvn.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/gvn.rs b/compiler/rustc_mir_transform/src/gvn.rs index 7845fc6e4f6..e16911d79c3 100644 --- a/compiler/rustc_mir_transform/src/gvn.rs +++ b/compiler/rustc_mir_transform/src/gvn.rs @@ -1389,8 +1389,13 @@ fn op_to_prop_const<'tcx>( // If this constant has scalar ABI, return it as a `ConstValue::Scalar`. if let Abi::Scalar(abi::Scalar::Initialized { .. }) = op.layout.abi && let Ok(scalar) = ecx.read_scalar(op) - && scalar.try_to_scalar_int().is_ok() { + if !scalar.try_to_scalar_int().is_ok() { + // Check that we do not leak a pointer. + // Those pointers may lose part of their identity in codegen. + // FIXME: remove this hack once https://github.com/rust-lang/rust/issues/79738 is fixed. + return None; + } return Some(ConstValue::Scalar(scalar)); } |
