public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23282] New: wrong results at -O on x86
@ 2005-08-08  6:27 jv244 at cam dot ac dot uk
  2005-08-08  6:38 ` [Bug tree-optimization/23282] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: jv244 at cam dot ac dot uk @ 2005-08-08  6:27 UTC (permalink / raw)
  To: gcc-bugs

Using gcc 4.0.1 :

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /data1/vondele/gcc-401/gcc/configure --
prefix=/data1/vondele/gcc-401/result --with-gmp-dir=/data1/vondele/gmp-4.1.4/ -
-with-mpfr=/home/vondele/ --enable-languages=c,f95
Thread model: posix
gcc version 4.0.1

The following program generates wrong results (-1 instead of 4 for the second 
number printed out) if compiled with -O. It works fine with gcc 3.3.4 and the 
portland group c compiler:

#include <stdio.h>

void sub(int *m) {
  int index, l, count;

  l = 2;

  for(count=2; count>0; count--, l++) {
    index = l*l+1;

    printf("%d\n", m[index-2*l]);

    m[index+1] = -1;
  }
}


int main(void) {
  int i, m[20];

  for(i=0; i<20; i++)
    m[i] = i;

  sub(m);

  for(i=0; i<20; i++)
    printf("%d ", m[i]);

  putchar('\n');
}

vondele> gcc test.c
vondele> ./a.out
1
4
0 1 2 3 4 5 -1 7 8 9 10 -1 12 13 14 15 16 17 18 19

vondele> gcc -O test.c
vondele> ./a.out
1
-1
0 1 2 3 4 5 -1 7 8 9 10 -1 12 13 14 15 16 17 18 19

-- 
           Summary: wrong results at -O on x86
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jv244 at cam dot ac dot uk
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <bug-23282-6642@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2006-01-19  0:55 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-08  6:27 [Bug c/23282] New: wrong results at -O on x86 jv244 at cam dot ac dot uk
2005-08-08  6:38 ` [Bug tree-optimization/23282] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-08-08  8:00 ` belyshev at depni dot sinp dot msu dot ru
2005-08-08  8:25 ` rguenth at gcc dot gnu dot org
2005-08-08  8:45 ` steven at gcc dot gnu dot org
2005-08-08  9:08 ` steven at gcc dot gnu dot org
2005-08-16  8:10 ` rakdver at gcc dot gnu dot org
2005-08-16 10:22 ` belyshev at depni dot sinp dot msu dot ru
2005-08-16 10:29 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2005-09-09  8:54 ` jv244 at cam dot ac dot uk
2005-09-27 16:11 ` mmitchel at gcc dot gnu dot org
     [not found] <bug-23282-6642@http.gcc.gnu.org/bugzilla/>
2005-11-03 10:39 ` belyshev at depni dot sinp dot msu dot ru
2005-12-01 10:21 ` jv244 at cam dot ac dot uk
2005-12-21 15:58 ` belyshev at depni dot sinp dot msu dot ru
2006-01-03  9:36 ` jv244 at cam dot ac dot uk
2006-01-15 21:22 ` belyshev at depni dot sinp dot msu dot ru
2006-01-18 23:31 ` rakdver at gcc dot gnu dot org
2006-01-19  0:55 ` 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).