https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70054

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 6 re-introduces type-based alias analysis for pointer objects and thus
if you do sth like

 *(int *)&x = A;
  ... = *(long *)&x;

then the compiler will now remove the store (because 'int *' does not
alias 'long *').

The warning is because std::aligned_storage<sizeof(long), alignof(long)>::type
is a union:

    struct aligned_storage
    {
      union type
      {
        unsigned char __data[_Len];
        struct __attribute__((__aligned__((_Align)))) { } __align;
      };
    };

and this union does _not_ have alias-set zero!  In fact I think the improvement
on alias-set subsetting for structures/unions with an alias-set zero member
changed behavior here (PR66110).

The warning is somewhat bogus (well, the implementation is...) and relied on
that has_zero_child check.  It should instead use alias_set_subset_of, I will
test a patch.

Reply via email to