Repository: rust
Issue: Presence of Homebrew GCC breaks `cargo test`
Labels: O-macos,I-ICE,T-compiler,C-bug

### Code

Standard library crate (`cargo init --lib`) with the following `lib.rs`:

```Rust
#[cfg(test)]
mod tests {
    #[test]
    fn it_dont_work() {
        assert!(false);
    }
}
```

### Meta

The problem occurs with either of the following two configurations (possibly others; have not tested):

```
rustc 1.51.0 (2fd73fabe 2021-03-23)
binary: rustc
commit-hash: 2fd73fabe469357a12c2c974c140f67e7cdd76d0
commit-date: 2021-03-23
host: x86_64-apple-darwin
release: 1.51.0
LLVM version: 11.0.1
```

```
rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-apple-darwin
release: 1.53.0-nightly
LLVM version: 12.0.0
```

### Error output

```
$ RUST_BACKTRACE=1 cargo test
    Finished test [unoptimized + debuginfo] target(s) in 0.06s
     Running target/debug/deps/spike-5de77501aaf7a6ed

running 1 test
fatal runtime error: failed to initiate panic, error 5
error: test failed, to rerun pass '--lib'

Caused by:
  process didn't exit successfully: `/Users/richbarn/Projects/libsrtp/spike/target/debug/deps/spike-5de77501aaf7a6ed` (signal: 6, SIGABRT: process abort signal)
```

lldb backtrace to user code (not including stack frames for standard cargo test functions):
```
(lldb) target create "target/debug/deps/spike-5de77501aaf7a6ed"
Current executable set to 'target/debug/deps/spike-5de77501aaf7a6ed' (x86_64).
(lldb) r
Process 24589 launched: '/Users/richbarn/Projects/libsrtp/spike/target/debug/deps/spike-5de77501aaf7a6ed' (x86_64)

running 1 test
fatal runtime error: failed to initiate panic, error 5
Process 24589 stopped
* thread #2, name = 'tests::it_dont_work', stop reason = signal SIGABRT
    frame #0: 0x00007fff751232c2 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff751232c2 <+10>: jae    0x7fff751232cc            ; <+20>
    0x7fff751232c4 <+12>: movq   %rax, %rdi
    0x7fff751232c7 <+15>: jmp    0x7fff7511d453            ; cerror_nocancel
    0x7fff751232cc <+20>: retq   
Target 0: (spike-5de77501aaf7a6ed) stopped.
(lldb) bt
error: need to add support for DW_TAG_base_type '()' encoded with DW_ATE = 0x7, bit_size = 0
* thread #2, name = 'tests::it_dont_work', stop reason = signal SIGABRT
  * frame #0: 0x00007fff751232c2 libsystem_kernel.dylib`__pthread_kill + 10
    frame #1: 0x00007fff751debf1 libsystem_pthread.dylib`pthread_kill + 284
    frame #2: 0x00007fff7508d6a6 libsystem_c.dylib`abort + 127
    frame #3: 0x000000010006deb9 spike-5de77501aaf7a6ed`std::sys::unix::abort_internal::h474f6875a409fb7e at mod.rs:237:14 [opt]
    frame #4: 0x0000000100066e50 spike-5de77501aaf7a6ed`std::sys_common::util::abort::hc95123744d370ee8 at util.rs:19:5 [opt]
    frame #5: 0x0000000100068053 spike-5de77501aaf7a6ed`rust_panic at panicking.rs:642:5 [opt]
    frame #6: 0x0000000100067fbf spike-5de77501aaf7a6ed`std::panicking::rust_panic_with_hook::hf87bfc4afef21ea6 at panicking.rs:610:5 [opt]
    frame #7: 0x0000000100067a69 spike-5de77501aaf7a6ed`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h19ac9cd24a19b238 at panicking.rs:495:13 [opt]
    frame #8: 0x0000000100065e68 spike-5de77501aaf7a6ed`std::sys_common::backtrace::__rust_end_short_backtrace::h5fc3f41df3517232 at backtrace.rs:141:18 [opt]
    frame #9: 0x00000001000679fa spike-5de77501aaf7a6ed`rust_begin_unwind at panicking.rs:493:5 [opt]
    frame #10: 0x0000000100089e8f spike-5de77501aaf7a6ed`core::panicking::panic_fmt::habd0855285375977 at panicking.rs:92:14 [opt]
    frame #11: 0x0000000100089de7 spike-5de77501aaf7a6ed`core::panicking::panic::hfa08580418a71d7f at panicking.rs:50:5 [opt]
    frame #12: 0x0000000100001d1c spike-5de77501aaf7a6ed`spike::tests::it_dont_work::h962cb450ad780f79 at lib.rs:5:9
    frame #13: 0x0000000100001aa1 spike-5de77501aaf7a6ed`spike::tests::it_dont_work::_$u7b$$u7b$closure$u7d$$u7d$::he85084a41ca471d9((null)=0x000070000f8c3750) at lib.rs:4:5
```

### Details

This is on a development MacBook running macOS 10.14.6 Mojave.  On a different MacBook (running Big Sur), `cargo test` produces correct output (showing a test failure), but the binary produced on the bad MacBook still aborts, showing the following error:

```
$ ./spike

running 1 test
fatal runtime error: failed to initiate panic, error 5
Abort trap: 6
```

This seems to indicate that the error is in the toolchain, not the runtime.  "error 5" is _URC_END_OF_STACK from libunwind.

Possibly related: #35599