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

            Bug ID: 121603
           Summary: When z is a variable of type _BitInt(64), gcc -m32
                    evaluates _Alignof(z) to 8
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pascal_cuoq at hotmail dot com
  Target Milestone: ---

My colleague Antonin Decimo has noticed a difference between Clang and GCC on
the example below. And we think that Clang might be correct.

_BitInt(64) z;
int alignof_bi64 = _Alignof(_BitInt(64));
int alignof_z = _Alignof(z);

Using GCC 15.1, "gcc -O2 -std=c23 -m32" generates:

alignof_z:
        .long   8
alignof_bi64:
        .long   4

With the same options, Clang 20.1.0 generates:

alignof_bi64:
        .long   4

alignof_z:
        .long   4

CE link: https://gcc.godbolt.org/z/KGnxMPhsh

We expect the value 4 for alignof_bi64 (recall that when generating IA-32,
_Alignof(long long) is 4 for historical reasons, and we think that
_Alignof(_BitInt(64)) has no reason to be different).

Although applying _Alignof to an lvalue is a GCC extension, we do not
understand why it would produce the different result of 8. If this is intended,
we can report it on the Clang side as a difference between the two compilers.

Reply via email to