Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync adding nounwind attribute with generating abort-on-panic shim #63884

Open
wants to merge 4 commits into
base: master
from

Conversation

@RalfJung
Copy link
Member

commented Aug 25, 2019

Currently, the code paths for deciding whether to add an abort-on-panic shim, and whether to add the nounwind attribute, are separate. This unifies them. As a consequence, we now add a nounwind attribute to #[unwind(aborts)] functions.

The logic is also changed slightly to not take the call ABI into account any more. Fixes #63883.

Based on #63909, relative diff.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 25, 2019

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

src/librustc/ty/context.rs Outdated Show resolved Hide resolved
// Foreign items like `extern "C" { fn foo(); }` are assumed not to
// unwind
// Foreign items like `extern "C" { fn foo(); }` and `extern "Rust" { fn bar(); }`
// are assumed not to unwind.

This comment has been minimized.

Copy link
@RalfJung

RalfJung Aug 25, 2019

Author Member

Do we really want to assume that an imported extern "Rust" { fn bar(); } does not unwind? I just expanded the comment here to describe already existing behavior.

Cc @gnzlbg

This comment has been minimized.

Copy link
@gnzlbg

gnzlbg Aug 25, 2019

Contributor

Do we really want to assume that an imported extern "Rust" { fn bar(); } does not unwind?

IIRC, "Rust", "platform-intrinsic", "rust-intrinsic", and "rustcall" are actually the same ABI, and it is ok for extern declarations of those to actually unwind. One such a declaration would be the integer add intrinsic that panics on integer overflow. We also sometimes import llvm intrinsics (via #[feature(link_llvm_intrinsics(]) using the "unadjusted" ABI. I'm not sure if that one should be able to unwind as well.

This comment has been minimized.

Copy link
@RalfJung

RalfJung Aug 25, 2019

Author Member

My personal inclination is to just remove the foreign_item case here. But that decision should probably be made by someone who actually knows the surrounding code.

This comment has been minimized.

Copy link
@RalfJung

RalfJung Aug 25, 2019

Author Member

In fact I had to remove that branch to make the codegen tests work as expected. Whatever that means.

@@ -1581,6 +1581,32 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn has_strict_asm_symbol_naming(&self) -> bool {
self.gcx.sess.target.target.arch.contains("nvptx")
}

/// Determine if this function gets a shim to catch panics and abort.
pub fn abort_on_panic_shim(&self, fn_def_id: DefId, abi: abi::Abi) -> bool {

This comment has been minimized.

Copy link
@RalfJung

RalfJung Aug 25, 2019

Author Member

I had no idea what the right place would be for this method. Suggestions?

@RalfJung RalfJung force-pushed the RalfJung:abort-on-panic branch from 0cf0812 to 0f6bbcb Aug 25, 2019

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 25, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-08-25T16:07:04.5477751Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-25T16:07:04.5672573Z ##[command]git config gc.auto 0
2019-08-25T16:07:04.5748793Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-25T16:07:04.5797054Z ##[command]git config --get-all http.proxy
2019-08-25T16:07:04.5966090Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63884/merge:refs/remotes/pull/63884/merge
---
2019-08-25T16:07:37.5085623Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-25T16:07:37.5085870Z 
2019-08-25T16:07:37.5086312Z   git checkout -b <new-branch-name>
2019-08-25T16:07:37.5086704Z 
2019-08-25T16:07:37.5086912Z HEAD is now at 01a5c090e Merge 0f6bbcb8eae70e464bb9b4757e167f980be9e8a1 into d760df5aea483aae041c9a241e7acacf48f75035
2019-08-25T16:07:37.5245566Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-25T16:07:37.5248899Z ==============================================================================
2019-08-25T16:07:37.5248960Z Task         : Bash
2019-08-25T16:07:37.5249006Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-25T17:07:10.5382395Z .................................................................................................... 1500/8953
2019-08-25T17:07:15.7732736Z .................................................................................................... 1600/8953
2019-08-25T17:07:27.6530197Z .............................................i...............i...................................... 1700/8953
2019-08-25T17:07:35.2649996Z .................................................................................................... 1800/8953
2019-08-25T17:07:48.5621696Z .....................................iiiii.......................................................... 1900/8953
2019-08-25T17:07:58.4917936Z .................................................................................................... 2100/8953
2019-08-25T17:08:00.7896566Z .................................................................................................... 2200/8953
2019-08-25T17:08:04.7064388Z .................................................................................................... 2300/8953
2019-08-25T17:08:11.4868922Z .................................................................................................... 2400/8953
---
2019-08-25T17:10:59.5087551Z .........................i...............i.......................................................... 4700/8953
2019-08-25T17:11:10.4703389Z .................................................................................................... 4800/8953
2019-08-25T17:11:16.2515051Z .................................................................................................... 4900/8953
2019-08-25T17:11:26.3910023Z .................................................................................................... 5000/8953
2019-08-25T17:11:31.5185090Z ......ii.ii......................................................................................... 5100/8953
2019-08-25T17:11:44.8479432Z .................................................................................................... 5300/8953
2019-08-25T17:11:51.4822615Z ..............................................................i..................................... 5400/8953
2019-08-25T17:11:58.1989090Z .................................................................................................... 5500/8953
2019-08-25T17:12:05.4567298Z .................................................................................................... 5600/8953
2019-08-25T17:12:05.4567298Z .................................................................................................... 5600/8953
2019-08-25T17:12:15.5544005Z ........................................................ii...i..ii...........i...................... 5700/8953
2019-08-25T17:12:36.9750974Z .................................................................................................... 5900/8953
2019-08-25T17:12:41.6259293Z .................................................................................................... 6000/8953
2019-08-25T17:12:41.6259293Z .................................................................................................... 6000/8953
2019-08-25T17:12:48.3363977Z .........................................................i..ii...................................... 6100/8953
2019-08-25T17:13:14.4364429Z .................................................................................................... 6300/8953
2019-08-25T17:13:16.3822306Z ...i................................................................................................ 6400/8953
2019-08-25T17:13:18.3500966Z ...........................................................................i........................ 6500/8953
2019-08-25T17:13:20.8632097Z .................................................................................................... 6600/8953
---
2019-08-25T17:17:53.0136295Z  finished in 19.540
2019-08-25T17:17:53.0318479Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-25T17:17:53.2299344Z 
2019-08-25T17:17:53.2301157Z running 149 tests
2019-08-25T17:17:56.5018432Z i....iii......iii..iiii...Fi.............................i..i..................i....i.........ii.i.i 100/149
2019-08-25T17:17:58.5267932Z ..iiii..............i.........iii.i......ii......
2019-08-25T17:17:58.5268634Z 
2019-08-25T17:17:58.5269120Z ---- [codegen] codegen/extern-functions.rs stdout ----
2019-08-25T17:17:58.5269155Z 
2019-08-25T17:17:58.5269155Z 
2019-08-25T17:17:58.5269379Z error: verification with 'FileCheck' failed
2019-08-25T17:17:58.5269423Z status: exit code: 1
2019-08-25T17:17:58.5269964Z command: "/usr/lib/llvm-6.0/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/extern-functions/extern-functions.ll" "/checkout/src/test/codegen/extern-functions.rs"
2019-08-25T17:17:58.5270377Z ------------------------------------------
2019-08-25T17:17:58.5270436Z 
2019-08-25T17:17:58.5270633Z ------------------------------------------
2019-08-25T17:17:58.5270671Z stderr:
2019-08-25T17:17:58.5270671Z stderr:
2019-08-25T17:17:58.5270880Z ------------------------------------------
2019-08-25T17:17:58.5271158Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/extern-functions/extern-functions.ll:24:3: error: CHECK-NOT: string occurred!
2019-08-25T17:17:58.5271206Z ; Function Attrs: nounwind nonlazybind uwtable
2019-08-25T17:17:58.5271266Z   ^
2019-08-25T17:17:58.5271492Z /checkout/src/test/codegen/extern-functions.rs:10:15: note: CHECK-NOT: pattern specified here
2019-08-25T17:17:58.5271673Z // CHECK-NOT: Function Attrs: nounwind
2019-08-25T17:17:58.5271753Z 
2019-08-25T17:17:58.5271930Z ------------------------------------------
2019-08-25T17:17:58.5271956Z 
2019-08-25T17:17:58.5271977Z 
---
2019-08-25T17:17:58.5272742Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-08-25T17:17:58.5272790Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-08-25T17:17:58.5276756Z 
2019-08-25T17:17:58.5276991Z 
2019-08-25T17:17:58.5283464Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/codegen" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "codegen" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-08-25T17:17:58.5285043Z 
2019-08-25T17:17:58.5285196Z 
2019-08-25T17:17:58.5294803Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-08-25T17:17:58.5294909Z Build completed unsuccessfully in 1:03:49
2019-08-25T17:17:58.5294909Z Build completed unsuccessfully in 1:03:49
2019-08-25T17:17:58.5349311Z == clock drift check ==
2019-08-25T17:17:58.5364126Z   local time: Sun Aug 25 17:17:58 UTC 2019
2019-08-25T17:17:58.6854674Z   network time: Sun, 25 Aug 2019 17:17:58 GMT
2019-08-25T17:17:58.6855108Z == end clock drift check ==
2019-08-25T17:18:02.1795751Z ##[error]Bash exited with code '1'.
2019-08-25T17:18:02.1838413Z ##[section]Starting: Checkout
2019-08-25T17:18:02.1840095Z ==============================================================================
2019-08-25T17:18:02.1840145Z Task         : Get sources
2019-08-25T17:18:02.1840184Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2019

Beta-nominating with #62603; if only that one lands and not this one then panicking extern "C" fn() {} would still be UB due to the nounwind attribute. Nominated #63909 instead.

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2019

Adjusted and expanded the failing test.

I tried for a long time to also adjust and expand nounwind-extern.rs, but found no way to phrase what I want with this "CHECK" system. Is there documentation anywhere on how exactly checking works for that? There's no README in the codegen folder. My experience with it overall has been rather frustrating, rarely does it do what I think it does.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 25, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-08-25T19:28:06.1095832Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-25T19:28:06.1328617Z ##[command]git config gc.auto 0
2019-08-25T19:28:06.1418507Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-25T19:28:06.1479765Z ##[command]git config --get-all http.proxy
2019-08-25T19:28:06.1624685Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63884/merge:refs/remotes/pull/63884/merge
---
2019-08-25T19:28:40.6307866Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-25T19:28:40.6308115Z 
2019-08-25T19:28:40.6308509Z   git checkout -b <new-branch-name>
2019-08-25T19:28:40.6308716Z 
2019-08-25T19:28:40.6308909Z HEAD is now at 398ac402c Merge ea60cf75b7b72cf6ab994b9800d2da802d14c80e into b1522e6023d80faf8ea334ef50ef05528ed806bc
2019-08-25T19:28:40.6449733Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-25T19:28:40.6452665Z ==============================================================================
2019-08-25T19:28:40.6452746Z Task         : Bash
2019-08-25T19:28:40.6452809Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-25T20:26:57.5857387Z .................................................................................................... 1500/8953
2019-08-25T20:27:03.0767221Z .................................................................................................... 1600/8953
2019-08-25T20:27:15.0708587Z .............................................i...............i...................................... 1700/8953
2019-08-25T20:27:22.6785157Z .................................................................................................... 1800/8953
2019-08-25T20:27:36.0352535Z .....................................iiiii.......................................................... 1900/8953
2019-08-25T20:27:46.5307171Z .................................................................................................... 2100/8953
2019-08-25T20:27:49.0689138Z .................................................................................................... 2200/8953
2019-08-25T20:27:53.1242938Z .................................................................................................... 2300/8953
2019-08-25T20:28:00.0909131Z .................................................................................................... 2400/8953
---
2019-08-25T20:30:49.2342751Z .........................i...............i.......................................................... 4700/8953
2019-08-25T20:31:00.1255998Z .................................................................................................... 4800/8953
2019-08-25T20:31:05.9561702Z .................................................................................................... 4900/8953
2019-08-25T20:31:16.2653333Z .................................................................................................... 5000/8953
2019-08-25T20:31:21.4394173Z ......ii.ii......................................................................................... 5100/8953
2019-08-25T20:31:34.9444442Z .................................................................................................... 5300/8953
2019-08-25T20:31:41.5224141Z ..............................................................i..................................... 5400/8953
2019-08-25T20:31:48.2686057Z .................................................................................................... 5500/8953
2019-08-25T20:31:55.5983980Z .................................................................................................... 5600/8953
2019-08-25T20:31:55.5983980Z .................................................................................................... 5600/8953
2019-08-25T20:32:05.8340327Z ........................................................ii...i..ii...........i...................... 5700/8953
2019-08-25T20:32:29.2413182Z .................................................................................................... 5900/8953
2019-08-25T20:32:34.0023008Z .................................................................................................... 6000/8953
2019-08-25T20:32:34.0023008Z .................................................................................................... 6000/8953
2019-08-25T20:32:40.7436542Z .........................................................i..ii...................................... 6100/8953
2019-08-25T20:33:06.3445242Z .................................................................................................... 6300/8953
2019-08-25T20:33:08.4923202Z ...i................................................................................................ 6400/8953
2019-08-25T20:33:10.6367642Z ...........................................................................i........................ 6500/8953
2019-08-25T20:33:13.3151324Z .................................................................................................... 6600/8953
---
2019-08-25T20:37:39.9829468Z  finished in 20.254
2019-08-25T20:37:40.0002094Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-25T20:37:40.1639423Z 
2019-08-25T20:37:40.1641223Z running 149 tests
2019-08-25T20:37:43.3026319Z i....iii......iii..iiii....i.............................i..i..................i....i........ii.i.i. 100/149
2019-08-25T20:37:45.1645681Z .iiii..............i.........iii.i.......ii......
2019-08-25T20:37:45.1646860Z 
2019-08-25T20:37:45.1649946Z  finished in 5.164
2019-08-25T20:37:45.1815852Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-25T20:37:45.9872376Z 
---
2019-08-25T20:37:47.2417152Z  finished in 2.059
2019-08-25T20:37:47.2597124Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-25T20:37:47.4038857Z 
2019-08-25T20:37:47.4039084Z running 9 tests
2019-08-25T20:37:47.4039811Z iiiiiiiii
2019-08-25T20:37:47.4040176Z 
2019-08-25T20:37:47.4040212Z  finished in 0.144
2019-08-25T20:37:47.4200215Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-25T20:37:48.4804760Z 
2019-08-25T20:37:48.4804760Z 
2019-08-25T20:37:48.4866925Z running 104 tests
2019-08-25T20:38:03.9848306Z ..................................................................................................F. 100/104
2019-08-25T20:38:04.5292051Z F...
2019-08-25T20:38:04.5292209Z failures:
2019-08-25T20:38:04.5297477Z 
2019-08-25T20:38:04.5298045Z ---- [incremental] incremental/thinlto/cgu_invalidated_via_import.rs stdout ----
2019-08-25T20:38:04.5298128Z 
2019-08-25T20:38:04.5298391Z error in revision `cfail2`: test compilation failed although it shouldn't!
2019-08-25T20:38:04.5298472Z status: exit code: 1
2019-08-25T20:38:04.5299364Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/thinlto/cgu_invalidated_via_import.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/cgu_invalidated_via_import.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/auxiliary"
2019-08-25T20:38:04.5301420Z ------------------------------------------
2019-08-25T20:38:04.5301479Z 
2019-08-25T20:38:04.5301810Z ------------------------------------------
2019-08-25T20:38:04.5301859Z stderr:
2019-08-25T20:38:04.5301859Z stderr:
2019-08-25T20:38:04.5302109Z ------------------------------------------
2019-08-25T20:38:04.5302365Z error: CGU-reuse for `cgu_invalidated_via_import-bar` is `No` but should be `PreLto`
2019-08-25T20:38:04.5302694Z    |
2019-08-25T20:38:04.5302694Z    |
2019-08-25T20:38:04.5302939Z LL | / #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
2019-08-25T20:38:04.5302993Z LL | |                             cfg="cfail2",
2019-08-25T20:38:04.5304666Z LL | |                             kind="pre-lto")]
2019-08-25T20:38:04.5304955Z 
2019-08-25T20:38:04.5305014Z error: aborting due to previous error
2019-08-25T20:38:04.5305039Z 
2019-08-25T20:38:04.5305072Z 
2019-08-25T20:38:04.5305072Z 
2019-08-25T20:38:04.5306118Z ------------------------------------------
2019-08-25T20:38:04.5306153Z 
2019-08-25T20:38:04.5306196Z 
2019-08-25T20:38:04.5306422Z ---- [incremental] incremental/thinlto/independent_cgus_dont_affect_each_other.rs stdout ----
2019-08-25T20:38:04.5306450Z 
2019-08-25T20:38:04.5306637Z error in revision `cfail2`: test compilation failed although it shouldn't!
2019-08-25T20:38:04.5307458Z status: exit code: 1
2019-08-25T20:38:04.5308549Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other/independent_cgus_dont_affect_each_other.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other/auxiliary"
2019-08-25T20:38:04.5308910Z ------------------------------------------
2019-08-25T20:38:04.5308956Z 
2019-08-25T20:38:04.5309122Z ------------------------------------------
2019-08-25T20:38:04.5309157Z stderr:
2019-08-25T20:38:04.5309157Z stderr:
2019-08-25T20:38:04.5309333Z ------------------------------------------
2019-08-25T20:38:04.5309540Z error: CGU-reuse for `independent_cgus_dont_affect_each_other-bar` is `No` but should be `PreLto`
2019-08-25T20:38:04.5309805Z    |
2019-08-25T20:38:04.5309805Z    |
2019-08-25T20:38:04.5310437Z LL | / #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
2019-08-25T20:38:04.5310511Z LL | |                             cfg="cfail2",
2019-08-25T20:38:04.5310759Z LL | |                             kind="pre-lto")]
2019-08-25T20:38:04.5310853Z 
2019-08-25T20:38:04.5310896Z error: aborting due to previous error
2019-08-25T20:38:04.5310944Z 
2019-08-25T20:38:04.5310969Z 
---
2019-08-25T20:38:04.5312207Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-08-25T20:38:04.5312265Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-08-25T20:38:04.5312352Z 
2019-08-25T20:38:04.5312380Z 
2019-08-25T20:38:04.5313989Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/incremental" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "incremental" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-08-25T20:38:04.5314186Z 
2019-08-25T20:38:04.5314226Z 
2019-08-25T20:38:04.5317700Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-08-25T20:38:04.5317758Z Build completed unsuccessfully in 1:02:56
2019-08-25T20:38:04.5317758Z Build completed unsuccessfully in 1:02:56
2019-08-25T20:38:04.5377676Z == clock drift check ==
2019-08-25T20:38:04.5396145Z   local time: Sun Aug 25 20:38:04 UTC 2019
2019-08-25T20:38:04.6815773Z   network time: Sun, 25 Aug 2019 20:38:04 GMT
2019-08-25T20:38:04.6818321Z == end clock drift check ==
2019-08-25T20:38:08.6935538Z ##[error]Bash exited with code '1'.
2019-08-25T20:38:08.6977744Z ##[section]Starting: Checkout
2019-08-25T20:38:08.6979698Z ==============================================================================
2019-08-25T20:38:08.6979756Z Task         : Get sources
2019-08-25T20:38:08.6979874Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 25, 2019

