http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47228

           Summary: likely improper segfault in generated code
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: reg...@cs.utah.edu
                CC: cheny...@cs.utah.edu
              Host: i686-pc-linux-gnu
            Target: i686-pc-linux-gnu
             Build: i686-pc-linux-gnu


regehr@home:~/volatile/bugs/tmp343$ current-gcc -O1 small.c -o small
regehr@home:~/volatile/bugs/tmp343$ ./small 
Segmentation fault
regehr@home:~/volatile/bugs/tmp343$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/mnt/z/z/compiler-install/gcc-r168608-install/libexec/gcc/i686-pc-linux-gnu/4.6.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/mnt/z/z/compiler-install/gcc-r168608-install
--program-prefix=r168608- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20110109 (experimental) (GCC) 
regehr@home:~/volatile/bugs/tmp343$ cat small.c


struct S4 
{
  unsigned f0:24;
} __attribute__((__packed__));

struct S4 g_10 = {
  6210831
};

struct S4 func_2 (int x)
{
  struct S4 l_8[2] = {
    {0}, {0}
  };
  g_10 = l_8[1];
  for (; x<2; x++) {
    struct S4 tmp = {
      11936567
    };
    l_8[x] = tmp;
  }
  return g_10;
}

int main (void)
{
  func_2 (0);
  return 0;
}

Reply via email to