From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10328 invoked by alias); 26 Aug 2002 18:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 10300 invoked by uid 71); 26 Aug 2002 18:26:00 -0000 Resent-Date: 26 Aug 2002 18:26:00 -0000 Resent-Message-ID: <20020826182600.10299.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, ghouston@arglist.com Received: (qmail 9896 invoked from network); 26 Aug 2002 18:24:05 -0000 Received: from unknown (HELO onyx.he.net) (216.218.161.2) by sources.redhat.com with SMTP; 26 Aug 2002 18:24:05 -0000 Received: from onyx.he.net (onyx.he.net [216.218.161.2]) by onyx.he.net (8.8.6/8.8.2) with ESMTP id LAA14743 for ; Mon, 26 Aug 2002 11:24:04 -0700 Received: (qmail 3211 invoked by uid 125); 26 Aug 2002 18:20:28 -0000 Message-Id: <20020826182028.3210.qmail@arglist.com> Date: Mon, 26 Aug 2002 12:26:00 -0000 From: ghouston@arglist.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: 3.113 Subject: optimization/7728: Invalid statement reordering gcc 3.2 -O2 X-SW-Source: 2002-08/txt/msg00557.txt.bz2 List-Id: >Number: 7728 >Category: optimization >Synopsis: Invalid statement reordering gcc 3.2 -O2 >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Mon Aug 26 11:26:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Gary Houston >Release: 3.2 >Organization: >Environment: System: Linux x.localnet 2.4.18 #1 Sat Apr 6 12:54:37 BST 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc-3.2/configure --prefix=/usr --enable-threads=posix --enable-shared >Description: Output of program below, compiled with gcc -O: 154 153 153 153 153 153 9 64 Output when compiled with gcc -O2: 0 0 0 0 153 153 9 64 >How-To-Repeat: #include #include typedef struct { unsigned long * type; unsigned long * pad; double real; } x_double; void * make_z (double x) { void *z = malloc (50); memset (z, 0, 50); ((unsigned long *) z) [2] = 0; ((x_double *) z)->real = x; return z; } main () { void *z = make_z (3.2); double d = ((x_double *) z)->real; int i; for (i = 0; i < sizeof (double); i++) { printf ("%d\n", ((unsigned char *) &d)[i]); } return 0; } >Fix: reduce optimization >Release-Note: >Audit-Trail: >Unformatted: