Re: Strict-aliasing in GCC

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

 



Jan Engelhardt <jengelh@xxxxxxxxxx> writes:

> struct list_head {
> 	struct list_head *next;
> };
> struct item {
> 	struct list_head list;
> };
>
> int main(void)
> {
> 	struct list_head hdr;
> 	struct item itm, *pos;
>
> 	hdr.next = &itm.list;
> 	itm.list.next = &hdr;
>
> 	for (pos  = (struct item *)hdr.next;
> 	     pos != (struct item *)&hdr;
> 	     pos  = (struct item *)(pos->list.next))
> 		;
>
> 	return 0;
> }

I agree that I don't see an aliasing violation in this code.

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