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

Use read_unaligned instead of read in transmute_copy #55052

Merged
merged 1 commit into from
Nov 13, 2018

Conversation

newpavlov
Copy link
Contributor

@newpavlov newpavlov commented Oct 13, 2018

Closes: #55044

This change could result in performance regression on non-x86 platforms. (but it also can fix some of UB which lurks in existing programs) An alternative would be to update transmute_copy documentation with alignment requirements.

Closes: rust-lang#55044

This change could result in performance regression on non-x86 platforms. Alternative would be to update `transmute_copy` with alignment requirements.
@rust-highfive
Copy link
Collaborator

r? @withoutboats

(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 Oct 13, 2018
@nagisa
Copy link
Member

nagisa commented Oct 16, 2018

This seems like the right thing to do to me…

@newpavlov
Copy link
Contributor Author

@withoutboats
Any news on this?

@TimNN
Copy link
Contributor

TimNN commented Nov 6, 2018

Ping from triage @withoutboats / @rust-lang/libs: This PR requires your review.

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 6, 2018
@alexcrichton
Copy link
Member

@rfcbot fcp merge

I would personally agree that these semantics are correct for this function, not requiring the alignments match up. I'd like to make sure others agree, though

@rfcbot
Copy link

rfcbot commented Nov 6, 2018

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Nov 6, 2018
@sfackler
Copy link
Member

sfackler commented Nov 6, 2018

If we're worried about the performance we can always compare the source and target alignments and call read/read_unaligned as appropriate. It'll all get constant folded out.

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Nov 11, 2018
@rfcbot
Copy link

rfcbot commented Nov 11, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Nov 11, 2018
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Nov 12, 2018

📌 Commit 4210cca has been approved by alexcrichton

@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 Nov 12, 2018
@bors
Copy link
Contributor

bors commented Nov 12, 2018

⌛ Testing commit 4210cca with merge 90b4a012ad212427dd1c0e3ab72c2ea24bfd0013...

@bors
Copy link
Contributor

bors commented Nov 12, 2018

💔 Test failed - status-travis

@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 Nov 12, 2018
@rust-highfive
Copy link
Collaborator

The job arm-android of your PR failed on Travis (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.
[01:45:42] test string::test_str_truncate ... ok
[01:45:42] test string::test_str_truncate_invalid_len ... ok
[01:45:42] test string::test_str_truncate_split_codepoint ... ok
[01:45:42] test str::test_unsafe_slice ... ok
[01:45:42] died due to signal 11
[01:45:42] error: test failed, to rerun pass '--test collectionstests'
[01:45:42] 
[01:45:42] 
[01:45:42] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "arm-linux-androideabi" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--"
[01:45:42] 
[01:45:42] 
[01:45:42] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --target arm-linux-androideabi
[01:45:42] Build completed unsuccessfully in 1:31:43
---
travis_time:end:253cf131:start=1542048836960776801,finish=1542048836981431758,duration=20654957
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:012028e4
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:256ddeec
travis_time:start:256ddeec
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:153396cd
$ dmesg | grep -i kill

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)

@alexcrichton
Copy link
Member

@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 Nov 12, 2018
@bors
Copy link
Contributor

bors commented Nov 13, 2018

⌛ Testing commit 4210cca with merge c4371c8...

bors added a commit that referenced this pull request Nov 13, 2018
Use read_unaligned instead of read in transmute_copy

Closes: #55044

This change could result in performance regression on non-x86 platforms. (but it also can fix some of UB which lurks in existing programs) An alternative would be to update `transmute_copy` documentation with alignment requirements.
@bors
Copy link
Contributor

bors commented Nov 13, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing c4371c8 to master...

@bors bors merged commit 4210cca into rust-lang:master Nov 13, 2018
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #55052!

Tested on commit c4371c8.
Direct link to PR: #55052

💔 rls on linux: test-pass → test-fail (cc @nrc @Xanewok, @rust-lang/infra).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Nov 13, 2018
Tested on commit rust-lang/rust@c4371c8.
Direct link to PR: <rust-lang/rust#55052>

💔 rls on linux: test-pass → test-fail (cc @nrc @Xanewok, @rust-lang/infra).
@kennytm
Copy link
Member

kennytm commented Nov 13, 2018

The RLS test failure is:

[01:26:21] failures:
[01:26:21] 
[01:26:21] ---- cmd_changing_workspace_lib_retains_bin_diagnostics stdout ----
[01:26:21] thread 'cmd_changing_workspace_lib_retains_bin_diagnostics' panicked at 'assertion failed: `(left == right)`
[01:26:21]   left: `String("E0425")`,
[01:26:21]  right: `"unused_variables"`', tools/rls/tests/tests.rs:408:5
[01:26:21] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[01:26:21] ---rls-stdout---

@nrc
Copy link
Member

nrc commented Nov 13, 2018

💔 rls on linux: test-pass → test-fail (cc @nrc @Xanewok, @rust-lang/infra).

Well. That is surprising.

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Nov 21, 2018
@newpavlov newpavlov deleted the patch-2 branch March 15, 2019 16:50
@newpavlov newpavlov mentioned this pull request Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transforming &[u8; 16] to [u64; 2] using transmute_copy causes Bus errors on aarch64