BUG: /lib/lists.c.. Don`t use -O2 . Use -O1
Ondrej Zajicek
santiago at crfreenet.org
Fri Jan 11 14:12:22 CET 2013
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 at 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."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20130111/1b20dc30/attachment-0001.asc>
More information about the Bird-users
mailing list