public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
@ 2023-02-02 20:10 jdx at o2 dot pl
  2023-02-02 20:26 ` [Bug other/108644] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jdx at o2 dot pl @ 2023-02-02 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108644
           Summary: Format string warnings related to longs under
                    MigW-W64/MSYS2 on Windows 10
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jdx at o2 dot pl
  Target Milestone: ---
              Host: x86_64-w64-mingw32
             Build: x86_64-w64-mingw32

Below are three excerpts from my gcc's build log. I believe that all these
warnings are caused by the fact that on Windows (at least x86_64 Win 10, but
AFAIR it applies to all versions) sizeof(long) = 4. The warnings do not appear
on a x86_64 Linux, where sizeof(long) = 8. I think that some of the warnings
could be fixed by using size_t and %zu format string instead of long and %l.



make[3]: Entering directory '/d/Works/xcomp/gcc-build/lto-plugin'
/bin/sh ./libtool  --tag=CC --tag=disable-static  --mode=compile gcc
-DHAVE_CONFIG_H -I. -I../../../gcc/lto-plugin 
-I../../../gcc/lto-plugin/../include -DHAVE_CONFIG_H  -Wall 
-DBASE_VERSION='"13.0.1"' -g -O2 -c -o lto-plugin.lo
../../../gcc/lto-plugin/lto-plugin.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../gcc/lto-plugin
-I../../../gcc/lto-plugin/../include -DHAVE_CONFIG_H -Wall
-DBASE_VERSION=\"13.0.1\" -g -O2 -c ../../../gcc/lto-plugin/lto-plugin.c 
-DDLL_EXPORT -DPIC -o .libs/lto-plugin.o
../../../gcc/lto-plugin/lto-plugin.c: In function 'dump_symtab':
../../../gcc/lto-plugin/lto-plugin.c:501:19: warning: 'I' flag used with '%x'
gnu_printf format [-Wformat=]
  501 |       fprintf (f, "%u %" PRI_LL "x %s %s\n",
      |                   ^~~~~~
../../../gcc/lto-plugin/lto-plugin.c:501:34: note: format string is defined
here
  501 |       fprintf (f, "%u %" PRI_LL "x %s %s\n",
      |                                  ^
../../../gcc/lto-plugin/lto-plugin.c:501:19: warning: format '%x' expects
argument of type 'unsigned int', but argument 4 has type 'long long unsigned
int' [-Wformat=]
  501 |       fprintf (f, "%u %" PRI_LL "x %s %s\n",
      |                   ^~~~~~
  502 |                (unsigned int) slot, symtab->aux[j].id,
      |                                     ~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long unsigned
int
../../../gcc/lto-plugin/lto-plugin.c:501:34: note: format string is defined
here
  501 |       fprintf (f, "%u %" PRI_LL "x %s %s\n",
      |                       ~~~~~~~~~~~^
      |                                  |
      |                                  unsigned int
      |                       %" PRI_LL "llx
../../../gcc/lto-plugin/lto-plugin.c: In function 'process_symtab':
../../../gcc/lto-plugin/lto-plugin.c:1088:16: warning: 'I' flag used with '%x'
gnu_scanf format [-Wformat=]
 1088 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                ^~~~
../../../gcc/lto-plugin/lto-plugin.c:1088:29: note: format string is defined
here
 1088 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                             ^
../../../gcc/lto-plugin/lto-plugin.c:1088:16: warning: format '%x' expects
argument of type 'unsigned int *', but argument 3 has type 'long long unsigned
int *' [-Wformat=]
 1088 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                ^~~~             ~~~~~~~~~~~~~
      |                                 |
      |                                 long long unsigned int *
../../../gcc/lto-plugin/lto-plugin.c:1088:29: note: format string is defined
here
 1088 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                  ~~~~~~~~~~~^
      |                             |
      |                             unsigned int *
      |                  %" PRI_LL "llx
../../../gcc/lto-plugin/lto-plugin.c: In function 'process_symtab_extension':
../../../gcc/lto-plugin/lto-plugin.c:1140:16: warning: 'I' flag used with '%x'
gnu_scanf format [-Wformat=]
 1140 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                ^~~~
../../../gcc/lto-plugin/lto-plugin.c:1140:29: note: format string is defined
here
 1140 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                             ^
../../../gcc/lto-plugin/lto-plugin.c:1140:16: warning: format '%x' expects
argument of type 'unsigned int *', but argument 3 has type 'long long unsigned
int *' [-Wformat=]
 1140 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                ^~~~             ~~~~~~~~~~~~~
      |                                 |
      |                                 long long unsigned int *
../../../gcc/lto-plugin/lto-plugin.c:1140:29: note: format string is defined
here
 1140 |     sscanf (s, ".%" PRI_LL "x", &obj->out->id);
      |                  ~~~~~~~~~~~^
      |                             |
      |                             unsigned int *
      |                  %" PRI_LL "llx







g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC -DCROSS_DIRECTORY_STRUCTURE  
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I.
-I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include 
-I../../../gcc/gcc/../libcpp/include -I../../../gcc/gcc/../libcody 
-I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I../../../gcc/gcc/../libbacktrace   -o ira-conflicts.o -MT
ira-conflicts.o -MMD -MP -MF ./.deps/ira-conflicts.TPo
../../../gcc/gcc/ira-conflicts.cc
../../../gcc/gcc/ira-conflicts.cc: In function 'bool
build_conflict_bit_table()':
../../../gcc/gcc/ira-conflicts.cc:153:25: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long unsigned int'
[-Wformat=]
  153 |        "+++Allocating %ld bytes for conflict table (uncompressed size
%ld)\n",
      |                       ~~^
      |                         |
      |                         long int
      |                       %lld
  154 |        (long) allocated_words_num * sizeof (IRA_INT_TYPE),
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   long long unsigned int
../../../gcc/gcc/ira-conflicts.cc:153:73: warning: format '%ld' expects
argument of type 'long int', but argument 4 has type 'long long unsigned int'
[-Wformat=]
  153 |        "+++Allocating %ld bytes for conflict table (uncompressed size
%ld)\n",
      |                                                                      
~~^
      |                                                                        
|
      |                                                                        
long int
      |                                                                      
%lld
  154 |        (long) allocated_words_num * sizeof (IRA_INT_TYPE),
  155 |        (long) object_set_words * ira_objects_num * sizeof
(IRA_INT_TYPE));
      |       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
      |                                                  |
      |                                                  long long unsigned int







g++  -fno-PIE -c   -g -O2     -DIN_GCC -fPIC -DCROSS_DIRECTORY_STRUCTURE  
-fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wmissing-format-attribute
-Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I.
-I../../../gcc/gcc -I../../../gcc/gcc/. -I../../../gcc/gcc/../include 
-I../../../gcc/gcc/../libcpp/include -I../../../gcc/gcc/../libcody 
-I../../../gcc/gcc/../libdecnumber -I../../../gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -I../../../gcc/gcc/../libbacktrace   -o h8300.o -MT h8300.o
-MMD -MP -MF ./.deps/h8300.TPo ../../../gcc/gcc/config/h8300/h8300.cc
../../../gcc/gcc/config/h8300/h8300.cc: In function 'void
h8300_print_operand(FILE*, rtx, int)':
../../../gcc/gcc/config/h8300/h8300.cc:1447:26: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1447 |           fprintf (file, "#%ld", (-INTVAL (x)) & 0xff);
      |                          ^~~~~~  ~~~~~~~~~~~~~~~~~~~~
      |                                                |
      |                                                long long int
../../../gcc/gcc/config/h8300/h8300.cc:1460:26: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1460 |           fprintf (file, "#%ld", ((-INTVAL (x)) & 0xff00) >> 8);
      |                          ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                           |
      |                                                           long long int
../../../gcc/gcc/config/h8300/h8300.cc:1468:22: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1468 |       fprintf (file, "#%ld", 0xff & (-INTVAL (x)));
      |                      ^~~~~~  ~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   long long int
../../../gcc/gcc/config/h8300/h8300.cc:1545:26: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1545 |           fprintf (file, "#%ld", ((INTVAL (x) >> 16) & 0xffff));
      |                          ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                      |
      |                                                      long long int
../../../gcc/gcc/config/h8300/h8300.cc:1570:26: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1570 |           fprintf (file, "#%ld", INTVAL (x) & 0xffff);
      |                          ^~~~~~
../../../gcc/gcc/config/h8300/h8300.cc:1624:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1624 |         fprintf (file, "#%ld", (INTVAL (x)) & 0xff);
      |                        ^~~~~~  ~~~~~~~~~~~~~~~~~~~
      |                                             |
      |                                             long long int
../../../gcc/gcc/config/h8300/h8300.cc:1632:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1632 |         fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);
      |                        ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  long long int
../../../gcc/gcc/config/h8300/h8300.cc:1640:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1640 |         fprintf (file, "#%ld", INTVAL (x) & 0xff);
      |                        ^~~~~~
../../../gcc/gcc/config/h8300/h8300.cc:1648:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1648 |         fprintf (file, "#%ld", (INTVAL (x) >> 8) & 0xff);
      |                        ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                  |
      |                                                  long long int
../../../gcc/gcc/config/h8300/h8300.cc:1656:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1656 |         fprintf (file, "#%ld", (INTVAL (x) >> 16) & 0xff);
      |                        ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long int
../../../gcc/gcc/config/h8300/h8300.cc:1664:24: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long int'
[-Wformat=]
 1664 |         fprintf (file, "#%ld", (INTVAL (x) >> 24) & 0xff);
      |                        ^~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                   |
      |                                                   long long int

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
@ 2023-02-02 20:26 ` pinskia at gcc dot gnu.org
  2023-02-02 20:28 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-02 20:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The lto-plugin warnings are not a GCC issue really.
../../../gcc/lto-plugin/lto-plugin.c:501:19: warning: 'I' flag used with '%x'
gnu_printf format [-Wformat=]


Those are done correctly and using the right arguments and all. The issue is
rather how PRI_LL is defined but fprintf specifies gnu_printf rather than
win32_printf format ....
Where is PRI_LL definition coming from? Please provide the preprocessed source
(and add -g3 to keep the #define's in there).
I suspect there is a bug in mingw's stdint.h in some cases ...




This one looks like a mising '()':
../../../gcc/gcc/ira-conflicts.cc:153:25: warning: format '%ld' expects
argument of type 'long int', but argument 3 has type 'long long unsigned int'
[-Wformat=]
  153 |        "+++Allocating %ld bytes for conflict table (uncompressed size
%ld)\n",
      |                       ~~^
      |                         |
      |                         long int
      |                       %lld
  154 |        (long) allocated_words_num * sizeof (IRA_INT_TYPE),
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                   |
      |                                   long long unsigned int

Maybe it should have been `(long) (allocated_words_num * sizeof
(IRA_INT_TYPE))`
Likewise for the next one:

  155 |        (long) object_set_words * ira_objects_num * sizeof
(IRA_INT_TYPE));

Should have been `(long)(object_set_words * ira_objects_num * sizeof
(IRA_INT_TYPE))`

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
  2023-02-02 20:26 ` [Bug other/108644] " pinskia at gcc dot gnu.org
@ 2023-02-02 20:28 ` pinskia at gcc dot gnu.org
  2023-02-03  8:00 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-02 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
h8300.cc should be using HOST_WIDE_INT_PRINT_DEC instead.

Can you file that issue seperately?

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
  2023-02-02 20:26 ` [Bug other/108644] " pinskia at gcc dot gnu.org
  2023-02-02 20:28 ` pinskia at gcc dot gnu.org
@ 2023-02-03  8:00 ` rguenth at gcc dot gnu.org
  2023-02-03 17:18 ` jdx at o2 dot pl
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-02-03  8:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> The lto-plugin warnings are not a GCC issue really.
> ../../../gcc/lto-plugin/lto-plugin.c:501:19: warning: 'I' flag used with
> '%x' gnu_printf format [-Wformat=]
> 
> 
> Those are done correctly and using the right arguments and all. The issue is
> rather how PRI_LL is defined but fprintf specifies gnu_printf rather than
> win32_printf format ....
> Where is PRI_LL definition coming from? Please provide the preprocessed
> source (and add -g3 to keep the #define's in there).
> I suspect there is a bug in mingw's stdint.h in some cases ...

/* We need to use I64 instead of ll width-specifier on native Windows.
   The reason for this is that older MS-runtimes don't support the ll.  */
#ifdef __MINGW32__
#define PRI_LL "I64"
#else
#define PRI_LL "ll"
#endif

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
                   ` (2 preceding siblings ...)
  2023-02-03  8:00 ` rguenth at gcc dot gnu.org
@ 2023-02-03 17:18 ` jdx at o2 dot pl
  2023-02-03 17:33 ` jdx at o2 dot pl
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jdx at o2 dot pl @ 2023-02-03 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jan Dubiec <jdx at o2 dot pl> ---
Created attachment 54406
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54406&action=edit
Preprocessed lto-plugin\lto-plugin.c

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
                   ` (3 preceding siblings ...)
  2023-02-03 17:18 ` jdx at o2 dot pl
@ 2023-02-03 17:33 ` jdx at o2 dot pl
  2023-02-03 17:37 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jdx at o2 dot pl @ 2023-02-03 17:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jan Dubiec <jdx at o2 dot pl> ---
Andrew, as per your wish, preprocessed lto-plugin\lto-plugin.c is in the
attachment. It was produced using the following command:

gcc -DHAVE_CONFIG_H -I. -I../../../gcc/lto-plugin
-I../../../gcc/lto-plugin/../include -DHAVE_CONFIG_H -Wall
-DBASE_VERSION=\"13.0.1\" -E -g3 -O2 ../../../gcc/lto-plugin/lto-plugin.c 
-DDLL_EXPORT -DPIC -o lto-plugin-preprocessed.c


Regarding gcc/ira-conflicts.cc, I think you are probably right, parentheses
should fix the issue. But I am not able to understand (without looking into
docs) how without the parentheses the expressions are promoted to unsigned long
long int instead of just long int. And why the warning does not appear on
Linux.

Regarding gcc/config/h8300/h8300.cc, I will file a separate report soon.

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
                   ` (4 preceding siblings ...)
  2023-02-03 17:33 ` jdx at o2 dot pl
@ 2023-02-03 17:37 ` pinskia at gcc dot gnu.org
  2023-02-03 17:48 ` jdx at o2 dot pl
  2024-02-18  7:55 ` nightstrike at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-03 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jan Dubiec from comment #5)
> Regarding gcc/ira-conflicts.cc, I think you are probably right, parentheses
> should fix the issue. But I am not able to understand (without looking into
> docs) how without the parentheses the expressions are promoted to unsigned
> long long int instead of just long int. And why the warning does not appear
> on Linux.

(long) allocated_words_num * sizeof (IRA_INT_TYPE)

For Linux, it is (long) * (unsigned long) or (long) * (unsigned int) [first is
LP64 and the second is ILP32], the first gives unsigned long while the second
case gives long. While under LLP64LI32, you have (long) * (unsigned long long)
so you get "unsigned long long" as the type.
as sizeof returns size_t.

Does that make sense now?

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
                   ` (5 preceding siblings ...)
  2023-02-03 17:37 ` pinskia at gcc dot gnu.org
@ 2023-02-03 17:48 ` jdx at o2 dot pl
  2024-02-18  7:55 ` nightstrike at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jdx at o2 dot pl @ 2023-02-03 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jan Dubiec <jdx at o2 dot pl> ---
(In reply to Andrew Pinski from comment #6)
[...]
> as sizeof returns size_t.
> 
> Does that make sense now?
Yep, thanks.

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

* [Bug other/108644] Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10
  2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
                   ` (6 preceding siblings ...)
  2023-02-03 17:48 ` jdx at o2 dot pl
@ 2024-02-18  7:55 ` nightstrike at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: nightstrike at gmail dot com @ 2024-02-18  7:55 UTC (permalink / raw)
  To: gcc-bugs

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

nightstrike <nightstrike at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nightstrike at gmail dot com

--- Comment #8 from nightstrike <nightstrike at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> This one looks like a mising '()':
> ../../../gcc/gcc/ira-conflicts.cc:153:25: warning: format '%ld' expects
> argument of type 'long int', but argument 3 has type 'long long unsigned
> int' [-Wformat=]
>   153 |        "+++Allocating %ld bytes for conflict table (uncompressed
> size %ld)\n",
>       |                       ~~^
>       |                         |
>       |                         long int
>       |                       %lld
>   154 |        (long) allocated_words_num * sizeof (IRA_INT_TYPE),
>       |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       |                                   |
>       |                                   long long unsigned int
> 
> Maybe it should have been `(long) (allocated_words_num * sizeof
> (IRA_INT_TYPE))`
> Likewise for the next one:
> 
>   155 |        (long) object_set_words * ira_objects_num * sizeof
> (IRA_INT_TYPE));
> 
> Should have been `(long)(object_set_words * ira_objects_num * sizeof
> (IRA_INT_TYPE))`

This part should be fixed now after PR43613 and r14-8898-g2bb4556220285e.

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

end of thread, other threads:[~2024-02-18  7:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-02 20:10 [Bug other/108644] New: Format string warnings related to longs under MigW-W64/MSYS2 on Windows 10 jdx at o2 dot pl
2023-02-02 20:26 ` [Bug other/108644] " pinskia at gcc dot gnu.org
2023-02-02 20:28 ` pinskia at gcc dot gnu.org
2023-02-03  8:00 ` rguenth at gcc dot gnu.org
2023-02-03 17:18 ` jdx at o2 dot pl
2023-02-03 17:33 ` jdx at o2 dot pl
2023-02-03 17:37 ` pinskia at gcc dot gnu.org
2023-02-03 17:48 ` jdx at o2 dot pl
2024-02-18  7:55 ` nightstrike at gmail dot com

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