This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/42512] New: possible integer wrong code bug


regehr@john-home:~$ current-gcc -v
Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/tmp/gcc-r155465-install/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto
--prefix=/home/regehr/z/tmp/gcc-r155465-install --program-prefix=r155465-
--enable-languages=c,c++
Thread model: posix
gcc version 4.5.0 20091225 (experimental) (GCC) 
regehr@john-home:~$ current-gcc -O2 small.c -o small
regehr@john-home:~$ ./small
g_3 = -1
regehr@john-home:~$ current-gcc -O3 small.c -o small
regehr@john-home:~$ ./small
g_3 = 255
regehr@john-home:~$ cat small.c
#include <stdio.h>

int g_3;

int main (void)
{
    long long l_2;
    for (l_2 = -1; l_2 != 0; l_2 = (unsigned char)(l_2 - 1))
    {
        g_3 |= l_2;
    }
    printf("g_3 = %d\n", g_3);
    return 0;
}


-- 
           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=42512


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]