Skip to content

println! segfaults with nightly-2018-06-24 on macOS 10.10 #51758

Closed
@SimonSapin

Description

@SimonSapin

Update: this is due to LLVM assuming 16-byte alignment for a #[thread_local] static that is in fact 8-bytes aligned. Bisected PR might not be directly related, and might only have moved the static from a location that happened to be 16-bytes aligned by chance?


$ echo 'fn main() { println!("") }' > a.rs
$ rustup run --install nightly-2018-06-24 rustc a.rs
$ ./a
Segmentation fault: 11
$ lldb a
(lldb) target create "a"
Current executable set to 'a' (x86_64).
(lldb) run
Process 26778 launched: '/private/tmp/aa/a' (x86_64)
Process 26778 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
    frame #0: 0x000000010000a565 a`std::io::stdio::_print::h8f28cebade0a06e8 + 197
a`std::io::stdio::_print::h8f28cebade0a06e8:
->  0x10000a565 <+197>: movdqa 0x10(%rax), %xmm0
    0x10000a56a <+202>: xorps  %xmm1, %xmm1
    0x10000a56d <+205>: movaps %xmm1, 0x10(%rax)
    0x10000a571 <+209>: movl   $0x1, %ecx
Target 0: (a) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
  * frame #0: 0x000000010000a565 a`std::io::stdio::_print::h8f28cebade0a06e8 + 197
    frame #1: 0x0000000100000b2f a`a::main::h1162ee7c6f50d0b5 + 63
    frame #2: 0x0000000100000ada a`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hdecedfffbbfc4ed3 + 10
    frame #3: 0x000000010000e8c8 a`std::panicking::try::do_call::h586091eb2188e424 (.llvm.4887162513922290480) + 24
    frame #4: 0x000000010001af0f a`__rust_maybe_catch_panic + 31
    frame #5: 0x0000000100007712 a`std::rt::lang_start_internal::h5f9decd422205a6f + 242
    frame #6: 0x0000000100000ab5 a`std::rt::lang_start::ha7a5b042430cd1ae + 53
    frame #7: 0x0000000100000b65 a`main + 37
    frame #8: 0x00007fffcd189235 libdyld.dylib`start + 1

Reproduced on three CI builders with macOS 10.10.5, but not on two with 10.11.6.

Not reproduced with the previous Nightly, nightly-2018-06-23. Commit range: cbc4c83...60efbde. Of the PRs merged in this range, eliminating those I’m fairly certain are unrelated leaves #51696 and #51723 which I think are unrelated but am less confident about, and #51580 which touched 69 files in 19 commits.

(Found while upgrading Servo to today’s Nightly: servo/servo#21089 (comment).)

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.O-macosOperating system: macOSP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions