[cfe-dev] Clang incorrectly optimizing out for conditional in Linux

Keane, Erich via cfe-dev cfe-dev at lists.llvm.org
Tue Apr 4 08:25:29 PDT 2017


Well Blarg, that is disappointing.  In THIS case, I at least have a hope, the original implementer and I share an organization, so hopefully he'll be willing to fix it out of internal good will :)

-----Original Message-----
From: Dr D. Chisnall [mailto:dc552 at hermes.cam.ac.uk] On Behalf Of David Chisnall
Sent: Tuesday, April 4, 2017 1:01 AM
To: Keane, Erich <erich.keane at intel.com>
Cc: cfe-dev at lists.llvm.org; derrick.mckee at gmail.com; jonathan at codesourcery.com; csong at cs.ucr.edu
Subject: Re: [cfe-dev] Clang incorrectly optimizing out for conditional in Linux

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