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

            Bug ID: 122886
           Summary: rust/backend/rust-constexpr.cc:3141: Possible uninit
                    local variable ?
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rust
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
                CC: dkm at gcc dot gnu.org, gcc-rust at gcc dot gnu.org,
                    pierre-emmanuel.patry at embecosm dot com
  Target Milestone: ---

I had another go at compiling the Rust compiler with clang
and got the following:

rust/backend/rust-constexpr.cc:3141:8: warning: variable 'eq' is 
used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]

Source code is

          bool eq;
          if (TREE_CODE (lmem) == TREE_CODE (rmem)
              && TREE_CODE (lmem) == FIELD_DECL
              && TREE_CODE (DECL_CONTEXT (lmem)) == UNION_TYPE
              && same_type_p (DECL_CONTEXT (lmem), DECL_CONTEXT (rmem)))
            /* If both refer to (possibly different) members of the same union
               (12.3), they compare equal. */
            eq = true;
          // else
          //   eq = cp_tree_equal (lhs, rhs);
          r = constant_boolean_node (eq == is_code_eq, type);

it might be wise to init local variable eq at its declaration.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to