public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/14627] New: [tree-ssa] extra assignment inserted
@ 2004-03-18  3:48 dann at godzilla dot ics dot uci dot edu
  2004-03-18  4:08 ` [Bug optimization/14627] " pinskia at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: dann at godzilla dot ics dot uci dot edu @ 2004-03-18  3:48 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2005-04-24 19:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-18  3:48 [Bug optimization/14627] New: [tree-ssa] extra assignment inserted dann at godzilla dot ics dot uci dot edu
2004-03-18  4:08 ` [Bug optimization/14627] " pinskia at gcc dot gnu dot org
2004-03-18 18:39 ` dann at godzilla dot ics dot uci dot edu
2004-03-23 16:07 ` steven at gcc dot gnu dot org
2004-03-23 20:12 ` [Bug optimization/14627] [tree-ssa] extra assignment inserted on the tree level pinskia at gcc dot gnu dot org
2004-05-24 18:50 ` [Bug tree-optimization/14627] " pinskia at gcc dot gnu dot org
2005-03-19 18:58 ` steven at gcc dot gnu dot org
2005-03-19 19:33 ` steven at gcc dot gnu dot org
2005-03-20  0:58 ` [Bug tree-optimization/14627] [4.0/4.1 regression] " steven at gcc dot gnu dot org
2005-03-21 15:57 ` amacleod at redhat dot com
2005-03-21 16:51 ` stevenb at suse dot de
2005-03-21 17:20 ` law at redhat dot com
2005-03-21 17:22 ` law at redhat dot com
2005-04-13  4:55 ` law at redhat dot com
2005-04-24 14:22 ` steven at gcc dot gnu dot org
2005-04-24 14:23 ` pinskia at gcc dot gnu dot org
2005-04-24 15:31 ` law at redhat dot com
2005-04-24 19:13 ` dberlin at dberlin dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).