This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/14627] New: [tree-ssa] extra assignment inserted
- From: "dann at godzilla dot ics dot uci dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Mar 2004 03:48:48 -0000
- Subject: [Bug optimization/14627] New: [tree-ssa] extra assignment inserted
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This function:
int foo (int count, int *valid, int *test_val, int val)
{
int i;
int one_valid = 0;
for (i = 0; i < count; i++)
{
if (valid[i] && (test_val[i] == val))
return i;
else
if (!one_valid && valid[i])
one_valid = 1;
}
if (one_valid)
return -2;
return -1;
}
should not have a "one_valid = 0" assignment in the loop, but it does, see
the .vars dump:
int one_valid;
int i;
int T.4;
int * T.2;
<bb 0>:
if (count > 0) goto <L25>; else goto <L12>;
<L25>:;
i = 0;
one_valid = 0;
<L0>:;
T.2 = (int *)((unsigned int)i * 4);
T.4 = *(T.2 + valid);
if (T.4 == 0) goto <L3>; else goto <L1>;
<L1>:;
if (*(T.2 + test_val) != val) goto <L3>; else goto <L2>;
<L2>:;
return i;
<L3>:;
if (one_valid == 0) goto <L4>; else goto <L6>;
<L4>:;
if (T.4 != 0) goto <L5>; else goto <L26>;
<L26>:;
one_valid = 0;
goto <bb 7> (<L6>);
<L5>:;
one_valid = 1;
<L6>:;
i = i + 1;
if (i < count) goto <L0>; else goto <L10>;
<L10>:;
if (one_valid != 0) goto <L11>; else goto <L12>;
<L11>:;
return -2;
<L12>:;
return -1;
--
Summary: [tree-ssa] extra assignment inserted
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14627