From unknown Sat Aug 16 16:14:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false Resent-From: "Voelker, Bernhard" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 May 2011 18:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8732 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8732@debbugs.gnu.org X-Debbugs-Original-To: "bug-coreutils@gnu.org" Received: via spool by submit@debbugs.gnu.org id=B.130634756632105 (code B ref -1); Wed, 25 May 2011 18:20:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 May 2011 18:19:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPIg1-0008Li-Ce for submit@debbugs.gnu.org; Wed, 25 May 2011 14:19:25 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPIWX-00083D-Od for submit@debbugs.gnu.org; Wed, 25 May 2011 14:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPF6c-00006G-Ll for submit@debbugs.gnu.org; Wed, 25 May 2011 10:30:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RFC_ABUSE_POST autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:33504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPF6c-00006A-K9 for submit@debbugs.gnu.org; Wed, 25 May 2011 10:30:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPF6Y-0003ZQ-Nj for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPF6X-0008V5-RJ for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:34 -0400 Received: from mail216.messagelabs.com ([85.158.143.99]:63034) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QPF6X-0008TL-HG for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:33 -0400 X-VirusChecked: Checked X-Env-Sender: bernhard.voelker@siemens-enterprise.com X-Msg-Ref: server-10.tower-216.messagelabs.com!1306308231!6008959!1 X-StarScan-Version: 6.2.16; banners=-,-,- X-Originating-IP: [62.134.46.10] Received: (qmail 24979 invoked from network); 25 May 2011 07:23:51 -0000 Received: from unknown (HELO senmx12-mx) (62.134.46.10) by server-10.tower-216.messagelabs.com with SMTP; 25 May 2011 07:23:51 -0000 Received: from MCHP063A.global-ad.net (unknown [172.29.37.61]) by senmx12-mx (Server) with ESMTP id 7469923F03E6 for ; Wed, 25 May 2011 09:23:51 +0200 (CEST) Received: from MCHP058A.global-ad.net ([172.29.37.55]) by MCHP063A.global-ad.net ([172.29.37.61]) with mapi; Wed, 25 May 2011 09:23:51 +0200 From: "Voelker, Bernhard" Date: Wed, 25 May 2011 09:23:50 +0200 Thread-Topic: uinttostr: comparison of unsigned expression < 0 is always false Thread-Index: AcwarLGg6EkjNSBYQCi7XrJCqxqBQw== Message-ID: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.7 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Hi *, building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES 10.3 = server: CC uinttostr.o cc1: warnings being treated as errors In file included from uinttostr.c:3: anytostr.c: In function 'uinttostr': anytostr.c:39: warning: comparison of unsigned expression < 0 is always fal= se gcc --version gcc (GCC) 4.1.2 20070115 (SUSE Linux) Have a nice day, Berny= From unknown Sat Aug 16 16:14:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 May 2011 19:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8732 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: "Voelker, Bernhard" Cc: 8732@debbugs.gnu.org Received: via spool by 8732-submit@debbugs.gnu.org id=B8732.130635330411783 (code B ref 8732); Wed, 25 May 2011 19:56:01 +0000 Received: (at 8732) by debbugs.gnu.org; 25 May 2011 19:55:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPKAZ-000340-S7 for submit@debbugs.gnu.org; Wed, 25 May 2011 15:55:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPKAX-00033V-06 for 8732@debbugs.gnu.org; Wed, 25 May 2011 15:55:02 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4PJstF1026420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 May 2011 15:54:55 -0400 Received: from [10.3.113.108] (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4PJssaE000982; Wed, 25 May 2011 15:54:54 -0400 Message-ID: <4DDD5E8E.5090701@redhat.com> Date: Wed, 25 May 2011 13:54:54 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 References: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> In-Reply-To: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig967BBD15FB1BB31A1EDF8A73" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.3 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig967BBD15FB1BB31A1EDF8A73 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 05/25/2011 01:23 AM, Voelker, Bernhard wrote: > Hi *, >=20 > building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES 1= 0.3 server: >=20 > CC uinttostr.o > cc1: warnings being treated as errors > In file included from uinttostr.c:3: > anytostr.c: In function 'uinttostr': > anytostr.c:39: warning: comparison of unsigned expression < 0 is always= false It would be _really_ nice if there were a way to have gcc shut up that particular warning when it is the result of a macro expansion that first checks whether an expresssion is signed or unsigned. That is, gcc is issuing the warning for 'is_signed(e) ? (e < 0 ? a : b) : b', even though the 'e < 0' sub-expression is provably dead code for an unsigned expression and therefore the warning is spurious. But we don't know how to shut up gcc. This also affects recent gnulib lib/intprops.h, so ideas are welcome. In the meantime, configure with CFLAGS=3D'-Wno-error' to allow warnings t= o still be listed but not halt compilation. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig967BBD15FB1BB31A1EDF8A73 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJN3V6OAAoJEKeha0olJ0Nq20EH/2Wbt7hDKWKMDdqxc1Ycajl2 y+joXH5s9W1tExvdMVffMKJZdllU44jjSMajqXqi3uvP5mZS3XcIoShH828u3WVb KnjAmHH+uvRmWMrvGU+5Zq5yYy/dha7yPw6HGXvLZLE94uTK+KvKXV5WB9GUdmhH zSD22RYT2NML2PcnYt2wcMtVdVij8ZCPPM7BL4SRu2QU6DrHzkBSUJIGKFa3bhRi Nyck6h81UWah/sfk11S/xSWiNkZve4XGApSYkNrWHa8Q34ta7i21NB/75Tw9EOH2 Hz6XzqroTBYDKRkfe6nIG9OSXBtNqQiNa1pSVIbvoBzGbehaYDNGug4j6KQ3xA8= =nUBN -----END PGP SIGNATURE----- --------------enig967BBD15FB1BB31A1EDF8A73-- From unknown Sat Aug 16 16:14:38 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Voelker, Bernhard" Subject: bug#8732: closed (Re: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false) Message-ID: References: <4DDD74A8.8000106@redhat.com> <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> X-Gnu-PR-Message: they-closed 8732 X-Gnu-PR-Package: coreutils Reply-To: 8732@debbugs.gnu.org Date: Wed, 25 May 2011 21:30:04 +0000 Content-Type: multipart/mixed; boundary="----------=_1306359004-20299-1" This is a multi-part message in MIME format... ------------=_1306359004-20299-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8732: uinttostr: comparison of unsigned expression < 0 is always false which was filed against the coreutils package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 8732@debbugs.gnu.org. --=20 8732: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8732 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1306359004-20299-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8732-done) by debbugs.gnu.org; 25 May 2011 21:29:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPLdw-0005GP-Du for submit@debbugs.gnu.org; Wed, 25 May 2011 17:29:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPLdq-0005G7-Lp for 8732-done@debbugs.gnu.org; Wed, 25 May 2011 17:29:27 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4PLTD9U017123 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 May 2011 17:29:16 -0400 Received: from [10.3.113.108] (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p4PLTCcT021033; Wed, 25 May 2011 17:29:12 -0400 Message-ID: <4DDD74A8.8000106@redhat.com> Date: Wed, 25 May 2011 15:29:12 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 Subject: Re: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false References: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> <4DDD5E8E.5090701@redhat.com> In-Reply-To: <4DDD5E8E.5090701@redhat.com> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigDC84BE92FD1F5BDF349EA89C" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -9.6 (---------) X-Debbugs-Envelope-To: 8732-done Cc: 8732-done@debbugs.gnu.org, "Voelker, Bernhard" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -9.6 (---------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDC84BE92FD1F5BDF349EA89C Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable tag 8732 wontfix close 8732 done On 05/25/2011 01:54 PM, Eric Blake wrote: > On 05/25/2011 01:23 AM, Voelker, Bernhard wrote: >> Hi *, >> >> building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES = 10.3 server: >> >> CC uinttostr.o >> cc1: warnings being treated as errors >> In file included from uinttostr.c:3: >> anytostr.c: In function 'uinttostr': >> anytostr.c:39: warning: comparison of unsigned expression < 0 is alway= s false >=20 > the warning is spurious. But we don't know how > to shut up gcc. You're not the first to hit this, either: http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00435.html Since our party line back then was to "upgrade gcc or quit using -Werror with old gcc", I'm marking this as a wontfix; but if you can come up with a patch, we can reopen it. --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enigDC84BE92FD1F5BDF349EA89C Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJN3XSoAAoJEKeha0olJ0NqhcEH/AuSAbdxjDnH3JuInZxpCZFo Wq8qKPkkv0iFjTFc0Nk1k34rfwZc/pLdcupaGJjcoxbBh4YA+5+VDxMSYCkEocXr dQtrwhQEAxiIq1f24n9ReexwM6HDqFzHGA4HIoU78UH0hSnDBJzbQhzd2Dnb6l8M Rt02i3tFTMfYX5YVPC5483nOvtNKJ6yiZ/wqmeSXq1BBYtExMfw5jPSzVDeLz5pl A67tNz2M3C1L544fDFqlGJtMuv9SSB8GQu1RXvEWiYMsJ+DiB5nEBUIaSyRtAvPR F9ThHworc4L7CNfx9qMO7eTgtW7dQz3xF6qA5n+gVdriuSRYvA8irW11KFdXsEM= =xd2F -----END PGP SIGNATURE----- --------------enigDC84BE92FD1F5BDF349EA89C-- ------------=_1306359004-20299-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 May 2011 18:19:26 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPIg1-0008Li-Ce for submit@debbugs.gnu.org; Wed, 25 May 2011 14:19:25 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPIWX-00083D-Od for submit@debbugs.gnu.org; Wed, 25 May 2011 14:09:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPF6c-00006G-Ll for submit@debbugs.gnu.org; Wed, 25 May 2011 10:30:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RFC_ABUSE_POST autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:33504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPF6c-00006A-K9 for submit@debbugs.gnu.org; Wed, 25 May 2011 10:30:38 -0400 Received: from eggs.gnu.org ([140.186.70.92]:47590) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPF6Y-0003ZQ-Nj for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPF6X-0008V5-RJ for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:34 -0400 Received: from mail216.messagelabs.com ([85.158.143.99]:63034) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1QPF6X-0008TL-HG for bug-coreutils@gnu.org; Wed, 25 May 2011 10:30:33 -0400 X-VirusChecked: Checked X-Env-Sender: bernhard.voelker@siemens-enterprise.com X-Msg-Ref: server-10.tower-216.messagelabs.com!1306308231!6008959!1 X-StarScan-Version: 6.2.16; banners=-,-,- X-Originating-IP: [62.134.46.10] Received: (qmail 24979 invoked from network); 25 May 2011 07:23:51 -0000 Received: from unknown (HELO senmx12-mx) (62.134.46.10) by server-10.tower-216.messagelabs.com with SMTP; 25 May 2011 07:23:51 -0000 Received: from MCHP063A.global-ad.net (unknown [172.29.37.61]) by senmx12-mx (Server) with ESMTP id 7469923F03E6 for ; Wed, 25 May 2011 09:23:51 +0200 (CEST) Received: from MCHP058A.global-ad.net ([172.29.37.55]) by MCHP063A.global-ad.net ([172.29.37.61]) with mapi; Wed, 25 May 2011 09:23:51 +0200 From: "Voelker, Bernhard" To: "bug-coreutils@gnu.org" Date: Wed, 25 May 2011 09:23:50 +0200 Subject: uinttostr: comparison of unsigned expression < 0 is always false Thread-Topic: uinttostr: comparison of unsigned expression < 0 is always false Thread-Index: AcwarLGg6EkjNSBYQCi7XrJCqxqBQw== Message-ID: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.8 (----) Hi *, building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES 10.3 = server: CC uinttostr.o cc1: warnings being treated as errors In file included from uinttostr.c:3: anytostr.c: In function 'uinttostr': anytostr.c:39: warning: comparison of unsigned expression < 0 is always fal= se gcc --version gcc (GCC) 4.1.2 20070115 (SUSE Linux) Have a nice day, Berny= ------------=_1306359004-20299-1-- From unknown Sat Aug 16 16:14:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 May 2011 21:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8732 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8732@debbugs.gnu.org, bug-gnulib Received: via spool by 8732-submit@debbugs.gnu.org id=B8732.130636010922069 (code B ref 8732); Wed, 25 May 2011 21:49:01 +0000 Received: (at 8732) by debbugs.gnu.org; 25 May 2011 21:48:29 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPLwK-0005ju-SH for submit@debbugs.gnu.org; Wed, 25 May 2011 17:48:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPLwI-0005ja-O5 for 8732@debbugs.gnu.org; Wed, 25 May 2011 17:48:28 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4PLmL7j031939 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 25 May 2011 17:48:21 -0400 Received: from [10.3.113.108] (ovpn-113-108.phx2.redhat.com [10.3.113.108]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4PLmK9Y008682; Wed, 25 May 2011 17:48:20 -0400 Message-ID: <4DDD7923.2010906@redhat.com> Date: Wed, 25 May 2011 15:48:19 -0600 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10 MIME-Version: 1.0 References: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> <4DDD5E8E.5090701@redhat.com> <4DDD74A8.8000106@redhat.com> In-Reply-To: <4DDD74A8.8000106@redhat.com> X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig54BBC18C1BBDAE95A8D7AD2F" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Spam-Score: -10.3 (----------) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -10.3 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig54BBC18C1BBDAE95A8D7AD2F Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable [adding bug-gnulib] On 05/25/2011 03:29 PM, Eric Blake wrote: >>> building coreutils-8.12 with '--enable-gcc-warnings' fails on my SLES= 10.3 server: >>> >>> CC uinttostr.o >>> cc1: warnings being treated as errors >>> In file included from uinttostr.c:3: >>> anytostr.c: In function 'uinttostr': >>> anytostr.c:39: warning: comparison of unsigned expression < 0 is alwa= ys false >> >> the warning is spurious. But we don't know how >> to shut up gcc. >=20 > You're not the first to hit this, either: >=20 > http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00435.html >=20 > Since our party line back then was to "upgrade gcc or quit using -Werro= r > with old gcc", I'm marking this as a wontfix; but if you can come up > with a patch, we can reopen it. Jim, Paul, This patch silences the gcc warning even for gcc too old to honor the pragma, but I can't help but feel that it might be too gross (it makes functions like uinttostr larger in size). What do you think? diff --git i/lib/anytostr.c w/lib/anytostr.c index e23746a..da57259 100644 --- i/lib/anytostr.c +++ w/lib/anytostr.c @@ -17,11 +17,6 @@ /* Written by Paul Eggert */ -/* Tell gcc not to warn about the (i < 0) test, below. */ -#if (__GNUC__ =3D=3D 4 && 3 <=3D __GNUC_MINOR__) || 4 < __GNUC__ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif - #include #include "inttostr.h" @@ -34,15 +29,17 @@ char * __attribute_warn_unused_result__ anytostr (inttype i, char *buf) { char *p =3D buf + INT_STRLEN_BOUND (inttype); + inttype ii =3D i; *p =3D 0; - if (i < 0) + if (i <=3D 0) { do *--p =3D '0' - i % 10; while ((i /=3D 10) !=3D 0); - *--p =3D '-'; + if (ii) + *--p =3D '-'; } else { The same trick of swapping '< 0' to '<=3D 0' to foil -Wtype-limits can be= used to reduce (but not eliminate) some of the other warnings generated by intprops.h. For example, this one's completely safe, and knocks out a bunch of the warnings on test-intprops.c if you temporarily revert 9d196fad: diff --git i/lib/intprops.h w/lib/intprops.h index d722648..c2e6bf8 100644 --- i/lib/intprops.h +++ w/lib/intprops.h @@ -54,7 +54,7 @@ /* Return 1 if the integer expression E, after integer promotion, has a signed type. E should not have side effects. */ -#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) +#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) <=3D 0) /* Minimum and maximum values for integer types and expressions. These --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig54BBC18C1BBDAE95A8D7AD2F Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJN3XkjAAoJEKeha0olJ0Nqdq4H/jUQED9xh/8Qws8XqJX0O9uB xsr1YP3KLu9SL3ol5TdfchcHI3K+LaQRa+eV6x/otTlEsfTYTHjC1RtrEhEIu+BO UpEh0k7a7Iz+96XnL19I+jG7vz/HPUuNgwqEkUT+E0MMb6xaMKscFdVmYhqNR7aw AgqBDmrG3vzKo5Em1EyCjvL5KLnUtKlFkfYk540gsvoPE0Z8JMgvh6UizEQVX4RK zyyqs0dLG5sPGCKAeXAXdJ0afy59RT6VuQN0xXc83I3KsxSHsxqi5oD6kiDWITIR Xdw1qZfrbCsx4XI131USd598En5wqdTaQIhxBQA+C7gK6t9F88qviD3Lf9zrxyI= =9Ogk -----END PGP SIGNATURE----- --------------enig54BBC18C1BBDAE95A8D7AD2F-- From unknown Sat Aug 16 16:14:38 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8732: uinttostr: comparison of unsigned expression < 0 is always false Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 25 May 2011 22:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8732 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Eric Blake Cc: bug-gnulib , 8732@debbugs.gnu.org Received: via spool by 8732-submit@debbugs.gnu.org id=B8732.130636208824998 (code B ref 8732); Wed, 25 May 2011 22:22:02 +0000 Received: (at 8732) by debbugs.gnu.org; 25 May 2011 22:21:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPMSF-0006V9-A3 for submit@debbugs.gnu.org; Wed, 25 May 2011 18:21:27 -0400 Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QPMSC-0006Uu-Q9 for 8732@debbugs.gnu.org; Wed, 25 May 2011 18:21:25 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 44A5C39E80F2; Wed, 25 May 2011 15:21:19 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IRSnQRfft5h5; Wed, 25 May 2011 15:21:18 -0700 (PDT) Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id D982339E80F0; Wed, 25 May 2011 15:21:18 -0700 (PDT) Message-ID: <4DDD80DE.2070206@cs.ucla.edu> Date: Wed, 25 May 2011 15:21:18 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 References: <7856072A9D04C24B82DFE2B1112FE38A087A29CDD1@MCHP058A.global-ad.net> <4DDD5E8E.5090701@redhat.com> <4DDD74A8.8000106@redhat.com> <4DDD7923.2010906@redhat.com> In-Reply-To: <4DDD7923.2010906@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.2 (---) On 05/25/11 14:48, Eric Blake wrote: > This patch silences the gcc warning even for gcc too old to honor the > pragma, but I can't help but feel that it might be too gross (it makes > functions like uinttostr larger in size). > ... > - *--p = '-'; > + if (ii) > + *--p = '-'; Yes, it's too gross. Once we start down that path we'll have a big job of making subtle changes to code that make it worse and are put in only to pacify GCC. Compilers should be our servants, not our masters, and in this case GCC serves us better by being quiet about a matter that it doesn't grok. > -#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) > +#define _GL_INT_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) <= 0) This change I don't mind so much, as any compiler that can't optimize 0 * e - 1 <= 0 is unlikely to optimize 0 * e - 1 < 0 either. It'd need a comment. If this sort of thing silences all the warnings it might be worth doing.