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

Projects
None yet
@newpavlov
Contributor

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.

Use read_unaligned instead of read in transmute_copy
Closes: #55044

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

This comment has been minimized.

Collaborator

rust-highfive commented Oct 13, 2018

r? @withoutboats

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

@nagisa

This comment has been minimized.

Contributor

nagisa commented Oct 16, 2018

This seems like the right thing to do to me…

@newpavlov

This comment has been minimized.

Contributor

newpavlov commented Oct 29, 2018

@withoutboats
Any news on this?

@TimNN

This comment has been minimized.

Contributor

TimNN commented Nov 6, 2018

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

@alexcrichton alexcrichton added the T-libs label Nov 6, 2018

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Nov 6, 2018

@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

This comment has been minimized.

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.

@sfackler

This comment has been minimized.

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

This comment has been minimized.

rfcbot commented Nov 11, 2018

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

@alexcrichton

This comment has been minimized.

Member

alexcrichton commented Nov 12, 2018

@bors: r+

@bors

This comment has been minimized.

Contributor

bors commented Nov 12, 2018

📌 Commit 4210cca has been approved by alexcrichton

@bors

This comment has been minimized.

Contributor

bors commented Nov 12, 2018

⌛️ Testing commit 4210cca with merge 90b4a01...

bors added a commit that referenced this pull request Nov 12, 2018

Auto merge of #55052 - newpavlov:patch-2, r=alexcrichton
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

This comment has been minimized.

Contributor

bors commented Nov 12, 2018

💔 Test failed - status-travis

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 12, 2018

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

This comment has been minimized.

Member

alexcrichton commented Nov 12, 2018

@bors: retry

@bors

This comment has been minimized.

Contributor

bors commented Nov 13, 2018

⌛️ Testing commit 4210cca with merge c4371c8...

bors added a commit that referenced this pull request Nov 13, 2018

Auto merge of #55052 - newpavlov:patch-2, r=alexcrichton
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

This comment has been minimized.

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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented Nov 13, 2018

📣 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

📣 Toolstate changed by rust-lang/rust#55052!
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

This comment has been minimized.

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

This comment has been minimized.

Member

nrc commented Nov 13, 2018

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

Well. That is surprising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment