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

            Bug ID: 115177
           Summary: incorrect TBAA for derived types involving hardbool
                    types
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

This is another example where type compatibility in the C FE disagrees with
TBAA. Not sure whether those types should be made incompatible instead.

https://godbolt.org/z/e6nYzWMzx


typedef int A;
typedef int __attribute__ (( hardbool(0, 1) )) B;

_Static_assert(_Generic((A*){ 0 }, B*: 1), "");

void* foo(void* a, void *b, A *c, B *d)
{
        *(A**)a = c;
        *(B**)b = d;
        return *(A**)a;
}

int main()
{
        A *a, b, c;
        if (&c != (A*)foo(&a, &a, &b, &c))
                __builtin_abort();
}

Reply via email to