diff options
| author | bors <bors@rust-lang.org> | 2019-10-10 15:40:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-10-10 15:40:39 +0000 |
| commit | 58b54911fabcd1b328fab78014b6833a4e8cfaa3 (patch) | |
| tree | 6f621f3f837f3fb915cccf5d47d6c768b07472d2 /src/test/ui/iterators/iter-sum-overflow-debug.rs | |
| parent | 9c588c1e2391c20c156814f7ae118f62e96a3976 (diff) | |
| parent | e9acfa306f47a40be27e8cf72c55dbec35d94017 (diff) | |
| download | rust-58b54911fabcd1b328fab78014b6833a4e8cfaa3.tar.gz rust-58b54911fabcd1b328fab78014b6833a4e8cfaa3.zip | |
Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisa
Add llvm.sideeffect to potential infinite loops and recursions
LLVM assumes that a thread will eventually cause side effect. This is
not true in Rust if a loop or recursion does nothing in its body,
causing undefined behavior even in common cases like `loop {}`.
Inserting llvm.sideeffect fixes the undefined behavior.
As a micro-optimization, only insert llvm.sideeffect when jumping back
in blocks or calling a function.
A patch for LLVM is expected to allow empty non-terminate code by
default and fix this issue from LLVM side.
https://github.com/rust-lang/rust/issues/28728
**UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR
Diffstat (limited to 'src/test/ui/iterators/iter-sum-overflow-debug.rs')
0 files changed, 0 insertions, 0 deletions
