This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56434

--- Comment #2 from Chip Salzenberg <chip at pobox dot com> 2013-02-25 17:51:36 UTC ---
I detected this by observing inlined strlen() on a malloc'd pointer did not
first do an unaligned prologue.  I expected it to first advance by bytes until
it detected alignment, but it didn't do any of that; it leapt right into the
word-sized optimized loop.

This suggests that the compiler knows than an 8-byte-aligned (say) pointer has
its low seven bits off and will evaporate away any code that depends on them
being nonzero.  Or is the strlen inlining special-cased?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]