[Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 18 21:07:12 GMT 2023


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|tree-ssa-loop-niter.cc:2255 |[13 Regression]
                   |:23: warning: variable      |tree-ssa-loop-niter.cc:2255
                   |'mode' set but not used     |:23: warning: variable
                   |                            |'mode' set but not used
          Component|bootstrap                   |tree-optimization
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |build
   Target Milestone|---                         |13.0
   Last reconfirmed|                            |2023-01-18

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Basically C[TL]Z_DEFINED_VALUE_AT_ZERO macro does not always use its arguments
so they don't get marked as used ...

Simple patch:

diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index 65b960461ae..22e7c0f6ea5 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -2253,6 +2253,8 @@ build_cltz_expr (tree src, bool leading, bool
define_at_zero)
                                           integer_type_node, 1, src);
       int val;
       scalar_int_mode mode = SCALAR_INT_TYPE_MODE (utype);
+      /* mode might not be used by the macro C[TL]Z_DEFINED_AT_ZERO. */
+      (void)mode;
       int optab_defined_at_zero
        = leading ? CLZ_DEFINED_VALUE_AT_ZERO (mode, val)
                  : CTZ_DEFINED_VALUE_AT_ZERO (mode, val);


More information about the Gcc-bugs mailing list