Bug 4520 - cselib.c hash_rtx incorrectly hashes based on rtx address
Summary: cselib.c hash_rtx incorrectly hashes based on rtx address
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: 4.0.4
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 07:56 UTC by David Edelsohn
Modified: 2006-09-19 23:05 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.1.2 4.0.4 4.2.0
Known to fail: 4.1.1 4.0.3
Last reconfirmed: 2005-12-24 20:38:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edelsohn 2001-10-10 07:56:00 UTC
cselib.c hash_rtx hashes based on the address of a symbol
or label instead of the contents, assuming that a
symbol will be unique and only appear once.  Hashing based
on the address of internal GCC data structures can produce
non-deterministic results.

Release:
3.1 (experimental)

Environment:
powerpc-ibm-aix4.3
Comment 1 David Edelsohn 2001-10-10 07:56:00 UTC
Fix:
Work-around error by not applying ggc_strdup() to symbols
in rs6000.c which covers up the design mistake.
Comment 2 Wolfgang Bangerth 2002-12-21 09:04:44 UTC
State-Changed-From-To: open->feedback
State-Changed-Why: David, you probably have more insight into these things than
    me, but I know that some of these address-hashing things
    have been purged. Is this particular report still valid?
    
    Thanks
      Wolfgang
Comment 3 Wolfgang Bangerth 2002-12-21 10:29:40 UTC
State-Changed-From-To: feedback->open
State-Changed-Why: Probably still exists. Thanks for the quick feedback, David!
    
    W.
Comment 4 David Edelsohn 2002-12-21 13:22:13 UTC
From: David Edelsohn <dje@watson.ibm.com>
To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   john@feith.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc: Geoff Keating <geoffk@geoffk.org>
Subject: Re: other/4520: cselib.c hash_rtx incorrectly hashes based on rtx address 
Date: Sat, 21 Dec 2002 13:22:13 -0500

 >>>>> bangerth  writes:
 
 Wolfgang> David, you probably have more insight into these things than
 Wolfgang> me, but I know that some of these address-hashing things
 Wolfgang> have been purged. Is this particular report still valid?
     
 	As far as I can tell, the incorrect hashing of addresses of
 LABEL_REFS and SYMBOL_REFS in cselib.c:hash_rtx() has not been corrected.
 The failure is dormant, but I am not sure how it affects PCH restore
 state. 
 
 David
Comment 5 Geoff Keating 2002-12-21 22:56:59 UTC
From: Geoff Keating <geoffk@geoffk.org>
To: dje@watson.ibm.com
Cc: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   john@feith.com, nobody@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: other/4520: cselib.c hash_rtx incorrectly hashes based on rtx address
Date: Sat, 21 Dec 2002 22:56:59 -0800

 > Cc: Geoff Keating <geoffk@geoffk.org>
 > Date: Sat, 21 Dec 2002 13:22:13 -0500
 > From: David Edelsohn <dje@watson.ibm.com>
 > X-OriginalArrivalTime: 21 Dec 2002 18:22:33.0209 (UTC) FILETIME=[EE029E90:01C2A91D]
 > 
 > >>>>> bangerth  writes:
 > 
 > Wolfgang> David, you probably have more insight into these things than
 > Wolfgang> me, but I know that some of these address-hashing things
 > Wolfgang> have been purged. Is this particular report still valid?
 >     
 > 	As far as I can tell, the incorrect hashing of addresses of
 > LABEL_REFS and SYMBOL_REFS in cselib.c:hash_rtx() has not been corrected.
 > The failure is dormant, but I am not sure how it affects PCH restore
 > state. 
 
 cselib.c isn't active when PCH files are saved, so nothing in cselib.c
 affects PCH.
 
 -- 
 - Geoffrey Keating <geoffk@geoffk.org>
Comment 6 Andrew Pinski 2003-05-23 20:07:24 UTC
The problem still exists in 3.4.
Comment 7 Andrew Pinski 2003-05-24 00:52:54 UTC
confirmed on mainline (20030523).
Comment 8 Andrew Pinski 2005-01-13 00:59:11 UTC
Also if we use the address we more likely to have an unstable hastable in we can get a miscompare if 
we get different address across compilination.
Comment 9 Roger Sayle 2006-09-12 16:02:44 UTC
Subject: Bug 4520

Author: sayle
Date: Tue Sep 12 16:02:31 2006
New Revision: 116891

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=116891
Log:

	PR middle-end/4520
	PR bootstrap/28784
	* cselib.c (cselib_hash_rtx): Avoid hashing on the address of labels
	and symbols.  Instead use the implementation from cse.c's hash_rtx.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cselib.c

Comment 10 Andrew Pinski 2006-09-12 17:11:44 UTC
Fixed, finally.
Comment 11 Roger Sayle 2006-09-18 22:56:52 UTC
Subject: Bug 4520

Author: sayle
Date: Mon Sep 18 22:56:44 2006
New Revision: 117042

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117042
Log:

	PR middle-end/4520
	Backport from mainline
	* cselib.c (cselib_hash_rtx): Avoid hashing on the address of labels
	and symbols.  Instead use the implementation from cse.c's hash_rtx.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/cselib.c

Comment 12 Roger Sayle 2006-09-19 21:25:38 UTC
Subject: Bug 4520

Author: sayle
Date: Tue Sep 19 21:25:28 2006
New Revision: 117062

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117062
Log:

	PR middle-end/4520
	Backport from mainline
	* cselib.c (cselib_hash_rtx): Avoid hashing on the address of labels
	and symbols.  Instead use the implementation from cse.c's hash_rtx.


Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/cselib.c