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

debug_assert a few more raw pointer methods #69208

Merged
merged 3 commits into from
Feb 29, 2020

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Feb 16, 2020

Makes progress for #53871

@rust-highfive
Copy link
Collaborator

r? @cramertj

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 16, 2020
@Mark-Simulacrum
Copy link
Member

I believe we're already doing this elsewhere and these are consistent with that, so @bors r+ rollup
(probably in practice this is unlikely to cause breakage).

@bors
Copy link
Contributor

bors commented Feb 16, 2020

📌 Commit bec5d37 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 16, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 16, 2020
…acrum

debug_assert a few more raw pointer methods

Fixes rust-lang#53871
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Feb 16, 2020
…acrum

debug_assert a few more raw pointer methods

Fixes rust-lang#53871
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Feb 16, 2020
…acrum

debug_assert a few more raw pointer methods

Fixes rust-lang#53871
@JohnTitor
Copy link
Member

This likely caused the failure: #69219 (comment)
Could you confirm?

@RalfJung
Copy link
Member Author

Hm, PR CI passed and I don't see what the error message would have to do with this PR. So, doesn't seem likely to me... but I have seen stranger things. Why do you think it was this one?

@JohnTitor
Copy link
Member

I suspect this and #68767, but it's a tweak for macOS so I've commented here. Hm so likely later one caused the failure (i.e. this PR is unrelated)?

Centril added a commit to Centril/rust that referenced this pull request Feb 17, 2020
…acrum

debug_assert a few more raw pointer methods

Fixes rust-lang#53871
@JohnTitor
Copy link
Member

Okay, next rollup contains this, if the failure isn't shown, I'll visit later one (sorry for the noise!).

@RalfJung
Copy link
Member Author

No you were right, I can reproduce the failure locally.

@bors r-

I am at a loss though about what could be causing this...
Cc @arielb1 @michaelwoerister from #40883 and Cc @hanna-kruppe
Does anyone know how this PR could make this test fail?

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 17, 2020
@Mark-Simulacrum
Copy link
Member

Perhaps some function isn't getting inlined as much and we're spilling more to the stack? It would be helpful to get llvm ir before/after this PR, I think. @bors try so we'll have public artifacts

@bors
Copy link
Contributor

bors commented Feb 17, 2020

⌛ Trying commit bec5d37 with merge 87552e5967d74a9c38c6b3261a821204d68e6761...

@bors
Copy link
Contributor

bors commented Feb 26, 2020

💔 Test failed - checks-azure

@rust-highfive
Copy link
Collaborator

