public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/50067] New: Wrong code with -fpredictive-commoning
@ 2011-08-13  0:01 arthur.j.odwyer at gmail dot com
  2011-08-14  9:49 ` [Bug tree-optimization/50067] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2011-08-13  0:01 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50067
           Summary: Wrong code with -fpredictive-commoning
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: arthur.j.odwyer@gmail.com


Created attachment 24994
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24994
Output of "ajo-gcc -std=c99 -O -fpredictive-commoning test.c -v"

This failure reproduces for me with svn revision 177688 (2011-08-11). I'm on
Ubuntu 10.10, x86-64.


cat >test.c <<EOF
#include <stdio.h>
int a[6] = {0, 0, 0, 0, 7, 0};
static int *p = &a[4];
int main (int argc, char* argv[]) {
    for (int i=0; i < 4; ++i) {
        a[i+1] = (a[i+2] > i);
        *p &= ~1;
    }
    printf("%d\n", a[4]);
}
EOF
gcc -std=c99 -O test.c ; ./a.out
gcc -std=c99 -O -fpredictive-commoning test.c ; ./a.out


The first command line above correctly produces "0".
The second command line, with -fpredictive-commoning, produces "6".
Note that -fpredictive-commoning is enabled as part of -O3.


This test case is reduced from the output of Csmith 2.1.0 (git hash 01aa8b04,
https://github.com/Quuxplusone/csmith/), using the following command line:
csmith --paranoid --no-longlong --pointers --arrays --jumps --no-consts
--volatiles --checksum --no-divs --muls --no-bitfields --no-packed-struct -s
278348999


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

end of thread, other threads:[~2011-08-24 10:17 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-13  0:01 [Bug tree-optimization/50067] New: Wrong code with -fpredictive-commoning arthur.j.odwyer at gmail dot com
2011-08-14  9:49 ` [Bug tree-optimization/50067] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-08-18 11:22 ` jakub at gcc dot gnu.org
2011-08-18 11:31 ` jakub at gcc dot gnu.org
2011-08-18 14:14 ` jakub at gcc dot gnu.org
2011-08-19  9:18 ` rguenth at gcc dot gnu.org
2011-08-19 11:24 ` rguenth at gcc dot gnu.org
2011-08-19 11:52 ` jakub at gcc dot gnu.org
2011-08-19 11:55 ` rguenth at gcc dot gnu.org
2011-08-19 12:59 ` rguenth at gcc dot gnu.org
2011-08-19 13:46 ` rguenth at gcc dot gnu.org
2011-08-19 14:26 ` rguenth at gcc dot gnu.org
2011-08-19 14:29 ` rguenth at gcc dot gnu.org
2011-08-22  8:53 ` rguenth at gcc dot gnu.org
2011-08-22  9:40 ` rguenth at gcc dot gnu.org
2011-08-24 10:12 ` rguenth at gcc dot gnu.org
2011-08-24 10:17 ` rguenth at gcc dot gnu.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).