public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
@ 2023-01-18 20:57 danglin at gcc dot gnu.org
  2023-01-18 21:07 ` [Bug tree-optimization/108457] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: danglin at gcc dot gnu.org @ 2023-01-18 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108457
           Summary: tree-ssa-loop-niter.cc:2255:23: warning: variable
                    'mode' set but not used
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: danglin at gcc dot gnu.org
  Target Milestone: ---
              Host: hppa64-hp-hpux11.11
            Target: hppa64-hp-hpux11.11
             Build: hppa64-hp-hpux11.11

g++ -std=c++11  -fno-PIE -c   -g -DIN_GCC     -fno-exceptions -fno-rtti
-fasynch
ronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wno-fo
rmat -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual
-
pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings  
-DHAVE_CO
NFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include 
-I.
./../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libcody
-I/opt/gnu64/gcc/gmp/i
nclude  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd
-I..
/libdecnumber -I../../gcc/gcc/../libbacktrace -I/opt/gnu64/gcc/gmp/include  -o
t
ree-ssa-loop-niter.o -MT tree-ssa-loop-niter.o -MMD -MP -MF
./.deps/tree-ssa-loo
p-niter.TPo ../../gcc/gcc/tree-ssa-loop-niter.cc
../../gcc/gcc/tree-ssa-loop-niter.cc: In function 'tree_node*
build_cltz_expr(tr
ee, bool, bool)':
../../gcc/gcc/tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but
n
ot used [-Wunused-but-set-variable]
 2255 |       scalar_int_mode mode = SCALAR_INT_TYPE_MODE (utype);
      |                       ^~~~

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
@ 2023-01-18 21:07 ` pinskia at gcc dot gnu.org
  2023-01-18 21:19 ` dave.anglin at bell dot net
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-18 21:07 UTC (permalink / raw)
  To: gcc-bugs

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);

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
  2023-01-18 21:07 ` [Bug tree-optimization/108457] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-01-18 21:19 ` dave.anglin at bell dot net
  2023-01-19 12:06 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dave.anglin at bell dot net @ 2023-01-18 21:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from dave.anglin at bell dot net ---
On 2023-01-18 4:07 p.m., pinskia at gcc dot gnu.org wrote:
> Basically C[TL]Z_DEFINED_VALUE_AT_ZERO macro does not always use its arguments
> so they don't get marked as used ...
Yes.  PA uses the default defines for these macros.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
  2023-01-18 21:07 ` [Bug tree-optimization/108457] [13 Regression] " pinskia at gcc dot gnu.org
  2023-01-18 21:19 ` dave.anglin at bell dot net
@ 2023-01-19 12:06 ` jakub at gcc dot gnu.org
  2023-01-19 12:23 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-19 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Space between cast and mode.
Though I think various other uses of these macros solve this by simply using
SCALAR_INT_TYPE_MODE (utype) directly as argument to those macros rather than
using a temporary variable.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-01-19 12:06 ` jakub at gcc dot gnu.org
@ 2023-01-19 12:23 ` jakub at gcc dot gnu.org
  2023-01-19 14:16 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-19 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54307
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54307&action=edit
gcc13-pr108457.patch

So I'd prefer this instead.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-01-19 12:23 ` jakub at gcc dot gnu.org
@ 2023-01-19 14:16 ` pinskia at gcc dot gnu.org
  2023-01-20  9:24 ` cvs-commit at gcc dot gnu.org
  2023-01-20  9:29 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-19 14:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #3)
> Space between cast and mode.
> Though I think various other uses of these macros solve this by simply using
> SCALAR_INT_TYPE_MODE (utype) directly as argument to those macros rather than
> using a temporary variable.

I am ok with that too. This was just a quick patch to try to help to get it
unstuck ...

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-01-19 14:16 ` pinskia at gcc dot gnu.org
@ 2023-01-20  9:24 ` cvs-commit at gcc dot gnu.org
  2023-01-20  9:29 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-20  9:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:16bd9e14f226e07bf0ffb9d68084c9ad69bf7b45

commit r13-5268-g16bd9e14f226e07bf0ffb9d68084c9ad69bf7b45
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 20 10:23:49 2023 +0100

    niter: Fix up unused var warning [PR108457]

    tree-ssa-loop-niter.cc (build_cltz_expr) gets unused variable mode
    warning on some architectures where C[LT]Z_DEFINED_VALUE_AT_ZERO
    macro(s) don't use the first argument (which includes the
    defaults.h definitions of:
     #define CLZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0
     #define CTZ_DEFINED_VALUE_AT_ZERO(MODE, VALUE)  0
    Other uses of this macro avoid this problem by avoiding temporaries
    which are only used as argument to those macros, the following patch
    does it the same way for consistency.  Plus some formatting fixes
    while at it.

    2023-01-20  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/108457
            * tree-ssa-loop-niter.cc (build_cltz_expr): Use
            SCALAR_INT_TYPE_MODE (utype) directly as
C[LT]Z_DEFINED_VALUE_AT_ZERO
            argument instead of a temporary.  Formatting fixes.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug tree-optimization/108457] [13 Regression] tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used
  2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-01-20  9:24 ` cvs-commit at gcc dot gnu.org
@ 2023-01-20  9:29 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-20  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Should be fixed now.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-20  9:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-18 20:57 [Bug bootstrap/108457] New: tree-ssa-loop-niter.cc:2255:23: warning: variable 'mode' set but not used danglin at gcc dot gnu.org
2023-01-18 21:07 ` [Bug tree-optimization/108457] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-18 21:19 ` dave.anglin at bell dot net
2023-01-19 12:06 ` jakub at gcc dot gnu.org
2023-01-19 12:23 ` jakub at gcc dot gnu.org
2023-01-19 14:16 ` pinskia at gcc dot gnu.org
2023-01-20  9:24 ` cvs-commit at gcc dot gnu.org
2023-01-20  9:29 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).