[Bug tree-optimization/67196] Another false positive from -Wmaybe-uninitialized

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 12 20:26:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67196

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-08-12
                 CC|                            |manu at gcc dot gnu.org
             Blocks|                            |24639
     Ever confirmed|0                           |1

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
For some reason, the uninit pass does not even analyze the predicates and
thinks all uses are unguarded (or it doesn't dump it).

A shorter testcase:

int some_test(int);

int test (int n)
{
  int num_captions_in_row = 0;
  int first_caption = 0; /* set to zero here */
  int first_caption_idx;
  int i;
  for (i = 0; i < n; i++)
    {
      if (some_test (i))
        {
          num_captions_in_row++;
          first_caption = 1; /* only ever set here */
          first_caption_idx = i; /* set here */
        }
    }

  /* The guard on "first_caption" here requires we entered the block
     above that sets "first_caption_idx". */
  if (first_caption && num_captions_in_row == 1)
    return first_caption_idx; /* get bogus warning here at -O1 and above */
  return 0;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639
[Bug 24639] [meta-bug] bug to track all Wuninitialized issues


More information about the Gcc-bugs mailing list