-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
char::encode_utf8 crash on nightly #82833
Copy link
Copy link
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Metadata
Metadata
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-criticalCritical priorityCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.Performance or correctness regression from stable to nightly.
Type
Fields
Give feedbackNo fields configured for issues without a type.
On nightly 2021-03-05, with
RUSTFLAGS="-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code", I am experiencing undefined behaviour which seems to be based aroundchar::encode_utf8.I ran this code:
I expected to see the following output:
I get the above output on stable 1.50.0, or on the same nightly version if I remove at least one of the three
RUSTFLAGSlisted above.With all three flags present, on nightly 2021-03-05 I see the following output:
The exact bytes count varies, so this looks like UB to me.
Meta
rustc +nightly --version --verbose: