reg...@john-home:~$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r161813-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=/home/regehr/z/compiler-install/gcc-r161813-install
--program-prefix=r161813- --enable-languages=c,c++
Thread model: posix
gcc version 4.6.0 20100704 (experimental) (GCC) 

reg...@john-home:~$ current-gcc -O1 small.c -o small
reg...@john-home:~$ ./small
checksum g_40 = 274686410
reg...@john-home:~$ current-gcc -O2 small.c -o small
reg...@john-home:~$ ./small
checksum g_40 = -1

reg...@john-home:~$ cat small.c

extern int printf (__const char *__restrict __format, ...);

static char
foo (char si1, char si2)
{
  return si1* si2;
}

 const  volatile unsigned int g_2[8][3] = {{0L, 0L, 0L}, {0L, 0L, 0L}, {0L,
0L, 0L}, {0L, 0L, 0L}, {0L, 0L, 0L}, {0L, 0L, 0L}, {0L, 0L, 0L}, {0L, 0L,
0L}};
long long g_29 = 1;
int g_40 = 0x105F61CAL;
int *g_39 = &g_40;
 volatile int * volatile g_88[1] = {0};
 volatile int g_429[5] = {1L, 1L, 1L, 1L, 1L};

int  main(void)
{
    int * const l_353 = &g_40;
    int l_414 = 0xF5B296C2L;
    if (!(g_2[5][2]))
    {
        int l_420 = 0x0332F5C8L;
        if (((foo (l_420, (*l_353))) > (!-10L)))
        {
            for (l_414 = 0; l_414 < 1; l_414 += 1)
            {
                g_88[l_414] = &g_429[2];
            }
            (*g_39) = -1;
        }
    }
    printf("checksum g_40 = %d\n", g_40);
    return g_29;
}


-- 
           Summary: possible integer wrong code bug
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: regehr at cs dot utah dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to