https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91606
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to Richard Biener from comment #5) > for example _31->__delta gets alias-set 4 and the store alias-set 6. It > looks > like the C++ FE creates separate pfn structure types without any TBAA measure > here? In this case the method type we create them are different. > > void MyStruct::<T4316> (struct MyStruct *, int) > > and > > int MyStruct::<T431a> (struct MyStruct *, char, short int, bool) If you are looking at these two, you are clearing looking at different pointer-to-member. But if I compare say the: # .MEM_11 = VDEF <.MEM_10(D)> D.10827._M_elems[0].D.10649.f1.__pfn = fun1; store with # VUSE <.MEM_8> _1 = _31->__pfn; it seems they actually use the same pointer-to-member struct (well, the first one is struct { void MyStruct::<T1bbe> (struct MyStruct *, int) * __pfn; long int __delta; } and the second is: const struct { void MyStruct::<T1bbe> (struct MyStruct *, int) * __pfn; long int __delta; } but TYPE_MAIN_VARIANT of the latter is the former type. The first of these type and a type with the different method type are in a union (f1 is this one, f2 the other one). Yet, get_alias_set on D.10827._M_elems[0].D.10649.f1.__pfn returns 3 and on _31->__pfn returns 5, even when TYPE_MAIN_VARIANT (TREE_TYPE (D.10827._M_elems[0].D.10649.f1)) == TYPE_MAIN_VARIANT (TREE_TYPE (*_31)). Alias set for the former comes from TYPE_ALIAS_SET of the anonymous union containing f1 and f2 fields. When that alias set has been created, it calls record_component_aliases, but both f1 and f2 fields have these TYPE_PTRMEMFUNC_P types for which cxx_get_alias_set returns 0: /* Punt on PMFs until we canonicalize functions properly. */ if (TYPE_PTRMEMFUNC_P (t) || (INDIRECT_TYPE_P (t) && TYPE_PTRMEMFUNC_P (TREE_TYPE (t)))) return 0; The alias machinery then records that the anonymous union has zero child.