This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/8083: GCC 3.2 Optimization bug


The following reply was made to PR c/8083; it has been noted by GNATS.

From: Bruce Korb <bkorb@pacbell.net>
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;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]