public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/104247] New: Compiler warnings on 32-bit system
@ 2022-01-26 16:37 marxin at gcc dot gnu.org
  2022-01-27 11:46 ` [Bug analyzer/104247] " cvs-commit at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-26 16:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104247
           Summary: Compiler warnings on 32-bit system
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

I noticed these and similar warnings when building the current master on
i686-linux-gnu:

../../gcc/analyzer/constraint-manager.cc: In member function ‘void
ana::bounded_ranges_manager::log_stats(ana::logger*, bool) const’:
../../gcc/analyzer/constraint-manager.cc:1027:27: warning: format ‘%li’ expects
argument of type ‘long int’, but argument 4 has type ‘size_t’ {aka ‘unsigned
int’} [-Wformat=]
 1027 |   logger->log ("  # %s: %li", "ranges", m_map.elements ());
      |                         ~~^             ~~~~~~~~~~~~~~~~~
      |                           |                            |
      |                           long int                     size_t {aka
unsigned int}
      |                         %i
g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include
-I../../gcc/../libcpp/include -I../../gcc/../libcody 
-I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber
-I../../gcc/../libbacktrace   -o x86-tune-sched-atom.o -MT
x86-tune-sched-atom.o -MMD -MP -MF ./.deps/x86-tune-sched-atom.TPo
../../gcc/config/i386/x86-tune-sched-atom.cc
g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include
-I../../gcc/../libcpp/include -I../../gcc/../libcody 
-I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber
-I../../gcc/../libbacktrace   -o x86-tune-sched-core.o -MT
x86-tune-sched-core.o -MMD -MP -MF ./.deps/x86-tune-sched-core.TPo
../../gcc/config/i386/x86-tune-sched-core.cc
g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include
-I../../gcc/../libcpp/include -I../../gcc/../libcody 
-I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber
-I../../gcc/../libbacktrace   -o i386-options.o -MT i386-options.o -MMD -MP -MF
./.deps/i386-options.TPo ../../gcc/config/i386/i386-options.cc
g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC    -fno-exceptions -fno-rtti
-fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings
-Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic
-Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common 
-DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include
-I../../gcc/../libcpp/include -I../../gcc/../libcody 
-I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber
-I../../gcc/../libbacktrace   -o i386-builtins.o -MT i386-builtins.o -MMD -MP
-MF ./.deps/i386-builtins.TPo ../../gcc/config/i386/i386-builtins.cc
../../gcc/analyzer/region-model-manager.cc: In instantiation of ‘void
ana::log_uniq_map(ana::logger*, bool, const char*, const hash_map<K, T*>&)
[with K = tree_node*; T = ana::constant_svalue]’:
../../gcc/analyzer/region-model-manager.cc:1626:16:   required from here
../../gcc/analyzer/region-model-manager.cc:1576:27: warning: format ‘%li’
expects argument of type ‘long int’, but argument 4 has type ‘size_t’ {aka
‘unsigned int’} [-Wformat=]
 1576 |   logger->log ("  # %s: %li", title, uniq_map.elements ());
      |                         ~~^          ~~~~~~~~~~~~~~~~~~~~
      |                           |                            |
      |                           long int                     size_t {aka
unsigned int}
      |                         %i
../../gcc/analyzer/region-model-manager.cc: In instantiation of ‘void
ana::log_uniq_map(ana::logger*, bool, const char*, const hash_map<K, T*>&)
[with K = tree_node*; T = ana::unknown_svalue]’:
../../gcc/analyzer/region-model-manager.cc:1627:16:   required from here
../../gcc/analyzer/region-model-manager.cc:1576:27: warning: format ‘%li’
expects argument of type ‘long int’, but argument 4 has type ‘size_t’ {aka
‘unsigned int’} [-Wformat=]
 1576 |   logger->log ("  # %s: %li", title, uniq_map.elements ());
      |                         ~~^          ~~~~~~~~~~~~~~~~~~~~
      |                           |                            |
      |                           long int                     size_t {aka
unsigned int}
      |                         %i
...

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

* [Bug analyzer/104247] Compiler warnings on 32-bit system
  2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
@ 2022-01-27 11:46 ` cvs-commit at gcc dot gnu.org
  2022-01-27 11:47 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-27 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:3989337e1e1e334bb6d6db5d441c751d0b9ae2e1

