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

             Bug #: 51176
           Summary: possible integer wrong code bug
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: reg...@cs.utah.edu


[regehr@gamow tmp063]$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/uusoc/exports/scratch/regehr/z/compiler-install/gcc-r181415-install/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/compiler-install/gcc-r181415-install
--program-prefix=r181415- --enable-languages=c,c++
Thread model: posix
gcc version 4.7.0 20111116 (experimental) (GCC) 

[regehr@gamow tmp063]$ current-gcc -O1 small.c  ; ./a.out 
-1
[regehr@gamow tmp063]$ current-gcc -O2 -fno-inline small.c  ; ./a.out 
1

[regehr@gamow tmp063]$ cat small.c


int printf (const char *, ...);
struct S1
{
  int f0;
  int:1;
  int f3;
  int:1;
  int:0;
  int f6:1;
};
int g_13 = 1;
volatile struct S1 g_118 = {
  1
};

void
func_46 ()
{
  for (g_13 = 0; g_13 >= 0; g_13 -= 1)
    g_118.f6 = 0;
}

int
main ()
{
  func_46 ();
  printf ("%d\n", g_13);
  return 0;
}

Reply via email to