From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13373 invoked by alias); 16 Nov 2001 12:06:03 -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 13339 invoked by uid 71); 16 Nov 2001 12:06:02 -0000 Resent-Date: 16 Nov 2001 12:06:02 -0000 Resent-Message-ID: <20011116120602.13338.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, jfran@clip.dia.fi.upm.es Received:(qmail 5476 invoked by uid 61); 16 Nov 2001 11:58:50 -0000 Message-Id:<20011116115850.5475.qmail@sourceware.cygnus.com> Date: Mon, 05 Nov 2001 02:49:00 -0000 From: jfran@clip.dia.fi.upm.es Reply-To: jfran@clip.dia.fi.upm.es To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: optimization/4888: incorrect code with -Ox, x >= 2 X-SW-Source: 2001-11/txt/msg00125.txt.bz2 List-Id: >Number: 4888 >Category: optimization >Synopsis: incorrect code with -Ox, x >= 2 >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Nov 16 04:06:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: jfran >Release: gcc >=2.96 <=3.0.2 >Organization: >Environment: >Description: With optimizations enabled, "f=x; y=*(type*)&f;" reads garbage on 'y' unless 'type'=='char' (problem with memory alias?) "f=x; g(); y=*(type*)&f;" works fine if g() is not inlined. >How-To-Repeat: Compile with -O0, execute. Compile with -O2, execute. Uncomment the commented line. Test again. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="mem.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="mem.c" I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIGcoKTsKCmludCBtYWluKCkgewogIGRvdWJsZSBmOwog IHVuc2lnbmVkIGludCAqaTsKICBpbnQgeDsKICBmID0gMS4wOwogIGkgPSAodW5zaWduZWQgaW50 ICopJmY7CiAgLy8gZygpOwogIHggPSBpWzFdOwogIHByaW50ZigiJXhcbiIsIHgpOwogIHJldHVy biAwOwp9Cgp2b2lkIGcoKSB7Cn0K