Repository navigation
Few LLVM lint "Unusual" #48229
Description
Activity
rustc 1.25.0-nightly (3ec5a99aa 2018-02-14) binary: rustc commit-hash: 3ec5a99aaa0084d97a9e845b34fdf03d1462c475 commit-date: 2018-02-14 host: x86_64-pc-windows-gnu release: 1.25.0-nightly LLVM version: 6.0- addedA-codegenArea: Code generationArea: Code generationT-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.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/SoundnessC-bugCategory: This is a bug.Category: This is a bug.
on Feb 15, 2018 Duplicate of #7463
I guess I’ll reopen, since this contains minimal and actionable code samples.
This seems like the LLVM lint disagrees with the statement somewhere in the compiler sources saying that
noaliason read-only data is fine even if thins alias -- because we can still reorder them?Reacted by Hanna KruppeDoesn't
noaliasalso factor into optimizing pointer comparisons?Well, whoever wrote that code strongly things that is not the case...
Also, depending on what exactly clang does, that would be unsound:
int foo(restrict int *x, restrict int *y) { (x == y) ? 1 : 0 }
This can not be optimized to return
0.Hm, you're right, and indeed I couldn't find any such optimization in a quick skim of instcombine.
- added 7 commits that reference this issue
on Apr 3, 2019 Unusual: Return statement in function with noreturn attributeThis case is fixed by #59639 as of nightly-2019-04-05.
Removing
I-unsoundlabel. The remaining 2 cases ("noalias argument aliases another argument") seem to be caused by the LLVM lint being a bit overzealous. Maybe we should close this altogether?- addedA-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.and removedI-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/Soundness
on Dec 10, 2019 Those
noaliaslints should be relaxed by D60239, which is in LLVM 9. I will try to do a new rustc build with lints enabled to see if anything remains.Can confirm they're gone on
rustc 1.41.0-nightly (797fd9262 2019-11-26)with-Cpasses=lint. In some other code, some of these have shown up:Unusual: unreachable immediately preceded by instruction without side effects unreachable, !dbg !112This shouldn't really be an issue and is just a bit sloppy codegen by rustc.
Reacted by Josh Stone
In Issue #48227 I've seen code compiled with "-C passes=lint", I've used it on some of my code and I've found few problems, reduced below: