From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5546D3857036; Wed, 26 Oct 2022 04:26:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5546D3857036 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666758398; bh=aZMGE5+9zTT31F21I7WnYDKMbuFnv9/DfNI7fhj5774=; h=From:To:Subject:Date:From; b=lDOgSRQak4FPbCvz9aUM5bk8ywkGs3jazCbvjgItjwKbZMoVoU9xLXaZ8hUPxDeSj No0jADckMHaS493WHc1WKrw7GDtaGBXc3a39ttmJ5vZ8tiUQvWJLeD9+YpQoTNCXu8 Ck2+QniG7wje1EMeqPHlKiG6zjMKMv3jojNet8Ro= From: "jirislaby at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107405] New: enums can be long in gcc-13 Date: Wed, 26 Oct 2022 04:26:37 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jirislaby at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107405 Bug ID: 107405 Summary: enums can be long in gcc-13 Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jirislaby at gmail dot com Target Milestone: --- While compiling the kernel (next/master -- 89bf6e28373beef9) with gcc-13, I see: drivers/block/mtip32xx/mtip32xx.c:722:25: error: format '%x' expects argume= nt of type 'unsigned int', but argument 3 has type 'long in' [-Werror=3Dformat= =3D] That is: enum { Many members, see: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/inc= lude/linux/ata.h?id=3D4dc12f37a8e98e1dca5521c14625c869537b50b6#n25 }; ... #define PORT_IRQ_HANDLED \=20=20=20=20=20=20 (PORT_IRQ_SDB_FIS | PORT_IRQ_LEGACY | \ PORT_IRQ_TF_ERR | PORT_IRQ_IF_ERR | \ PORT_IRQ_CONNECT | PORT_IRQ_PHYRDY) ... u32 port_stat; ... dev_warn(&dd->pdev->dev, "Port stat errors %x unhandled\n", (port_stat & ~PORT_IRQ_HANDLED)); So port_stat is uint, ~PORT_IRQ_HANDLED is derived from enum, which should = be int from standard. Reduced testcase: #include enum { A =3D 0xffffffff, B =3D 1 << 31, }; int main() { printf("%lx %x %zu\n", A, B, sizeof(B)); } $ gcc-13 -std=3Dgnu99 x.c -Wall -O2 && ./a.out x.c: In function =E2=80=98main=E2=80=99: x.c:3:27: warning: format =E2=80=98%x=E2=80=99 expects argument of type =E2= =80=98unsigned int=E2=80=99, but argument 3 has type =E2=80=98long int=E2=80=99 [-Wformat=3D] 3 | int main() { printf("%lx %x %zu\n", A, B, sizeof(B)); } | ~^ ~ | | | | unsigned int long int | %lx ffffffff 80000000 8 $ gcc-12 -std=3Dgnu11 x.c -Wall -O2 && ./a.out ffffffff 80000000 4=