[Bug regression/49498] [4.7 Regression]: gcc.dg/uninit-pred-8_b.c bogus warning line 20

law at redhat dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 22 17:28:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49498

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.06.22 17:27:37
                 CC|                            |law at redhat dot com
     Ever Confirmed|0                           |1

--- Comment #2 from Jeffrey A. Law <law at redhat dot com> 2011-06-22 17:27:37 UTC ---
It looks like the uninit code is being confused by elimination of a test in one
path. 

int foo (int n, int l, int m, int r)
{
  int v;

  if (n < 10 || m > 100 || r < 20 || l)
    v = r;

  if (m) g++;
  else   bar();

  if ( n < 10 ||  m > 100 || r < 20 )
      blah(v); /* { dg-bogus "uninitialized" "bogus warning" } */

  return 0;
}


We end up copying the n < 10 test from the 3rd conditional into the m == 0 path
of the second conditional and threading the false path from the copied
conditional to the r < 20 test (ie, we bypass the m > 100 test as it always
false on that path where m == 0.

This appears to confuse the predicate analysis in tree-ssa-uninit.c.  I'm still
trying to wrap my head around its implementation to see if there's a reasonable
way to solve this.



More information about the Gcc-bugs mailing list