Hm, incremental thinlto tests are failing and I have no idea why,

error in revision `cfail2`: test compilation failed although it shouldn't!
status: exit code: 1
command: "/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" "/home/r/src/rust/rustc.3/src/test/incremental/thinlto/cgu_invalidated_via_import.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/cgu_invalidated_via_import.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-L" "/home/r/src/rust/rustc.3/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/auxiliary"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
error: CGU-reuse for `cgu_invalidated_via_import-bar` is `No` but should be `PreLto`
  --> /home/r/src/rust/rustc.3/src/test/incremental/thinlto/cgu_invalidated_via_import.rs:19:1
   |
LL | / #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
LL | |                             cfg="cfail2",
LL | |                             kind="pre-lto")]
   | |____________________________________________^

error: aborting due to previous error
@bors

This comment was marked as resolved.

Copy link
Contributor

commented Aug 26, 2019

☔️ The latest upstream changes (presumably #62603) made this pull request unmergeable. Please resolve the merge conflicts.

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2019

@Centril I am not entirely sure why you nominated this for T-lang? This is a bugfix, solving the problem that the comments in LLVM codegen are wrong (they say we add abort-on-panic shims but we don't).

#62603 seems like the more interesting one from a T-lang perspective, that one actually changed program behavior.

@RalfJung RalfJung force-pushed the RalfJung:abort-on-panic branch from ea60cf7 to cef82c3 Aug 26, 2019

@RalfJung RalfJung force-pushed the RalfJung:abort-on-panic branch from cef82c3 to 2214932 Aug 26, 2019

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2019

I felt like this PR did a bit too much for backporting, so I moved the soundness-fix part into a separate PR: #63909. This PR here is now based on that. Here's the relative diff.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

commented Aug 26, 2019

The job x86_64-gnu-llvm-6.0 of your PR failed (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-08-26T07:29:10.2929743Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-08-26T07:29:10.3125895Z ##[command]git config gc.auto 0
2019-08-26T07:29:10.3198704Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-08-26T07:29:10.3256449Z ##[command]git config --get-all http.proxy
2019-08-26T07:29:10.3398844Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/63884/merge:refs/remotes/pull/63884/merge
---
2019-08-26T07:29:45.8589517Z do so (now or later) by using -b with the checkout command again. Example:
2019-08-26T07:29:45.8589543Z 
2019-08-26T07:29:45.8589727Z   git checkout -b <new-branch-name>
2019-08-26T07:29:45.8589771Z 
2019-08-26T07:29:45.8589811Z HEAD is now at 6cd052735 Merge 2214932a30091c54654422edbd39489c102285f4 into 4c58535d09d1261d21569df0036b974811544256
2019-08-26T07:29:45.8760651Z ##[section]Starting: Collect CPU-usage statistics in the background
2019-08-26T07:29:45.8763789Z ==============================================================================
2019-08-26T07:29:45.8763867Z Task         : Bash
2019-08-26T07:29:45.8763912Z Description  : Run a Bash script on macOS, Linux, or Windows
---
2019-08-26T08:30:18.4440806Z .................................................................................................... 1500/8953
2019-08-26T08:30:23.9298771Z .................................................................................................... 1600/8953
2019-08-26T08:30:36.3860609Z .............................................i...............i...................................... 1700/8953
2019-08-26T08:30:44.4044764Z .................................................................................................... 1800/8953
2019-08-26T08:30:58.4270704Z .....................................iiiii.......................................................... 1900/8953
2019-08-26T08:31:08.4280835Z .................................................................................................... 2100/8953
2019-08-26T08:31:10.9825438Z .................................................................................................... 2200/8953
2019-08-26T08:31:15.1046373Z .................................................................................................... 2300/8953
2019-08-26T08:31:22.0470345Z .................................................................................................... 2400/8953
---
2019-08-26T08:34:10.5313142Z .........................i...............i.......................................................... 4700/8953
2019-08-26T08:34:21.6475030Z .................................................................................................... 4800/8953
2019-08-26T08:34:27.4781450Z .................................................................................................... 4900/8953
2019-08-26T08:34:37.6026927Z .................................................................................................... 5000/8953
2019-08-26T08:34:42.9131343Z ......ii.ii......................................................................................... 5100/8953
2019-08-26T08:34:56.8367734Z .................................................................................................... 5300/8953
2019-08-26T08:35:03.4965681Z ..............................................................i..................................... 5400/8953
2019-08-26T08:35:10.4428848Z .................................................................................................... 5500/8953
2019-08-26T08:35:17.8449953Z .................................................................................................... 5600/8953
2019-08-26T08:35:17.8449953Z .................................................................................................... 5600/8953
2019-08-26T08:35:28.3848747Z ........................................................ii...i..ii...........i...................... 5700/8953
2019-08-26T08:35:49.6383633Z .................................................................................................... 5900/8953
2019-08-26T08:35:54.4453310Z .................................................................................................... 6000/8953
2019-08-26T08:35:54.4453310Z .................................................................................................... 6000/8953
2019-08-26T08:36:01.5743607Z .........................................................i..ii...................................... 6100/8953
2019-08-26T08:36:29.3867501Z .................................................................................................... 6300/8953
2019-08-26T08:36:31.6105092Z ...i................................................................................................ 6400/8953
2019-08-26T08:36:33.9692993Z ...........................................................................i........................ 6500/8953
2019-08-26T08:36:36.8068867Z .................................................................................................... 6600/8953
---
2019-08-26T08:41:09.0833518Z  finished in 18.838
2019-08-26T08:41:09.1011315Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-26T08:41:09.2915534Z 
2019-08-26T08:41:09.2915810Z running 150 tests
2019-08-26T08:41:12.4416098Z i....iii.......iii.iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-08-26T08:41:14.4241468Z ..iiii..............i.........iii.i.......ii......
2019-08-26T08:41:14.4244562Z 
2019-08-26T08:41:14.4247465Z  finished in 5.323
2019-08-26T08:41:14.4423438Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-26T08:41:14.6065536Z 
---
2019-08-26T08:41:16.6257594Z  finished in 2.183
2019-08-26T08:41:16.6430365Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-26T08:41:16.8046219Z 
2019-08-26T08:41:16.8046423Z running 9 tests
2019-08-26T08:41:16.8048022Z iiiiiiiii
2019-08-26T08:41:16.8048401Z 
2019-08-26T08:41:16.8049165Z  finished in 0.161
2019-08-26T08:41:16.8227745Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-08-26T08:41:17.0032334Z 
2019-08-26T08:41:17.0032334Z 
2019-08-26T08:41:17.0032641Z running 104 tests
2019-08-26T08:41:34.0607232Z ..................................................................................................F. 100/104
2019-08-26T08:41:34.6628923Z F...
2019-08-26T08:41:35.1670249Z failures:
2019-08-26T08:41:35.1670314Z 
2019-08-26T08:41:35.1671088Z ---- [incremental] incremental/thinlto/cgu_invalidated_via_import.rs stdout ----
2019-08-26T08:41:35.1671132Z 
2019-08-26T08:41:35.1671439Z error in revision `cfail2`: test compilation failed although it shouldn't!
2019-08-26T08:41:35.1671511Z status: exit code: 1
2019-08-26T08:41:35.1672618Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/thinlto/cgu_invalidated_via_import.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/cgu_invalidated_via_import.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/cgu_invalidated_via_import/auxiliary"
2019-08-26T08:41:35.1673415Z ------------------------------------------
2019-08-26T08:41:35.1673471Z 
2019-08-26T08:41:35.1673729Z ------------------------------------------
2019-08-26T08:41:35.1673779Z stderr:
2019-08-26T08:41:35.1673779Z stderr:
2019-08-26T08:41:35.1674037Z ------------------------------------------
2019-08-26T08:41:35.1674347Z error: CGU-reuse for `cgu_invalidated_via_import-bar` is `No` but should be `PreLto`
2019-08-26T08:41:35.1674711Z    |
2019-08-26T08:41:35.1674711Z    |
2019-08-26T08:41:35.1675000Z LL | / #![rustc_expected_cgu_reuse(module="cgu_invalidated_via_import-bar",
2019-08-26T08:41:35.1675058Z LL | |                             cfg="cfail2",
2019-08-26T08:41:35.1675475Z LL | |                             kind="pre-lto")]
2019-08-26T08:41:35.1675571Z 
2019-08-26T08:41:35.1675609Z error: aborting due to previous error
2019-08-26T08:41:35.1675636Z 
2019-08-26T08:41:35.1675843Z 
2019-08-26T08:41:35.1675843Z 
2019-08-26T08:41:35.1676239Z ------------------------------------------
2019-08-26T08:41:35.1676264Z 
2019-08-26T08:41:35.1676285Z 
2019-08-26T08:41:35.1676520Z ---- [incremental] incremental/thinlto/independent_cgus_dont_affect_each_other.rs stdout ----
2019-08-26T08:41:35.1676557Z 
2019-08-26T08:41:35.1676763Z error in revision `cfail2`: test compilation failed although it shouldn't!
2019-08-26T08:41:35.1676804Z status: exit code: 1
2019-08-26T08:41:35.1678135Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/incremental/thinlto/independent_cgus_dont_affect_each_other.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--cfg" "cfail2" "-C" "incremental=/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other/independent_cgus_dont_affect_each_other.inc" "-Z" "incremental-verify-ich" "-Z" "incremental-queries" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-Z" "query-dep-graph" "-O" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental/thinlto/independent_cgus_dont_affect_each_other/auxiliary"
2019-08-26T08:41:35.1678482Z ------------------------------------------
2019-08-26T08:41:35.1678511Z 
2019-08-26T08:41:35.1678709Z ------------------------------------------
2019-08-26T08:41:35.1678753Z stderr:
2019-08-26T08:41:35.1678753Z stderr:
2019-08-26T08:41:35.1678932Z ------------------------------------------
2019-08-26T08:41:35.1679353Z error: CGU-reuse for `independent_cgus_dont_affect_each_other-bar` is `No` but should be `PreLto`
2019-08-26T08:41:35.1679633Z    |
2019-08-26T08:41:35.1679633Z    |
2019-08-26T08:41:35.1679869Z LL | / #![rustc_expected_cgu_reuse(module="independent_cgus_dont_affect_each_other-bar",
2019-08-26T08:41:35.1679915Z LL | |                             cfg="cfail2",
2019-08-26T08:41:35.1680107Z LL | |                             kind="pre-lto")]
2019-08-26T08:41:35.1680273Z 
2019-08-26T08:41:35.1680473Z error: aborting due to previous error
2019-08-26T08:41:35.1680497Z 
2019-08-26T08:41:35.1680533Z 
---
2019-08-26T08:41:35.1681657Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:536:22
2019-08-26T08:41:35.1681820Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-08-26T08:41:35.1681855Z 
2019-08-26T08:41:35.1682076Z 
2019-08-26T08:41:35.1683695Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/incremental" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/incremental" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "incremental" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-08-26T08:41:35.1683952Z 
2019-08-26T08:41:35.1683982Z 
2019-08-26T08:41:35.1684045Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-08-26T08:41:35.1684096Z Build completed unsuccessfully in 1:05:08
2019-08-26T08:41:35.1684096Z Build completed unsuccessfully in 1:05:08
2019-08-26T08:41:35.1684141Z == clock drift check ==
2019-08-26T08:41:35.1684205Z   local time: Mon Aug 26 08:41:34 UTC 2019
2019-08-26T08:41:35.1684251Z   network time: Mon, 26 Aug 2019 08:41:34 GMT
2019-08-26T08:41:35.1684297Z == end clock drift check ==
2019-08-26T08:41:38.0282780Z ##[error]Bash exited with code '1'.
2019-08-26T08:41:38.0325435Z ##[section]Starting: Checkout
2019-08-26T08:41:38.0327193Z ==============================================================================
2019-08-26T08:41:38.0327240Z Task         : Get sources
2019-08-26T08:41:38.0327281Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@gnzlbg

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Beta-nominating with #62603; if only that one lands and not this one then panicking extern "C" fn() {} would still be UB due to the nounwind attribute.

