about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-01-03 04:54:03 +0000
committerbors <bors@rust-lang.org>2023-01-03 04:54:03 +0000
commit442f997f98ac9f16f60ba3a7109f884dbf8d370c (patch)
tree644e0d2b3c45e2e04c5071831e540038bc11e443 /src/test/codegen
parent481c9bad80754670197cf28d8c6d43825d4404f0 (diff)
parente7cad62257e5b0d59ca18515a522e90924177330 (diff)
downloadrust-442f997f98ac9f16f60ba3a7109f884dbf8d370c.tar.gz
rust-442f997f98ac9f16f60ba3a7109f884dbf8d370c.zip
Auto merge of #106371 - RalfJung:no-ret-position-noalias, r=nikic
do not add noalias in return position

`noalias` as a return attribute in LLVM indicates that the returned pointer does not alias anything else that is reachable from the caller, *including things reachable before this function call*. This is clearly not the case with a function like `fn id(Box<T>) -> Box<T>`, so we cannot use this attribute.

Fixes https://github.com/rust-lang/unsafe-code-guidelines/issues/385 (including an actual miscompilation that `@comex` managed to produce).
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/function-arguments.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/codegen/function-arguments.rs b/src/test/codegen/function-arguments.rs
index 44fee952307..0f9e90f6ba7 100644
--- a/src/test/codegen/function-arguments.rs
+++ b/src/test/codegen/function-arguments.rs
@@ -145,7 +145,7 @@ pub fn raw_struct(_: *const S) {
 
 // `Box` can get deallocated during execution of the function, so it should
 // not get `dereferenceable`.
-// CHECK: noalias noundef nonnull align 4 {{i32\*|ptr}} @_box({{i32\*|ptr}} noalias noundef nonnull align 4 %x)
+// CHECK: noundef nonnull align 4 {{i32\*|ptr}} @_box({{i32\*|ptr}} noalias noundef nonnull align 4 %x)
 #[no_mangle]
 pub fn _box(x: Box<i32>) -> Box<i32> {
   x