[cfe-dev] RFC: do not optimize on basis of __attribute__((nonnull)) in glibc headers

Chandler Carruth via cfe-dev cfe-dev at lists.llvm.org
Tue Jan 3 15:14:46 PST 2017


On Tue, Jan 3, 2017 at 3:10 PM Hal Finkel via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

On the one hand, GCC has already started optimizing based on the nonnull
attribute on memcpy, and so that ship has sailed.

I know of a large number of libraries that only behave correctly with
recent GCCs by using the flag Eli mentioned to disable all nonnull
optimizations wholesale. =/

If the standards committees actually change their mind here, I think we
could reasonably enable exactly this flag for Clang and LLVM when built
with a GCC version not implementing the fix.

And even if not, even if we do actually have to fix all of our code to work
in the face of those optimizations, I at least have a large body of users
that aren't sure they will ever finish fixing all of these issues. They
don't have any good way to test and discover *all* of them, only the ones
hit in code paths today. So I'd still like to give them a toolchain that
will protect the places in their software where they erroneously relied on
a guarantee not provided and have no tests or ability to go and fix.

-Chandler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170103/480c3c5c/attachment.html>


More information about the cfe-dev mailing list