From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10460 invoked by alias); 14 Nov 2001 12:26: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 10403 invoked by uid 71); 14 Nov 2001 12:26:01 -0000 Resent-Date: 14 Nov 2001 12:26:01 -0000 Resent-Message-ID: <20011114122601.10402.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, ahelm@gmx.net Received:(qmail 7439 invoked by uid 61); 14 Nov 2001 12:20:32 -0000 Message-Id:<20011114122032.7438.qmail@sourceware.cygnus.com> Date: Fri, 02 Nov 2001 09:16:00 -0000 From: ahelm@gmx.net Reply-To: ahelm@gmx.net To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:gnatsweb-2.9.2 (1.1.1.1.2.21) Subject: optimization/4875: Optimiser produces incorrect code for i386 platforms X-SW-Source: 2001-11/txt/msg00066.txt.bz2 List-Id: >Number: 4875 >Category: optimization >Synopsis: Optimiser produces incorrect code for i386 platforms >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Wed Nov 14 04:26:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Anton Helm >Release: gcc v3.0.2 >Organization: >Environment: gcc v3.0.2 Exactly the same behaviour using DJGPP and Linux version. >Description: When running the attached program compiled with any optimisation level greater than 0 the results are incorrect. Hexadecimal output of the variable s suggests that an incorrect sign extension is performed. I.e. the 32 high bits of s are set to 1 when assigning a positive long or long long literal to a long long variable. The behaviour has been verified with gcc 3.0.2 on PC/WinNT with DJGPP and on Linux. Both show the incorrect results. I don't have any detailed information on the two Linux systems used to verify the problem because I didn't run the tests there myself. I only know that one was a SUSE and the other a Redhat distribution. gcc v3.0.2 on Solaris v2.6 doesn't show this error. >How-To-Repeat: gcc -Wall o.c gcc -Wall -O2 o.c Run both executables and compare output. >Fix: Do not use any optimisation :-( >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: application/x-unknown-content-type-PFE32; name="O.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="O.c" I2luY2x1ZGUgPHN0ZGlvLmg+DQoNCmNvbnN0IGludCBhWzEwXSA9IHstMSwgMSwgMCwgMSwgLTEs IC0xLCAxLCAwLCAtMSwgLTF9Ow0KDQppbnQgbWFpbih2b2lkKQ0Kew0KICBsb25nIGxvbmcgczsN CiAgaW50IGk7DQoNCiAgZm9yKGk9MDtpPDEwO2krKykNCiAgew0KICAgIHMgPSBhW2ldOw0KICAg IGlmKHM8MCkNCiAgICB7DQogICAgICBzID0gLTIxNDc0ODM2NDhMTDsNCiAgICB9DQogICAgZWxz ZQ0KICAgIHsNCiAgICAgIHMgPSAyMTQ3NDgzNjQ3TEw7DQogICAgfQ0KICAgIGZwcmludGYoc3Rk ZXJyLCAiJWxsZCAlMDE2bGx4XG4iLCBzLCBzKTsNCiAgfQ0KDQogIHJldHVybiAwOw0KfQ0K