From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5733 invoked by alias); 11 Sep 2002 15:06: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 5715 invoked by uid 71); 11 Sep 2002 15:06:00 -0000 Resent-Date: 11 Sep 2002 15:06:00 -0000 Resent-Message-ID: <20020911150600.5713.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, tabasso@tabasoft.it Received: (qmail 4314 invoked by uid 61); 11 Sep 2002 15:00:05 -0000 Message-Id: <20020911150005.4313.qmail@sources.redhat.com> Date: Wed, 11 Sep 2002 08:06:00 -0000 From: tabasso@tabasoft.it Reply-To: tabasso@tabasoft.it To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/7888: wrong code produced by GCC 3.1 X-SW-Source: 2002-09/txt/msg00188.txt.bz2 List-Id: >Number: 7888 >Category: c >Synopsis: wrong code produced by GCC 3.1 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Wed Sep 11 08:06:00 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Raul Tabasso >Release: gcc 3.1 >Organization: >Environment: MacOSX 1.2 with gcc 3.1 compiling with NO -o option >Description: The GCC compiler version 3.1 produce wrong code when declaring a register variable of type double. Suppressing the register statement avoids the problem. The register clause in line: "register double zero = 0" produce a wrong code when using this register variable in a statement like "*dblP++ = zero;" where "dblP" is a pointer to a double. The code will clear only the first 4 bytes and NOT 8 as it should be. >How-To-Repeat: // Code that cause the bug: void ClearBlock(void *blockP, int blockSize) { register double zero = 0; double *dblP = (double*)blockP; int step32 = blockSize / (sizeof(double) * 4); char *charP(char*)blockP; if (step32) { blockSize -= step32 * (sizeof(double) * 4); do { *dblP++ = zero; *dblP++ = zero; *dblP++ = zero; *dblP++ = zero; } while (--step32); charP = (char*)dblP; } if (blockSize) { do { *charP++ = 0; } while (--blockSize); } } >Fix: >Release-Note: >Audit-Trail: >Unformatted: