Closed
Description
During a rust build on sparc64, the following crash is observed:
shell$ /usr/local/bin/rustc --crate-name libc src/vendor/libc/src/lib.rs --crate-type lib --emit=dep-info,link -C debug-assertions=off -C overflow-checks=on --cfg feature=\"default\" --cfg feature=\"use_std\" -C metadata=aa5c1e1a6631cab2 -C extra-filename=-aa5c1e1a6631cab2 --out-dir /root/rustc-1.21.0+dfsg1/build/bootstrap/debug/deps -L dependency=/root/rustc-1.21.0+dfsg1 /build/bootstrap/debug/deps --cap-lints allow -C link-args=-Wl,-z,relro -Zremap-path-prefix-from=/root/rustc-1.21.0+dfsg1 -Zremap-path-prefix-to=/usr/src/rustc-1.21.0
Bus error
This is a side effect of #44646 which runs into #39696. Many (if not all) constructors of syntax::ext::tt::quoted::TokenTree
create a Span
member (which is now repr(packed)
) inside the discriminated union. The discriminator is a single byte, so the Span member is laid out at offset 1 (and followed by 3 padding bytes, so packing didn't gain us anything). The automatically derived PartialEq
instance for TokenTree
crashes when comparing e.g. two Token
objects, because after the tag comparison (0 in both cases), it performs unaligned loads on the Span values resulting in a bus error.