public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jv244 at cam dot ac dot uk" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/23282] New: wrong results at -O on x86 Date: Mon, 08 Aug 2005 06:27:00 -0000 [thread overview] Message-ID: <20050808062659.23282.jv244@cam.ac.uk> (raw) 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
next reply other threads:[~2005-08-08 6:27 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2005-08-08 6:27 jv244 at cam dot ac dot uk [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20050808062659.23282.jv244@cam.ac.uk \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).