[PATCH] libio: Add small optimization on fmemopen

Florian Weimer fweimer@redhat.com
Wed Sep 21 19:27:00 GMT 2016


On 09/21/2016 08:57 PM, Paul Eggert wrote:
> On 09/21/2016 11:47 AM, Florian Weimer wrote:
>> We don't know the nature of the GCC issue, so we cannot work around it
>> reliably.  The most likely explanation is that Address Sanitizer does
>> not account for a valid GCC optimization.
>
> That's not the sense that I get from looking at Bug 66661. GCC is
> assuming it can do an aligned word load of the trailing bytes of a
> flexible array member in a properly-aligned structure.

But that assumption is completely correct!  It's just that Address 
Sanitizer does not account for it (based on what I've seen so far).

>Although the followups to Bug 66661 suggest that there may be
> further problems with overaligned structures, the code here is not using
> _Alignas so these further problems are not an issue here.

_Alignas is used only to demonstrate the issue more clearly.

glibc currently does not compile with Address Sanitizer anyway, so until 
that is fixed (or someone has a better explanation of the root cause of 
GCC PR66661), I would suggest to assume that this issue does not matter 
to glibc at all.

Thanks,
Florian



More information about the Libc-alpha mailing list