This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT
- From: "chip at pobox dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 25 Feb 2013 17:51:36 +0000
- Subject: [Bug rtl-optimization/56434] document that __attribute__((__malloc__)) assumes returned pointer has BIGGEST_ALIGNMENT
- Auto-submitted: auto-generated
- References: <bug-56434-4@http.gcc.gnu.org/bugzilla/>
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?