https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95748
--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
[hjl@gnu-cfl-2 tmp]$ cat x.c
typedef __UINTPTR_TYPE__ uintptr_t;
__attribute__ ((noclone, noinline))
void
check (uintptr_t address, uintptr_t align)
{
if (address & (align - 1))
__builtin_abort();
}
__attribute__ ((noclone, noinline))
void
foo(uintptr_t x, long long p)
{
uintptr_t align = __alignof__(p);
uintptr_t address = (uintptr_t) &p;
check (address, align);
}
__attribute__ ((noclone, noinline))
int
bar(void)
{
foo (4,5);
return 0;
}
int *ptr;
int
main()
{
int x = 1;
ptr = &x;
return bar();
}
[hjl@gnu-cfl-2 tmp]$ gcc -m32 x.c -mpreferred-stack-boundary=2 -O2
[hjl@gnu-cfl-2 tmp]$ ./a.out
Aborted (core dumped)
[hjl@gnu-cfl-2 tmp]$