From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 44997 invoked by alias); 28 Apr 2015 10:45:52 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 44988 invoked by uid 89); 28 Apr 2015 10:45:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 X-HELO: calimero.vinschen.de Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Apr 2015 10:45:49 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 97F86A809B7; Tue, 28 Apr 2015 12:45:47 +0200 (CEST) Date: Tue, 28 Apr 2015 10:45:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: Incorrect compile warning, possible bug in inttypes.h Message-ID: <20150428104547.GZ3657@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <261055273.5586453.1430175146814.JavaMail.yahoo@mail.yahoo.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="kM4gEFU/49KOGupy" Content-Disposition: inline In-Reply-To: <261055273.5586453.1430175146814.JavaMail.yahoo@mail.yahoo.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-04/txt/msg00607.txt.bz2 --kM4gEFU/49KOGupy Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 2145 Hi Cary, On Apr 27 22:52, Cary R. wrote: > The following code: >=20 > #include > #include >=20 > int main() > { > int32_t ival =3D 1; > uint32_t uval =3D 2; >=20 > printf("int =3D %"PRId32", uint =3D %"PRIu32".\n", ival, uval); > return 0; > } >=20 >=20 > when compiled with either gcc or clang on a 32-bit system and with the -W= all flag produces the following warnings: >=20 > tmp.c: In function =E2=80=98main=E2=80=99: > tmp.c:9:5: warning: format =E2=80=98%ld=E2=80=99 expects argument of type= =E2=80=98long int=E2=80=99, but argument 2 has type =E2=80=98int32_t=E2=80= =99 [-Wformat=3D] > printf("int =3D %"PRId32", uint =3D %"PRIu32".\n", ival, uval); > ^ > tmp.c:9:5: warning: format =E2=80=98%lu=E2=80=99 expects argument of type= =E2=80=98long unsigned int=E2=80=99, but argument 3 has type =E2=80=98uint= 32_t=E2=80=99 [-Wformat=3D] > tmp.c:9:5: warning: format =E2=80=98%ld=E2=80=99 expects argument of type= =E2=80=98long int=E2=80=99, but argument 2 has type =E2=80=98int32_t=E2=80= =99 [-Wformat=3D] > tmp.c:9:5: warning: format =E2=80=98%lu=E2=80=99 expects argument of type= =E2=80=98long unsigned int=E2=80=99, but argument 3 has type =E2=80=98uint= 32_t=E2=80=99 [-Wformat=3D] >=20 > I'm not sure why the double report for this, but both gcc and clang do > the same thing. This looks to be an issue that is generated because a > long is 32 bits on a 32-bit system and in inttypes.h __have_long32 is > likely defined and that is forcing the use of the 'l' formats when > that is incorrect for at least these two 32 bit types. That looks like the culprit, yes. This is part of the newlib changes to stdint.h/inttypes.h, and this is apparently a problem. Just because long is a 32 bit type doesn't mean it's the base type of int32_t/uint32_t. What bugs me most is that I tried to test the changes and failed to see this problem. Grr. I'll discuss this on the newlib mailing list. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --kM4gEFU/49KOGupy Content-Type: application/pgp-signature Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVP2TbAAoJEPU2Bp2uRE+gnJgP/0SXmUVgZQxAizWLXPw3JPip SujB/mBjjj6iHyVVDcZ7leUl5iArWePn9M8dAWzmnL1wsJ38gqcW3PdriTmT5V3b s0AwYrj/NUapqPsm8M94je8IFrGePxpta8/S4FbfLFHFMiziUiLwy+608LwNYgZ1 Cqu6qr/JbX9phaqyoVeLIa6phN6UpPlfEBcZVM7HTQjBGoa0ViwjpD9mXo23rM61 f42k9TrwR3VjwHFneDm1K+wJu3sfBQIeUodFKnWd+82nV1/3ak+c2fr92D+CdLjg BHfTcVVbb6IVcXBgnEgqL0EfIFKMQgQXePjdcgU8yZm4yimTRokTzBWcRJRA9Mae teoo7q8pkOyEf/bbWdV8Ulm889u8Yp/DebnJlYvQ8egFZr57GB3tk41i+U46y8Vf +j+YicWphkv60BT1+2TuiXap3fcbYInFFc+89BN3BbQHmHz0AT/i3y5RiYnXkIro FL9aUy+aCnerxQ6yq2FUWDN7kjR+lGyDoc94iZ+wDn6cEHzkeYzaeydspB6uM6Q4 yoFenDWmzSRawJf+W7ayb9CKLig03lA9Pou/AOC5rUTcfwDvGth0y/qKOROox5qI WkpLhRkqFHybYNuhvKcOGK7EwpuXp+kHQxXf5Z+FwGCEoYbJ2gP090k2d825X1tl cPZ/lfzTiKCsd3AKUPZ9 =RHPF -----END PGP SIGNATURE----- --kM4gEFU/49KOGupy--