commit r12-6892-g3989337e1e1e334bb6d6db5d441c751d0b9ae2e1
Author: Martin Liska <mliska@suse.cz>
Date:   Thu Jan 27 12:41:16 2022 +0100

    analyzer: fix -Wformat warnings on i686

            PR analyzer/104247

    gcc/analyzer/ChangeLog:

            * constraint-manager.cc (bounded_ranges_manager::log_stats):
            Cast to long for format purpose.
            * region-model-manager.cc (log_uniq_map): Likewise.

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

* [Bug analyzer/104247] Compiler warnings on 32-bit system
  2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
  2022-01-27 11:46 ` [Bug analyzer/104247] " cvs-commit at gcc dot gnu.org
@ 2022-01-27 11:47 ` marxin at gcc dot gnu.org
  2022-01-27 13:38 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-27 11:47 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

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

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed.

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

* [Bug analyzer/104247] Compiler warnings on 32-bit system
  2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
  2022-01-27 11:46 ` [Bug analyzer/104247] " cvs-commit at gcc dot gnu.org
  2022-01-27 11:47 ` marxin at gcc dot gnu.org
@ 2022-01-27 13:38 ` dmalcolm at gcc dot gnu.org
  2022-02-03  4:38 ` egallager at gcc dot gnu.org
  2022-02-03  8:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-01-27 13:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks!

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

* [Bug analyzer/104247] Compiler warnings on 32-bit system
  2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-01-27 13:38 ` dmalcolm at gcc dot gnu.org
@ 2022-02-03  4:38 ` egallager at gcc dot gnu.org
  2022-02-03  8:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-02-03  4:38 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Gallager <egallager at gcc dot gnu.org> changed:

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

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
Instead of casting to long, wouldn't it be better just to use the proper format
for size_t, i.e. %zu?

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

* [Bug analyzer/104247] Compiler warnings on 32-bit system
  2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-02-03  4:38 ` egallager at gcc dot gnu.org
@ 2022-02-03  8:43 ` marxin at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-03  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
/home/marxin/Programming/gcc/gcc/analyzer/region-model-manager.cc: In
instantiation of ‘void ana::log_uniq_map(ana::logger*, bool, const char*, const
hash_map<K, T*>&) [with K = tree_node*; T = ana::string_region]’:
/home/marxin/Programming/gcc/gcc/analyzer/region-model-manager.cc:1684:16:  
required from here
/home/marxin/Programming/gcc/gcc/analyzer/region-model-manager.cc:1595:26:
warning: unknown conversion type character ‘z’ in format [-Wformat=]
 1595 |   logger->log ("  # %s: %zu", title, uniq_map.elements ());
      |                          ^
/home/marxin/Programming/gcc/gcc/analyzer/region-model-manager.cc:1595:16:
warning: too many arguments for format [-Wformat-extra-args]
 1595 |   logger->log ("  # %s: %zu", title, uniq_map.elements ());
      |                ^~~~~~~~~~~~~

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

end of thread, other threads:[~2022-02-03  8:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-26 16:37 [Bug analyzer/104247] New: Compiler warnings on 32-bit system marxin at gcc dot gnu.org
2022-01-27 11:46 ` [Bug analyzer/104247] " cvs-commit at gcc dot gnu.org
2022-01-27 11:47 ` marxin at gcc dot gnu.org
2022-01-27 13:38 ` dmalcolm at gcc dot gnu.org
2022-02-03  4:38 ` egallager at gcc dot gnu.org
2022-02-03  8:43 ` marxin 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).