[Bug tree-optimization/15347] [tree-ssa] fold if ("<12ers" + 1 == 0).
kazu at cs dot umass dot edu
gcc-bugzilla@gcc.gnu.org
Tue Jun 1 06:45:00 GMT 2004
------- Additional Comments From kazu at cs dot umass dot edu 2004-06-01 06:45 -------
Now that Steven's strchr patch is in, let me reiterate the problem.
void bar (void);
void
foo (void)
{
int c = '1';
if (strchr ("<12ers", c) == 0)
bar ();
}
void
baz (void)
{
int c = '1';
if ("<12ers" + 1 == 0)
bar ();
}
The last tree-ssa form looks like:
;; Function foo (foo)
foo ()
{
int c;
char * T.0;
<bb 0>:
T.0_2 = "<12ers" + 1B;
if (T.0_2 == 0B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
;; Function baz (baz)
baz ()
{
int c;
<bb 0>:
if ("<12ers" == -1B) goto <L0>; else goto <L1>;
<L0>:;
bar () [tail call];
<L1>:;
return;
}
In either case, we miss the folding opportunity.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15347
More information about the Gcc-bugs
mailing list