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

            Bug ID: 111884
           Summary: unsigned char no longer aliases anything under
                    -std=c2x
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amonakov at gcc dot gnu.org
  Target Milestone: ---

int f(int i)
{
    int f = 1;
    return i[(unsigned char *)&f];
}
int g(int i)
{
    int f = 1;
    return i[(signed char *)&f];
}
int h(int i)
{
    int f = 1;
    return i[(char *)&f];
}


gcc -O2 -std=c2x compiles 'f' as though inspecting representation via an
'unsigned char *' is not valid (with a confusing warning under -Wall).

Reply via email to