From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32398 invoked by alias); 28 Sep 2002 23:56: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 32370 invoked by uid 71); 28 Sep 2002 23:56:01 -0000 Date: Sat, 28 Sep 2002 16:56:00 -0000 Message-ID: <20020928235601.32361.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Bruce Korb Subject: Re: c/8083: GCC 3.2 Optimization bug Reply-To: Bruce Korb X-SW-Source: 2002-09/txt/msg00805.txt.bz2 List-Id: The following reply was made to PR c/8083; it has been noted by GNATS. From: Bruce Korb To: gcc-gnats@gcc.gnu.org, bkorb@gnu.org Cc: Subject: Re: c/8083: GCC 3.2 Optimization bug Date: Sat, 28 Sep 2002 16:55:18 -0700 The following diff of the routine works, so clearly it is an aliasing optimization issue. It looks like the optimizer presumesthat "list" is not modified by the line: *ppT = pDef; *However*, since "ppT" is explicitly set to point to "list", it is clearly an alias and not one to be optimized away. diff -u -r3.7 defReduce.c --- defReduce.c 15 Jun 2002 18:24:59 -0000 3.7 +++ defReduce.c 28 Sep 2002 23:32:03 -0000 @@ -121,9 +121,10 @@ YYSTYPE def, YYSTYPE list ) { + tDefEntry* ret = (tDefEntry*)list; tDefEntry* pDef = (tDefEntry*)def; - tDefEntry* pScn = (tDefEntry*)list; - tDefEntry** ppT = (tDefEntry**)&list; + tDefEntry* pScn = ret; + tDefEntry** ppT = &ret; for (;;) { if (strcmp( pDef->pzDefName, pScn->pzDefName ) == 0) { @@ -166,9 +169,8 @@ * THEN put the new entry at the start of the list */ if (pScn->pNext == NULL) { - pDef->pNext = (tDefEntry*)list; - list = def; + ret = (tDefEntry*)def; break; } @@ -181,7 +183,7 @@ pScn = pScn->pNext; } - return list; + return (YYSTYPE)ret; }