Why is this nominated for beta ? AFAICT this only fixes a bug in a unstable Rust feature right ?

@gnzlbg

This comment has been minimized.

Copy link
Contributor

commented Aug 26, 2019

Does it remove the nounwind attribute for extern "C" functions (and others) on beta and stable ? If so, I think the PR / commit message should reflect this, since this originally looked like a refactor / fix for a nightly-only bug. That fix is also probably release-note worthy, since it fixes a soundness bug on stable AFAICT: on stable, panicking from extern "C" functions is UB per the reference, but no abort shim is generated, and that causes a soundness issue because we used to mark those nounwind, and that leads to miscompilations, but since this PR removes nounwind, then there is no soundness bug anymore (UB is still UB, but at least now programs don't get miscompiled).

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2019

AFAICT this only fixes a bug in a unstable Rust feature right ?

No, it (or rather, #63909) removes the nounwind attribute from extern "C" definitions that don't carry an attribute. Given that we stopped catching panics there (and that that will be backported to beta most likely) because of existing code depending on forwading panics, we should also stop lying to LLVM.

This PR here is not nominated for backport any more.

Does it remove the nounwind attribute for extern "C" functions (and others) on beta and stable ?

#63909 does. This PR includes that one. That is already reflected in the PR message.

@RalfJung

This comment has been minimized.

Copy link
Member Author

commented Aug 27, 2019

Marking as blocked and removing nomination; that has been moved to #63909.

@bors

This comment has been minimized.

Copy link
Contributor

commented Sep 7, 2019

☔️ The latest upstream changes (presumably #64264) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.