* [PATCH] C-SKY: Fix unsigned comparison warning
@ 2022-09-12 12:19 Jan-Benedict Glaw
2022-09-16 22:09 ` [ping] " Jan-Benedict Glaw
2022-09-17 0:22 ` Jeff Law
0 siblings, 2 replies; 3+ messages in thread
From: Jan-Benedict Glaw @ 2022-09-12 12:19 UTC (permalink / raw)
To: gcc-patches, Xianmiao Qu, Yunhai Shang
[-- Attachment #1: Type: text/plain, Size: 2427 bytes --]
Hi!
When -mfloat-abi=hard support was added, a cast went missing that
used to silence a warning in common code:
/usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -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 -Werror -fno-common -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 builtins.o -MT builtins.o -MMD -MP -MF ./.deps/builtins.TPo ../../gcc/gcc/builtins.cc
In file included from ./tm.h:21,
from ../../gcc/gcc/backend.h:28,
from ../../gcc/gcc/builtins.cc:27:
../../gcc/gcc/builtins.cc: In function 'int apply_args_size()':
../../gcc/gcc/config/csky/csky.h:421:13: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
421 | (((REGNO) >= CSKY_FIRST_PARM_REGNUM \
../../gcc/gcc/builtins.cc:1444:13: note: in expansion of macro 'FUNCTION_ARG_REGNO_P'
1444 | if (FUNCTION_ARG_REGNO_P (regno))
| ^~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[1]: *** [Makefile:1146: builtins.o] Error 1
The needed (int) cast is even mentioned in the comment above, so reinstate
it here.
2022-09-06 Jan-Benedict Glaw <jbglaw@lug-owl.de>
gcc/ChangeLog:
* config/csky/csky.h (FUNCTION_ARG_REGNO_P): Cast REGNO to (int)
to prevent warning.
diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h
index 37410f0cda4..730d1b44ef1 100644
--- a/gcc/config/csky/csky.h
+++ b/gcc/config/csky/csky.h
@@ -418,7 +418,7 @@ typedef struct
The int cast is to prevent a complaint about unsigned comparison to
zero, since CSKY_FIRST_PARM_REGNUM is zero. */
#define FUNCTION_ARG_REGNO_P(REGNO) \
- (((REGNO) >= CSKY_FIRST_PARM_REGNUM \
+ (((int)(REGNO) >= CSKY_FIRST_PARM_REGNUM \
&& (REGNO) < (CSKY_NPARM_REGS + CSKY_FIRST_PARM_REGNUM)) \
|| FUNCTION_VARG_REGNO_P(REGNO))
Ok for HEAD?
Thanks,
Jan-Benedict
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [ping] [PATCH] C-SKY: Fix unsigned comparison warning
2022-09-12 12:19 [PATCH] C-SKY: Fix unsigned comparison warning Jan-Benedict Glaw
@ 2022-09-16 22:09 ` Jan-Benedict Glaw
2022-09-17 0:22 ` Jeff Law
1 sibling, 0 replies; 3+ messages in thread
From: Jan-Benedict Glaw @ 2022-09-16 22:09 UTC (permalink / raw)
To: gcc-patches, Xianmiao Qu, Yunhai Shang
[-- Attachment #1: Type: text/plain, Size: 979 bytes --]
On Mon, 2022-09-12 14:19:23 +0200, Jan-Benedict Glaw <jbglaw@lug-owl.de> wrote:
> 2022-09-06 Jan-Benedict Glaw <jbglaw@lug-owl.de>
>
> gcc/ChangeLog:
> * config/csky/csky.h (FUNCTION_ARG_REGNO_P): Cast REGNO to (int)
> to prevent warning.
>
> diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h
> index 37410f0cda4..730d1b44ef1 100644
> --- a/gcc/config/csky/csky.h
> +++ b/gcc/config/csky/csky.h
> @@ -418,7 +418,7 @@ typedef struct
> The int cast is to prevent a complaint about unsigned comparison to
> zero, since CSKY_FIRST_PARM_REGNUM is zero. */
> #define FUNCTION_ARG_REGNO_P(REGNO) \
> - (((REGNO) >= CSKY_FIRST_PARM_REGNUM \
> + (((int)(REGNO) >= CSKY_FIRST_PARM_REGNUM \
> && (REGNO) < (CSKY_NPARM_REGS + CSKY_FIRST_PARM_REGNUM)) \
> || FUNCTION_VARG_REGNO_P(REGNO))
>
>
> Ok for HEAD?
Just wanted to give this a ping.
MfG, JBG
--
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] C-SKY: Fix unsigned comparison warning
2022-09-12 12:19 [PATCH] C-SKY: Fix unsigned comparison warning Jan-Benedict Glaw
2022-09-16 22:09 ` [ping] " Jan-Benedict Glaw
@ 2022-09-17 0:22 ` Jeff Law
1 sibling, 0 replies; 3+ messages in thread
From: Jeff Law @ 2022-09-17 0:22 UTC (permalink / raw)
To: gcc-patches
On 9/12/22 06:19, Jan-Benedict Glaw wrote:
> Hi!
>
> When -mfloat-abi=hard support was added, a cast went missing that
> used to silence a warning in common code:
>
> /usr/lib/gcc-snapshot/bin/g++ -fno-PIE -c -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -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 -Werror -fno-common -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 builtins.o -MT builtins.o -MMD -MP -MF ./.deps/builtins.TPo ../../gcc/gcc/builtins.cc
> In file included from ./tm.h:21,
> from ../../gcc/gcc/backend.h:28,
> from ../../gcc/gcc/builtins.cc:27:
> ../../gcc/gcc/builtins.cc: In function 'int apply_args_size()':
> ../../gcc/gcc/config/csky/csky.h:421:13: error: comparison of unsigned expression in '>= 0' is always true [-Werror=type-limits]
> 421 | (((REGNO) >= CSKY_FIRST_PARM_REGNUM \
> ../../gcc/gcc/builtins.cc:1444:13: note: in expansion of macro 'FUNCTION_ARG_REGNO_P'
> 1444 | if (FUNCTION_ARG_REGNO_P (regno))
> | ^~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> make[1]: *** [Makefile:1146: builtins.o] Error 1
>
> The needed (int) cast is even mentioned in the comment above, so reinstate
> it here.
>
>
>
> 2022-09-06 Jan-Benedict Glaw <jbglaw@lug-owl.de>
>
> gcc/ChangeLog:
> * config/csky/csky.h (FUNCTION_ARG_REGNO_P): Cast REGNO to (int)
> to prevent warning.
OK
jeff
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-17 0:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12 12:19 [PATCH] C-SKY: Fix unsigned comparison warning Jan-Benedict Glaw
2022-09-16 22:09 ` [ping] " Jan-Benedict Glaw
2022-09-17 0:22 ` Jeff Law
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).