https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94158

--- Comment #3 from Parker Thompson <par...@cyber-itl.org> ---
(In reply to Andrew Pinski from comment #2)
> Also aligned_alloc normally does not allow alignment of 1.
> 
> So GCC is doing the correct thing.

The replacement of strdup here is just to illustrate the issue with expansion
alignment of strlen() by forcing a crash.

I encountered this issue when working with a custom malloc replacement that
would enforce out-of-bounds read checks. Using the same reproduction with clang
did not produce a crash / oob-read.

As for alloc alignment, glibc strdup() does not use aligned_alloc, just malloc.
 Which by my read of the spec does not guarantee alignment.

Reply via email to