about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@fb.com>2022-06-07 13:38:35 -0700
committerPatrick Walton <pcwalton@fb.com>2022-06-07 13:38:35 -0700
commitfe533e862cd2d2d65e14970d327365dfe593aa27 (patch)
tree40e05dce398f01f339ea8445ae94a53d52d24286 /src/test/codegen
parent357bc27904d4a99c83d4b01272c34e0e54934fa5 (diff)
downloadrust-fe533e862cd2d2d65e14970d327365dfe593aa27.tar.gz
rust-fe533e862cd2d2d65e14970d327365dfe593aa27.zip
Specify DWARF alignment in bits, not bytes.
In DWARF, alignment of types is specified in bits, as is made clear by the
parameter name `AlignInBits`. However, `rustc` was incorrectly passing a byte
alignment. This commit fixes that.

This was noticed in upstream LLVM when I tried to check in a test consisting of
LLVM IR generated from `rustc` and it triggered assertions [1].

[1]: https://reviews.llvm.org/D126835
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/debug-alignment.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/codegen/debug-alignment.rs b/src/test/codegen/debug-alignment.rs
new file mode 100644
index 00000000000..f6c1062e0fc
--- /dev/null
+++ b/src/test/codegen/debug-alignment.rs
@@ -0,0 +1,8 @@
+// Verifies that DWARF alignment is specified properly.
+//
+// compile-flags: -C debuginfo=2
+#![crate_type = "lib"]
+
+// CHECK: !DIGlobalVariable
+// CHECK: align: 32
+pub static A: u32 = 1;