From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19206 invoked by alias); 8 Jul 2002 12:36:02 -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 19183 invoked by uid 71); 8 Jul 2002 12:36:01 -0000 Resent-Date: 8 Jul 2002 12:36:01 -0000 Resent-Message-ID: <20020708123601.19182.qmail@sources.redhat.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, karm@enea.se, steby@enea.se Resent-Reply-To: gcc-gnats@gcc.gnu.org, svlu@enea.se Received: (qmail 18970 invoked by uid 61); 8 Jul 2002 12:33:54 -0000 Message-Id: <20020708123354.18969.qmail@sources.redhat.com> Date: Mon, 08 Jul 2002 05:36:00 -0000 From: svlu@enea.se Reply-To: svlu@enea.se To: gcc-gnats@gcc.gnu.org Cc: karm@enea.se, steby@enea.se X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify: karm@enea.se, steby@enea.se Subject: optimization/7232: Incorrect code generate for volatiles and -O2 X-SW-Source: 2002-07/txt/msg00244.txt.bz2 List-Id: >Number: 7232 >Category: optimization >Synopsis: Incorrect code generate for volatiles and -O2 >Confidential: no >Severity: critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Jul 08 05:36:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Sven Lundblad / OSE Systems >Release: gcc 3.1 >Organization: >Environment: Solaris hosted cross compiler for powerpc and mips >Description: When the code below is compiled with gcc 3.1 and -O2, for at least powerpc and mips, the second load instruction is incorrect during the next pointer update (the same value is reloaded instead of follow the pointer). It seams to be related to the use of the volatile keyword. If compiled with just -O it works fine. This is a regression from gcc 2.95 which worked fine. >How-To-Repeat: Compile the gcc_bug1.c file with -S -O2 and examine the output. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/octet-stream; name="gcc_bug1.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="gcc_bug1.c" dHlwZWRlZiBzdHJ1Y3QgYV9saW5rX3N0cnVjdAp7CiAgdW5zaWduZWQgaW50ICBhOwogIHVuc2ln bmVkIGludCAgYjsKICB1bnNpZ25lZCBpbnQgIGM7CiAgdW5zaWduZWQgaW50ICBkOwogIHVuc2ln bmVkIGludCAgZTsKICB1bnNpZ25lZCBpbnQgIGY7CiAgdW5zaWduZWQgaW50ICBnOyAgCgogIHN0 cnVjdCBhX2xpbmtfc3RydWN0ICpuZXh0OwogICAgICAKICB2b2lkICAgICAgICAqICBpOyAgCiAg dW5zaWduZWQgaW50ICAgajsKICB1bnNpZ25lZCBzaG9ydCBrOwogIHVuc2lnbmVkIGNoYXIgIGw7 CiAgdW5zaWduZWQgY2hhciAgbTsKICBzaWduZWQgICBjaGFyICBuOwp9CmFfbGluazsKCnR5cGVk ZWYgc3RydWN0IEZyZWVMaXN0U3RydWN0CnsKICBpbnQgICAgICAgZHVtbXk7CiAgc3RydWN0IEZy ZWVMaXN0U3RydWN0ICpuZXh0Owp9IEZyZWVMaXN0OwoKc3RydWN0IGxpc3Rfd2l0aF9GcmVlTGlz dAp7CiAgaW50IGR1bW15OwogIGludCBkdW1teTI7CiAgRnJlZUxpc3QgICAgICAgICp2b2xhdGls ZSBydEZyZWVMaXN0OyAvKiA8LS0gVm9sYXRpbGUgdHJpZ2dlcnMgdGhlIGJ1Zy4gKi8KfTsKCnN0 cnVjdCBsaXN0X3dpdGhfRnJlZUxpc3QgbGw7CgpzdGF0aWMgYV9saW5rICpmb3JjZV9nY2NfcHBj X2J1Zyh2b2lkKTsKCnN0YXRpYwphX2xpbmsgKmZvcmNlX2djY19wcGNfYnVnKHZvaWQpCnsKICBG cmVlTGlzdCAqZnJlZU5vZGU7CiAgYV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