The job wasm32 of your PR failed (pretty log, 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.
2020-02-26T09:24:51.0663124Z failures:
2020-02-26T09:24:51.0663383Z 
2020-02-26T09:24:51.0664110Z ---- [codegen] codegen/repeat-trusted-len.rs stdout ----
2020-02-26T09:24:51.0664346Z 
2020-02-26T09:24:51.0664871Z error: verification with 'FileCheck' failed
2020-02-26T09:24:51.0665148Z status: exit code: 1
2020-02-26T09:24:51.0666177Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/repeat-trusted-len/repeat-trusted-len.ll" "/checkout/src/test/codegen/repeat-trusted-len.rs"
2020-02-26T09:24:51.0667336Z ------------------------------------------
2020-02-26T09:24:51.0667630Z 
2020-02-26T09:24:51.0667968Z ------------------------------------------
2020-02-26T09:24:51.0668309Z stderr:
2020-02-26T09:24:51.0668309Z stderr:
2020-02-26T09:24:51.0668680Z ------------------------------------------
2020-02-26T09:24:51.0669323Z /checkout/src/test/codegen/repeat-trusted-len.rs:16:11: error: CHECK: expected string not found in input
2020-02-26T09:24:51.0670276Z // CHECK:***@llvm.memset.p0i8.[[USIZE]](i8* {{(nonnull )?}}align 1{{.*}} %{{[0-9]+}}, i8 42, [[USIZE]] 100000, i1 false)
2020-02-26T09:24:51.0670673Z           ^
2020-02-26T09:24:51.0671322Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/repeat-trusted-len/repeat-trusted-len.ll:15:33: note: scanning from here
2020-02-26T09:24:51.0672135Z define void @repeat_take_collect(%"alloc::vec::Vec<u8>"* noalias nocapture sret dereferenceable(12)) unnamed_addr #1 personality i32 (...)* @rust_eh_personality {
2020-02-26T09:24:51.0672780Z                                 ^
2020-02-26T09:24:51.0673554Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/repeat-trusted-len/repeat-trusted-len.ll:15:33: note: with "USIZE" equal to "i32"
2020-02-26T09:24:51.0674399Z define void @repeat_take_collect(%"alloc::vec::Vec<u8>"* noalias nocapture sret dereferenceable(12)) unnamed_addr #1 personality i32 (...)* @rust_eh_personality {
2020-02-26T09:24:51.0674893Z                                 ^
2020-02-26T09:24:51.0675813Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/repeat-trusted-len/repeat-trusted-len.ll:15:33: note: with "USIZE" equal to "i32"
2020-02-26T09:24:51.0676449Z define void @repeat_take_collect(%"alloc::vec::Vec<u8>"* noalias nocapture sret dereferenceable(12)) unnamed_addr #1 personality i32 (...)* @rust_eh_personality {
2020-02-26T09:24:51.0676910Z                                 ^
2020-02-26T09:24:51.0677584Z /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/repeat-trusted-len/repeat-trusted-len.ll:28:2: note: possible intended match here
2020-02-26T09:24:51.0678120Z  tail call void @llvm.memset.p0i8.i64(i8* nonnull align 1 %1, i8 42, i64 100000, i1 false) #5, !noalias !9
2020-02-26T09:24:51.0678532Z 
2020-02-26T09:24:51.0678887Z ------------------------------------------
2020-02-26T09:24:51.0679052Z 
2020-02-26T09:24:51.0679265Z 
---
2020-02-26T09:24:51.0681637Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:348:22
2020-02-26T09:24:51.0682081Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
2020-02-26T09:24:51.0689852Z 
2020-02-26T09:24:51.0690307Z 
2020-02-26T09:24:51.0698420Z 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/wasm32-unknown-emscripten/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-wasm32-unknown-emscripten" "--mode" "codegen" "--target" "wasm32-unknown-emscripten" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--nodejs" "/emsdk-portable/node/12.9.1_64bit/bin/node" "--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/wasm32-unknown-emscripten/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "9.0.1-rust-1.43.0-nightly\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2020-02-26T09:24:51.0701295Z 
2020-02-26T09:24:51.0701400Z 
2020-02-26T09:24:51.0707719Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target wasm32-unknown-emscripten --exclude src/libcore --exclude src/liballoc --exclude src/libproc_macro --exclude src/libstd --exclude src/libterm --exclude src/libtest
2020-02-26T09:24:51.0708507Z Build completed unsuccessfully in 2:38:03
2020-02-26T09:24:51.0708507Z Build completed unsuccessfully in 2:38:03
2020-02-26T09:24:51.0785243Z == clock drift check ==
2020-02-26T09:24:51.0800262Z   local time: Wed Feb 26 09:24:51 UTC 2020
2020-02-26T09:24:51.3642136Z   network time: Wed, 26 Feb 2020 09:24:51 GMT
2020-02-26T09:24:51.3644383Z == end clock drift check ==
2020-02-26T09:24:52.5900387Z 
2020-02-26T09:24:52.5994904Z ##[error]Bash exited with code '1'.
2020-02-26T09:24:52.6081215Z ##[section]Starting: Checkout rust-lang/rust@auto to s
2020-02-26T09:24:52.6086571Z ==============================================================================
2020-02-26T09:24:52.6087008Z Task         : Get sources
2020-02-26T09:24:52.6087452Z 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)

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 26, 2020
@RalfJung
Copy link
Member Author

@eddyb I have enabled debug assertions locally. That was my first suspicion, but that's not it -- or at least, it is not alone sufficient. Maybe "debug assertions + 32bit", or so.

Now it happened on wasm32, it seams? I am somewhat out of my depth to debug this, I am afraid. We could just add ignore-debug like we did for some other tests, but that doesn't really explain what is happening.

// give space for 2 copies of `Big` + 128 "misc" bytes.
if stack_usage > mem::size_of::<Big>() * 2 + 128 {
// give space for 2 copies of `Big` + 256 "misc" bytes.
if stack_usage > mem::size_of::<Big>() * 2 + 256 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm why would this change? I would hope your additions don't actually need format_args! but it's possible debug_assert! is inefficient?

@@ -795,6 +801,7 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T {
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn write<T>(dst: *mut T, src: T) {
debug_assert!(is_aligned_and_not_null(dst), "attempt to write to unaligned or null pointer");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this is the problem, maybe try landing swap_nonoverlapping and this separately.

Maybe some uses of ptr::write want to use intrinsics::move_val_init directly without creating a raw pointer? This is so important, IIRC we lower intrinsics::move_val_init in MIR building directly.

@RalfJung
Copy link
Member Author

All right, I removed the assertion from ptr::write. That should fix the test failure.

Since this is a subset of the previous changes: @bors r=Mark-Simulacrum rollup-

@bors
Copy link
Contributor

bors commented Feb 27, 2020

📌 Commit 8d3b306 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 27, 2020
@RalfJung
Copy link
Member Author

@bors p=0

@bors
Copy link
Contributor

bors commented Feb 29, 2020

⌛ Testing commit 8d3b306 with merge 5703b7a...

@bors
Copy link
Contributor

bors commented Feb 29, 2020

☀️ Test successful - checks-azure
Approved by: Mark-Simulacrum
Pushing 5703b7a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 29, 2020
@bors bors merged commit 5703b7a into rust-lang:master Feb 29, 2020
@RalfJung RalfJung deleted the debug-assert branch February 29, 2020 08:26
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 20, 2020
debug-assert ptr sanity in ptr::write

This is a re-submission of the parts that we removed from rust-lang#69208 due to ["interesting" test failures](rust-lang#69208 (comment)).

Fixes rust-lang#53871
r? @Mark-Simulacrum @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants