public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26719]  New: Computed (integer) table changes with -O
@ 2006-03-16 18:19 kmshanah at disenchant dot net
  2006-03-16 18:24 ` [Bug tree-optimization/26719] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: kmshanah at disenchant dot net @ 2006-03-16 18:19 UTC (permalink / raw)
  To: gcc-bugs

System info: Debian Unstable, x86 (Transmeta Crusoe TM5800)

The following program produces different output when compiled with and without
optimisations. This didn't occur with gcc 4.0.3, it seems to be new with 4.1.0.

#include <stdio.h>

int table[32][256];

int main(void)
{
    int i, j;

    for (i = 0; i < 32; i++)
        for (j = 0; j < 256; j++)
            table[i][j] = ((signed char)j) * i;

    for (i = 0; i < 10; i++)
        printf("%10i %10i\n", table[i][5], table[i][132]);

    return 0;
}

Compiling without optimisations, the output is as desired. With -O1 the output
changes. Here's how I can reproduce the problem:

$ gcc-4.1 -o example.O0 example.c
$ gcc-4.1 -O1 -o example.O1 example.c
$ ./example.O0 
         0          0
         5       -124
        10       -248
        15       -372
        20       -496
        25       -620
        30       -744
        35       -868
        40       -992
        45      -1116
$ ./example.O1 
         0          0
         5        132
        10        264
        15        396
        20        528
        25        660
        30        792
        35        924
        40       1056
        45       1188
$ gcc-4.1 -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr
--with-tune=i686 --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.0 (Debian 4.1.0-0)


-- 
           Summary: Computed (integer) table changes with -O
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kmshanah at disenchant dot net


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


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

end of thread, other threads:[~2007-03-23 15:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-16 18:19 [Bug c/26719] New: Computed (integer) table changes with -O kmshanah at disenchant dot net
2006-03-16 18:24 ` [Bug tree-optimization/26719] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-03-16 18:50 ` rakdver at gcc dot gnu dot org
2006-03-16 18:51 ` rakdver at gcc dot gnu dot org
2006-03-28 22:44 ` sebastian dot pop at cri dot ensmp dot fr
2006-04-16 19:02 ` mmitchel at gcc dot gnu dot org
2006-04-27 11:24 ` rguenth at gcc dot gnu dot org
2006-05-14 14:25 ` steven at gcc dot gnu dot org
2006-05-14 14:49 ` rakdver at gcc dot gnu dot org
2006-05-20 19:27 ` rakdver at gcc dot gnu dot org
2006-05-24 22:56 ` rakdver at gcc dot gnu dot org
2006-05-25  2:33 ` mmitchel at gcc dot gnu dot org
2006-05-25 17:09 ` [Bug tree-optimization/26719] [4.1 " pinskia at gcc dot gnu dot org
2006-07-24  8:26 ` rguenth at gcc dot gnu dot org
2006-07-24  8:30 ` rguenth at gcc dot gnu dot org
2007-03-23 15:38 ` pinskia at gcc dot gnu dot org
2007-03-23 15:52 ` thutt at vmware dot com
2007-03-23 15:54 ` 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).