[cfe-commits] [PATCH] PR12094: set alignment of memory builtins

Chris Lattner clattner at apple.com
Fri Mar 2 13:39:35 PST 2012


On Mar 2, 2012, at 1:28 PM, Eli Friedman wrote:
>>> I don't think this is really safe; strictly speaking, yes, an int* is
>>> required to be appropriately aligned, but in practice neither clang
>>> nor gcc has ever tried to enforce that, so making that assumption is
>>> going to cause trouble.
>> 
>> Hi Eli,
>> 
>> Is this a vague concern or a specific one?  Even GCC-4.2 has been doing this optimization.  I consider this "fixing a regression compared to GCC", not an innovation in optimization.
> 
> I can't point to a specific example off the top of my head, but I do
> know that we've suggested switching code that uses unaligned loads to
> use memcpy without specifically noting that the type of the pointer
> matters.

I agree that there was more fallout from that change than was expected, but that was a case where we were being more aggressive than GCC.  There certainly may be some fallout from this change, but I still think it's the right thing to do, and seems less likely to cause a problem than that change.

-Chris



More information about the cfe-commits mailing list