forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normalize struct tail properly in disalignment check
- Loading branch information
1 parent
d9dd550
commit f81549c
Showing
4 changed files
with
172 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:32:13 | ||
| | ||
LL | &self.x; | ||
| ^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:44:24 | ||
| | ||
LL | println!("{:?}", &*foo.0); | ||
| ^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:46:24 | ||
| | ||
LL | println!("{:?}", &*foo.0); | ||
| ^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:51:24 | ||
| | ||
LL | println!("{:?}", &*foo.0); | ||
| ^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:81:17 | ||
| | ||
LL | let _ = &good.ptr; | ||
| ^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:82:17 | ||
| | ||
LL | let _ = &good.data; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:84:17 | ||
| | ||
LL | let _ = &good.data as *const _; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:85:27 | ||
| | ||
LL | let _: *const _ = &good.data; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:87:17 | ||
| | ||
LL | let _ = good.data.clone(); | ||
| ^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:89:17 | ||
| | ||
LL | let _ = &good.data2[0]; | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:98:17 | ||
| | ||
LL | let _ = &packed2.x; | ||
| ^^^^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:137:20 | ||
| | ||
LL | let _ref = &m1.1.a; | ||
| ^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error[E0793]: reference to packed field is unaligned | ||
--> $DIR/unaligned_references.rs:140:20 | ||
| | ||
LL | let _ref = &m2.1.a; | ||
| ^^^^^^^ | ||
| | ||
= note: packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses | ||
= note: creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) | ||
= help: copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) | ||
|
||
error: aborting due to 13 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0793`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters