Bug#356153: FTBFS with G++ 4.1: dereferencing type-punned pointer will break strict-aliasing rules

Petter Reinholdtsen pere at hungry.com
Sun May 14 09:31:33 UTC 2006


The problems seem to originate from these macros in dlink.h:

  #define dl_next(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_next))
  #define dl_prev(p) *((void**)&(((struct __dl_head*)(p))[-1].dh_prev))

There are problems building config.c, mdstat.c, Examine.c and dlink.c
using gcc 4.1 because of these macros.

Rewriting the macros to inline functions returning the value get rid
of the warning in config.c, but give a new error in dlink.c as the
macros are also used to set the next and prev values.

I'm not sure how to rewrite the macro to avoid the problem.




More information about the pkg-mdadm-devel mailing list