public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] sim: mips: use sim_fpu_to{32,64}u to fix build warnings
@ 2021-11-06  9:50 Tiezhu Yang
  2021-11-06 16:22 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: Tiezhu Yang @ 2021-11-06  9:50 UTC (permalink / raw)
  To: gdb-patches

Since the first argument type is unsigned32 or unsigned64, just use
sim_fpu_to{32,64}u instead of sim_fpu_to{32,64}i to fix the following
build warnings:

  CC     cp1.o
/home/loongson/gdb.git/sim/mips/cp1.c: In function ‘convert’:
/home/loongson/gdb.git/sim/mips/cp1.c:1425:32: warning: pointer targets in passing argument 1 of ‘sim_fpu_to32i’ differ in signedness [-Wpointer-sign]
       status |= sim_fpu_to32i (&result32, &wop, round);
                                ^~~~~~~~~
In file included from /home/loongson/gdb.git/sim/mips/sim-main.h:67,
                 from /home/loongson/gdb.git/sim/mips/cp1.c:46:
/home/loongson/gdb.git/sim/mips/../common/sim-fpu.h:270:22: note: expected ‘signed32 *’ {aka ‘int *’} but argument is of type ‘unsigned32 *’ {aka ‘unsigned int *’}
 INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
                      ^~~~~~~~~~~~~
/home/loongson/gdb.git/sim/mips/cp1.c:1429:32: warning: pointer targets in passing argument 1 of ‘sim_fpu_to64i’ differ in signedness [-Wpointer-sign]
       status |= sim_fpu_to64i (&result64, &wop, round);
                                ^~~~~~~~~
In file included from /home/loongson/gdb.git/sim/mips/sim-main.h:67,
                 from /home/loongson/gdb.git/sim/mips/cp1.c:46:
/home/loongson/gdb.git/sim/mips/../common/sim-fpu.h:274:22: note: expected ‘signed64 *’ {aka ‘long int *’} but argument is of type ‘unsigned64 *’ {aka ‘long unsigned int *’}
 INLINE_SIM_FPU (int) sim_fpu_to64i (signed64 *i, const sim_fpu *f,
                      ^~~~~~~~~~~~~
/home/loongson/gdb.git/sim/mips/cp1.c: In function ‘convert_ps’:
/home/loongson/gdb.git/sim/mips/cp1.c:1528:34: warning: pointer targets in passing argument 1 of ‘sim_fpu_to32i’ differ in signedness [-Wpointer-sign]
       status_u |= sim_fpu_to32i (&res_u, &wop_u, round);
                                  ^~~~~~
In file included from /home/loongson/gdb.git/sim/mips/sim-main.h:67,
                 from /home/loongson/gdb.git/sim/mips/cp1.c:46:
/home/loongson/gdb.git/sim/mips/../common/sim-fpu.h:270:22: note: expected ‘signed32 *’ {aka ‘int *’} but argument is of type ‘unsigned32 *’ {aka ‘unsigned int *’}
 INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
                      ^~~~~~~~~~~~~
/home/loongson/gdb.git/sim/mips/cp1.c:1529:34: warning: pointer targets in passing argument 1 of ‘sim_fpu_to32i’ differ in signedness [-Wpointer-sign]
       status_l |= sim_fpu_to32i (&res_l, &wop_l, round);
                                  ^~~~~~
In file included from /home/loongson/gdb.git/sim/mips/sim-main.h:67,
                 from /home/loongson/gdb.git/sim/mips/cp1.c:46:
/home/loongson/gdb.git/sim/mips/../common/sim-fpu.h:270:22: note: expected ‘signed32 *’ {aka ‘int *’} but argument is of type ‘unsigned32 *’ {aka ‘unsigned int *’}
 INLINE_SIM_FPU (int) sim_fpu_to32i (signed32 *i, const sim_fpu *f,
                      ^~~~~~~~~~~~~

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 sim/mips/cp1.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sim/mips/cp1.c b/sim/mips/cp1.c
index 03ed0c0..8d45b84 100644
--- a/sim/mips/cp1.c
+++ b/sim/mips/cp1.c
@@ -1422,11 +1422,11 @@ convert (sim_cpu *cpu,
       sim_fpu_to64 (&result64, &wop);
       break;
     case fmt_word:
-      status |= sim_fpu_to32i (&result32, &wop, round);
+      status |= sim_fpu_to32u (&result32, &wop, round);
       result64 = result32;
       break;
     case fmt_long:
-      status |= sim_fpu_to64i (&result64, &wop, round);
+      status |= sim_fpu_to64u (&result64, &wop, round);
       break;
     default:
       result64 = 0;
@@ -1525,8 +1525,8 @@ convert_ps (sim_cpu *cpu,
   switch (to)
     {
     case fmt_word:   /* fmt_pw */
-      status_u |= sim_fpu_to32i (&res_u, &wop_u, round);
-      status_l |= sim_fpu_to32i (&res_l, &wop_l, round);
+      status_u |= sim_fpu_to32u (&res_u, &wop_u, round);
+      status_l |= sim_fpu_to32u (&res_l, &wop_l, round);
       result = (((unsigned64)res_u) << 32) | (unsigned64)res_l;
       break;
     case fmt_ps:
-- 
2.1.0


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

* Re: [PATCH] sim: mips: use sim_fpu_to{32,64}u to fix build warnings
  2021-11-06  9:50 [PATCH] sim: mips: use sim_fpu_to{32,64}u to fix build warnings Tiezhu Yang
@ 2021-11-06 16:22 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2021-11-06 16:22 UTC (permalink / raw)
  To: Tiezhu Yang; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 388 bytes --]

On 06 Nov 2021 17:50, Tiezhu Yang wrote:
> Since the first argument type is unsigned32 or unsigned64, just use
> sim_fpu_to{32,64}u instead of sim_fpu_to{32,64}i to fix the following
> build warnings:

nice!  merged, with a minor addition:
--- a/sim/mips/Makefile.in
+++ b/sim/mips/Makefile.in
 
-# Some modules don't build cleanly yet.
-cp1.o: SIM_WERROR_CFLAGS =
-

-mike

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2021-11-06 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06  9:50 [PATCH] sim: mips: use sim_fpu_to{32,64}u to fix build warnings Tiezhu Yang
2021-11-06 16:22 ` Mike Frysinger

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