From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lug-owl.de (lug-owl.de [188.68.32.151]) by sourceware.org (Postfix) with ESMTPS id BB5BF385B839 for ; Mon, 12 Sep 2022 12:19:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BB5BF385B839 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=lug-owl.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lug-owl.de Received: by lug-owl.de (Postfix, from userid 1001) id A435742039; Mon, 12 Sep 2022 14:19:23 +0200 (CEST) Date: Mon, 12 Sep 2022 14:19:23 +0200 From: Jan-Benedict Glaw To: gcc-patches@gcc.gnu.org, Xianmiao Qu , Yunhai Shang Subject: [PATCH] C-SKY: Fix unsigned comparison warning Message-ID: <20220912121923.fazqolix7neh77uz@lug-owl.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7mkm3que2ku365d5" Content-Disposition: inline X-Operating-System: Linux chamaeleon 5.14.0-0.bpo.2-amd64 X-gpg-fingerprint: 250D 3BCF 7127 0D8C A444 A961 1DBD 5E75 8399 E1BB X-gpg-key: wwwkeys.de.pgp.net X-Echelon-Enable: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-TKUeV: howto poison arsenous mail psychological biological nuclear warfare test the bombastical terror of flooding the spy listeners explosion sex drugs and rock'n'roll X-message-flag: Please send plain text messages only. Do not send HTML emails. Thank you. User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --7mkm3que2ku365d5 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! When -mfloat-abi=3Dhard 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_DIR= ECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -= W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribu= te -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../.= =2E/gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/gcc/../libbac= ktrace -o builtins.o -MT builtins.o -MMD -MP -MF ./.deps/builtins.TPo ../= =2E./gcc/gcc/builtins.cc In file included from ./tm.h:21, from ../../gcc/gcc/backend.h:28, from ../../gcc/gcc/builtins.cc:27: =2E./../gcc/gcc/builtins.cc: In function 'int apply_args_size()': =2E./../gcc/gcc/config/csky/csky.h:421:13: error: comparison of unsigned ex= pression in '>=3D 0' is always true [-Werror=3Dtype-limits] 421 | (((REGNO) >=3D CSKY_FIRST_PARM_REGNUM \ =2E./../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 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) >=3D CSKY_FIRST_PARM_REGNUM \ + (((int)(REGNO) >=3D CSKY_FIRST_PARM_REGNUM \ && (REGNO) < (CSKY_NPARM_REGS + CSKY_FIRST_PARM_REGNUM)) \ || FUNCTION_VARG_REGNO_P(REGNO)) =20 Ok for HEAD? Thanks, Jan-Benedict --=20 --7mkm3que2ku365d5 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQQlDTvPcScNjKREqWEdvV51g5nhuwUCYx8jyQAKCRAdvV51g5nh uxlOAKCRHwIHM91rEUaZqQNC5jxVqhxoyQCeOHxSaiMTJ37A7y8MK2IFSOmCVo0= =ccGh -----END PGP SIGNATURE----- --7mkm3que2ku365d5--