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

            Bug ID: 127902
           Summary: clang warning -Wsometimes-uninitialized for
                    tree-ssa-forwprop.cc:3526:
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Today's build of gcc trunk with clang says:

trunk/gcc/tree-ssa-forwprop.cc:3526:12: warning: variable 'zero_ok' is use
d uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]

Source code is

  bool zero_ok;
  if (fn == IFN_CTZ)
    {
      ctz_val = 0;
      zero_ok = CTZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (input_type),
                       ctz_val) == 2;
    }
  else if (fn == IFN_CLZ)
    {
      ctz_val = 32;
      zero_ok = CLZ_DEFINED_VALUE_AT_ZERO (SCALAR_INT_TYPE_MODE (input_type),
                       ctz_val) == 2;
      zero_val = input_bits - 1 - zero_val;
    }

Suggest either add an initialiser for zero_ok or provide
an else clause.

Reply via email to