This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18892] missed optimization with & and ==
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2004 07:19:57 -0000
- Subject: [Bug tree-optimization/18892] missed optimization with & and ==
- References: <20041208201526.18892.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-11 07:19 -------
(In reply to comment #5)
> (In reply to comment #4)
> > when I compile this program with mainline. Isnt this what you claimed it should
> > be compiled to? or are you claiming it should be optimized to 'return 0'?
>
> I am claiming it should be compiled to "return 0". The full testcase which is closer to
> what shows up in GCC is:
>
> void f(int a)
> {
> int i = a & -129;
> if (i == 144)
> link_error ();
> }
The testcase works but for the wrong reason (we call fold for COND_EXPR after out of ssa because
of tree_cleanup_cfg).
Here is a testcase which fails though:
void g(int) __attribute__((noinline);
void g(int a) { a+=2; }
void f(int a)
{
int i = a & -129;
g(i);
if (i == 144)
link_error ();
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18892