Sort out alignof for 64 bit types #40

Open
opened 2026-01-29 22:24:14 +00:00 by claunia · 0 comments
Owner

Originally created by @dmik on GitHub (Apr 6, 2021).

Currently, the following test program

#include <stdio.h>

int main ()
{
  printf ("%d %d\n", sizeof(unsigned long long), alignof(unsigned long long));
  return 0;
}

yields the following output

8 4

I.e. alignment of a 64 bit integer is 4 bytes. This freaks out e.g. a Qt5 QtBase test (tst_QGlobal::qAlignOf()) which expects alignment for it to be 8 bytes as well. Same story for double.

I wonder what our GCC should really return in such a case given that 32-bit Linux and Windows compilers return 8 (at least, according to the Qt test case).

Found when doing bitwiseworks/qt5-os2#16.

Originally created by @dmik on GitHub (Apr 6, 2021). Currently, the following test program ```c++ #include <stdio.h> int main () { printf ("%d %d\n", sizeof(unsigned long long), alignof(unsigned long long)); return 0; } ``` yields the following output ``` 8 4 ``` I.e. alignment of a 64 bit integer is 4 bytes. This freaks out e.g. a Qt5 QtBase test (`tst_QGlobal::qAlignOf()`) which expects alignment for it to be 8 bytes as well. Same story for `double`. I wonder what our GCC should really return in such a case given that 32-bit Linux and Windows compilers return 8 (at least, according to the Qt test case). Found when doing bitwiseworks/qt5-os2#16.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bitwiseworks/gcc-os2#40