public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/8083: GCC 3.2 Optimization bug
@ 2002-09-29 11:19 nathan
0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-09-29 11:19 UTC (permalink / raw)
To: bkorb, gcc-bugs, gcc-prs, nathan, nobody
Synopsis: GCC 3.2 Optimization bug
Responsible-Changed-From-To: unassigned->nathan
Responsible-Changed-By: nathan
Responsible-Changed-When: Sun Sep 29 11:19:54 2002
Responsible-Changed-Why:
implementing a type-punning warning
State-Changed-From-To: open->analyzed
State-Changed-By: nathan
State-Changed-When: Sun Sep 29 11:19:54 2002
State-Changed-Why:
not a bug. this is the std as she is writ.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8083
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c/8083: GCC 3.2 Optimization bug
@ 2002-10-01 12:22 nathan
0 siblings, 0 replies; 6+ messages in thread
From: nathan @ 2002-10-01 12:22 UTC (permalink / raw)
To: bkorb, gcc-bugs, gcc-prs, nathan
Synopsis: GCC 3.2 Optimization bug
State-Changed-From-To: analyzed->closed
State-Changed-By: nathan
State-Changed-When: Tue Oct 1 12:22:24 2002
State-Changed-Why:
2002-10-01 Nathan Sidwell <nathan@codesourcery.com>
PR c/8083
* c-typeck.c (build_c_cast): Warn about type punning which breaks
type based aliasing.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8083
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c/8083: GCC 3.2 Optimization bug
@ 2002-09-28 16:56 Bruce Korb
0 siblings, 0 replies; 6+ messages in thread
From: Bruce Korb @ 2002-09-28 16:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
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;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c/8083: GCC 3.2 Optimization bug
@ 2002-09-28 15:56 Bruce Korb
0 siblings, 0 replies; 6+ messages in thread
From: Bruce Korb @ 2002-09-28 15:56 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
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
Cc: bkorb@gnu.org
Subject: Re: c/8083: GCC 3.2 Optimization bug
Date: Sat, 28 Sep 2002 15:53:24 -0700
gcc-gnats@gcc.gnu.org wrote:
>
> Thank you very much for your problem report.
More data: It is specifically this routine:
YYSTYPE
addSibMacro(
YYSTYPE def,
YYSTYPE list )
{
tDefEntry* pDef = (tDefEntry*)def;
tDefEntry* pScn = (tDefEntry*)list;
tDefEntry** ppT = (tDefEntry**)&list;
for (;;) {
if (strcmp( pDef->pzDefName, pScn->pzDefName ) == 0) {
/*
* Make sure that two entries with the same name
* are of the same type.
*/
if (pDef->valType != pScn->valType) {
char* pz = asprintf( "macro named ``%s'' has two types",
pDef->pzDefName );
AG_ABEND( pz );
}
/*
* Link in the new head of the twin chain to the sibling list.
* If the twin list is the first sibling, then ppT points
* to the "list" variable. It will now be changed to return
* the value we need to return (the new head).
*/
pDef->pNext = pScn->pNext;
pScn->pNext = NULL;
*ppT = pDef;
/*
* Find the end of the twin list for the new eldest twin.
* Do this by setting a pointer to the place where we have
* to stash the pointer to the list. (We are not saving it.)
*/
for (ppT = &(pDef->pTwin);
*ppT != NULL;
ppT = &((*ppT)->pTwin) )
;
*ppT = pScn;
break;
}
/*
* IF we are at the end of the list,
* THEN put the new entry at the start of the list
*/
if (pScn->pNext == NULL) {
pDef->pNext = (tDefEntry*)list;
list = def;
break;
}
/*
* Check the next sibling for a twin value.
* If it is a twin, we will have to remember where
* we got the pointer so we can set a new value.
*/
ppT = &(pScn->pNext);
pScn = pScn->pNext;
}
return list;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c/8083: GCC 3.2 Optimization bug
@ 2002-09-28 15:06 Bruce Korb
0 siblings, 0 replies; 6+ messages in thread
From: Bruce Korb @ 2002-09-28 15:06 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/8083; it has been noted by GNATS.
From: Bruce Korb <bkorb@pacbell.net>
To: bkorb@gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
gcc-bugs@gcc.gnu.org
Cc:
Subject: Re: c/8083: GCC 3.2 Optimization bug
Date: Sat, 28 Sep 2002 15:10:06 -0700
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8083
The specific file with the problem is:
agen5/defReduce.c
By compiling that one module with optimization off, the program works.
^ permalink raw reply [flat|nested] 6+ messages in thread
* c/8083: GCC 3.2 Optimization bug
@ 2002-09-28 14:56 bkorb
0 siblings, 0 replies; 6+ messages in thread
From: bkorb @ 2002-09-28 14:56 UTC (permalink / raw)
To: gcc-gnats
>Number: 8083
>Category: c
>Synopsis: GCC 3.2 Optimization bug
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Sat Sep 28 14:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Bruce Korb
>Release: 3.2 2002-07-26 (prerelease)
>Organization:
GNU
>Environment:
System: Linux bach 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686
Stock SuSE 8.0 + cvs gcc-3_1-branch, configured as below.
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --enable-language=c --prefix=/home/gcc
>Description:
When compiled with -O2, autogen produces invalid results.
When compiled without a -O, the results are correct.
Therefore, the program behavior is different. I do not believe
I am using improperly aliased pointers.
>How-To-Repeat:
Download autogen-5.4.3, fix some #define redefinition issues that were not
bugs before gcc3.x and do a "make distcheck". (CVS version has this fixed.)
I will add to this as I narrow the issue.
>Fix:
None known, other than eliminating optimization.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-10-01 19:22 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-29 11:19 c/8083: GCC 3.2 Optimization bug nathan
-- strict thread matches above, loose matches on Subject: below --
2002-10-01 12:22 nathan
2002-09-28 16:56 Bruce Korb
2002-09-28 15:56 Bruce Korb
2002-09-28 15:06 Bruce Korb
2002-09-28 14:56 bkorb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).