This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/22321] [4.0/4.1 Regression] &volatile_var != &volatile_var is always true
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2005 21:58:27 -0000
- Subject: [Bug middle-end/22321] [4.0/4.1 Regression] &volatile_var != &volatile_var is always true
- References: <20050706093241.22321.paul.woegerer@nsc.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From law at redhat dot com 2005-07-09 21:58 -------
Subject: Re: [4.0/4.1 Regression] &volatile_var !=
&volatile_var is always true
On Sat, 2005-07-09 at 17:58 +0000, pinskia at gcc dot gnu dot org wrote:
> ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-09 17:58 -------
> This fails also at -O0:
> volatile int x;
>
> int main()
> {
> if (&x != &x)
> abort ();
> return 0;
> }
>
> And this testcase worked in 3.4.x too so this is defintely a fold bug.
It's a bug in how the folder uses operand_equal_p. operand_equal_p is
not equivalent to a C equality test, but fold_binary is using it to
evaluate a C equality test and thus getting the wrong results.
I've got a patch ready to go, but won't get it checked in until Monday
or possibly even Tuesday depending on some personal commitments.
jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22321