[cfe-dev] Clang incorrectly optimizing out for conditional in Linux
David Chisnall via cfe-dev
cfe-dev at lists.llvm.org
Tue Apr 4 01:00:40 PDT 2017
On 3 Apr 2017, at 20:24, Keane, Erich via cfe-dev <cfe-dev at lists.llvm.org> wrote:
>
> I filed an issue with the Kernel (here https://bugzilla.kernel.org/show_bug.cgi?id=195235) to capture this issue. Hopefully this is something that they will fix! I'll note that my suggested answer assumes they want the behavior to remain the same, though I'm not sure that is what they MEANT.
As I recall, this particular kernel idiom is one that caused GCC to add an extra flag to restrict their optimisations, because rewriting Linux in C was harder than hacking the compiler to support Linux-flavoured almost-C, so I wouldn’t hold out much hope for Linux fixing the code - this is far from the only place that this idiom occurs and has been the cause of at least one security vulnerability.
David
More information about the cfe-dev
mailing list