Re: Strict-aliasing in GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Engelhardt <jengelh@xxxxxxxxxx> writes:

> On Saturday 2010-06-12 03:44, Ian Lance Taylor wrote:
>>
>>> Since in this particular case, member is the first field,
>>> one could also write
>>>
>>> 	for (pos = (struct item *)clh.next; ...)
>>>
>>> I hear that
>>>
>>> 	"C specifies that a struct * can be converted to and from a
>>> 	pointer to its first element."
>>>
>>> Does that change anything?
>>
>>Yes, it should generally be OK to cast between a pointer to a struct
>>type and a pointer to the type of the first element of the struct.
>
> So could it be that the aliasing optimizations are overzealous here?

I don't know, because that wasn't what you were doing.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux