From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 120463 invoked by alias); 27 Apr 2015 22:53:25 -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 120453 invoked by uid 89); 27 Apr 2015 22:53:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,REPTO_QUOTE_YAHOO,SPF_PASS,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: nm18-vm3.bullet.mail.ne1.yahoo.com Received: from nm18-vm3.bullet.mail.ne1.yahoo.com (HELO nm18-vm3.bullet.mail.ne1.yahoo.com) (98.138.91.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 27 Apr 2015 22:53:24 +0000 Received: from [98.138.100.116] by nm18.bullet.mail.ne1.yahoo.com with NNFMP; 27 Apr 2015 22:53:22 -0000 Received: from [98.138.86.157] by tm107.bullet.mail.ne1.yahoo.com with NNFMP; 27 Apr 2015 22:53:22 -0000 Received: from [127.0.0.1] by omp1015.mail.ne1.yahoo.com with NNFMP; 27 Apr 2015 22:53:22 -0000 Received: by 98.138.101.163; Mon, 27 Apr 2015 22:53:21 +0000 Date: Mon, 27 Apr 2015 22:53:00 -0000 From: "Cary R." Reply-To: "Cary R." To: The Cygwin Mailing List Message-ID: <261055273.5586453.1430175146814.JavaMail.yahoo@mail.yahoo.com> Subject: Incorrect compile warning, possible bug in inttypes.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2015-04/txt/msg00602.txt.bz2 The following code: #include #include int main() { int32_t ival =3D 1; uint32_t uval =3D 2; printf("int =3D %"PRId32", uint =3D %"PRIu32".\n", ival, uval); return 0; } when compiled with either gcc or clang on a 32-bit system and with the -Wal= l flag produces the following warnings: 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=98uint3= 2_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=98uint3= 2_t=E2=80=99 [-Wformat=3D] 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 3= 2 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. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple