public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34921]  New: Misalign stack variable referenced by nested function
@ 2008-01-22  7:52 Joey dot ye at intel dot com
  2008-01-22  8:22 ` [Bug c/34921] " Joey dot ye at intel dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Joey dot ye at intel dot com @ 2008-01-22  7:52 UTC (permalink / raw)
  To: gcc-bugs

> 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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2008-12-31 18:18 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-22  7:52 [Bug c/34921] New: Misalign stack variable referenced by nested function Joey dot ye at intel dot com
2008-01-22  8:22 ` [Bug c/34921] " Joey dot ye at intel dot com
2008-01-22 11:51 ` [Bug middle-end/34921] " pinskia at gcc dot gnu dot org
2008-01-22 13:58 ` hjl dot tools at gmail dot com
2008-01-22 14:47 ` hjl dot tools at gmail dot com
2008-01-23  2:12 ` Joey dot ye at intel dot com
2008-01-23 16:31 ` hjl dot tools at gmail dot com
2008-02-06 15:24 ` hjl at gcc dot gnu dot org
2008-02-18 23:44 ` hjl at gcc dot gnu dot org
2008-08-06  8:07 ` Joey dot ye at intel dot com
2008-12-31 18:18 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).