------- Comment #9 from rguenth at gcc dot gnu dot org 2008-12-12 12:09 ------- Btw, if you want to dig yourself - the problem is that the alias set of const struct _Rb_tree_node is not a subset of struct test. So the access of any part of an object of type struct test through a pointer of type const struct _Rb_tree_node * invokes undefined behavior (from the middle-end perspective).
See alias.c:record_component_aliases for how the relationship is built. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38477