------- Comment #4 from hjl dot tools at gmail dot com 2008-01-22 14:26 -------
(In reply to comment #2)
> I bet if you put jj in struct and don't have a nested function, this will be
> the same issue.
>
struct works for me:
bash-3.2$ cat x.c
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#ifndef ALIGNMENT
#define ALIGNMENT 16
#endif
int
check_int (int *i, int align)
{
*i = 20;
if ((((ptrdiff_t) i) & (align - 1)) != 0)
{
printf("\nUnalign address (%d): %p!\n", align, i);
abort ();
}
return *i;
}
void
foo (void)
{
struct i
{
int i;
} __attribute__((aligned(ALIGNMENT))) i;
if (check_int (&i.i, __alignof__(i.i)) != i.i)
abort ();
}
void
bar (void)
{
int __attribute__((aligned(ALIGNMENT))) i;
if (check_int (&i, __alignof__(i)) != i)
abort ();
}
int
main()
{
foo ();
bar ();
return 0;
}
bash-3.2$ /usr/gcc-4.3/bin/gcc -m32 x.c
bash-3.2$ ./a.out
bash-3.2$
--
hjl dot tools at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-01-22 14:26:12
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34921