On Thu, Jan 10, 2013 at 06:47:42PM +0400, Maksim Tamarsky wrote:
I found that my trouble exists when compiling with -O2 option. In that case inline functions rem_node and add_head will merged into function (/nest/iface.c ifa_recalc_primary) and then will badly optimized by compiler, because the implicit use of pointers to the same data. If we call external function(like printf) between rem_node and add_head trouble gone away in any case.
Now i use -O1. This works for 1.3.2 and 13.8.
Hello I thought that it might be something like that, but if i remember and understand correctly C language rules for pointer aliasing, then the code is OK, because although the memory is accessed through pointers to structures of two different types, the content is same (node ptr), so compiler cannot expect non-aliasing. So i would suppose it is a compiler bug, so workaround with -O1 is probably a good solution. There are probably some other potential pointer aliasing problems in BIRD (at least the ones that newer versions of GCC complainted) that should be addressed, but i think this one is OK. MJ, any comment on this list code and pointer aliasing? -- Elen sila lumenn' omentielvo Ondrej 'SanTiago' Zajicek (email: santiago@crfreenet.org) OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net) "To err is human -- to blame it on a computer is even more so."