This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/34921] New: Misalign stack variable referenced by nested function
- From: "Joey dot ye at intel dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Jan 2008 06:37:49 -0000
- Subject: [Bug c/34921] New: Misalign stack variable referenced by nested function
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
> cat nested-2.c
#include <stdio.h>
#include <stdlib.h>
typedef int aligned __attribute__((aligned(16)));
int global;
void
check (int *i)
{
*i = 20;
if ((((int) i) & (__alignof__(aligned) - 1)) != 0)
{
printf("\nUnalign address (%d): %p!\n",
__alignof__(aligned), i);
abort ();
}
}
void
foo (void)
{
aligned jj;
void bar ()
{
jj = -20;
}
jj = 0;
bar ();
check (&jj);
}
int
main()
{
foo ();
return 0;
}
> gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/wlin5/gcc/src-daily/configure
--enable-languages=c,c++,fortran --disable-bootstrap
Thread model: posix
gcc version 4.3.0 20080106 (experimental) [trunk revision 131347] (GCC)
> gcc -m32 -o nested-2.exe nested-2.c
> ./nested-2.exe
Unalign address (16): 0xffa137dc!
Aborted
--
Summary: Misalign stack variable referenced by nested function
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Joey dot ye at intel dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34921