From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3BAC3384D0C1; Sat, 19 Nov 2022 04:08:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BAC3384D0C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668830900; bh=Dvkdv3q+QY6v0Rr3E/62B2goUrl3hDgHZg/ouYAeLhE=; h=From:To:Subject:Date:From; b=lQ9X7cst3UMeC82J7vT7wbvCIbR/orGt0G0pEuhRhf+yIXXbbf5yiljynl6zliGf7 OCFTiioGanj1uqgoTSMz1CcQMZiOgZ9nyK+KaSs0qZbcEn91opckYg7hVpsNqiGCHH 9HzwNd9oXMRVfnlx2VZA1v/rHuupl06215/ZkbOo= From: "macro at orcam dot me.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107756] New: Change in sizeof(enum) with -std=gnu11 breaks Linux kernel code compilation (PR c/36113 change regression) Date: Sat, 19 Nov 2022 04:08:17 +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: macro at orcam dot me.uk 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 cc target_milestone cf_gcctarget attachments.created 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=3D107756 Bug ID: 107756 Summary: Change in sizeof(enum) with -std=3Dgnu11 breaks Linux kernel code compilation (PR c/36113 change regression) Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: macro at orcam dot me.uk CC: jsm28 at gcc dot gnu.org Target Milestone: --- Target: mips-linux-gnu Created attachment 53929 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D53929&action=3Dedit Preprocessor output from libahci.c; use lzip to decompress The fix for PR c/36113 has added support for C2x enums wider than int, but it seems to affect code built for earlier standards, such as with `-std=3Dgnu11' and libahci.c code from Linux kernel, which causes an assertion failure with the `mips-linux-gnu' (o32) target as from commit 3b3083a598ca ("c: C2x enums wider than int [PR36113]"): In file included from : drivers/ata/libahci.c: In function 'ahci_led_store': ././include/linux/compiler_types.h:357:45: error: call to '__compiletime_assert_309' declared with attribute error: BUILD_BUG_ON fail= ed: sizeof(_s) > sizeof(long) 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^ ././include/linux/compiler_types.h:338:25: note: in definition of macro '__compiletime_assert' 338 | prefix ## suffix();=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ | ^~~~~~ ././include/linux/compiler_types.h:357:9: note: in expansion of macro '_compiletime_assert' 357 | _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) | ^~~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert' 39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) | ^~~~~~~~~~~~~~~~~~ ./include/linux/build_bug.h:50:9: note: in expansion of macro 'BUILD_BUG_ON_MSG' 50 | BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condit= ion) | ^~~~~~~~~~~~~~~~ ./include/linux/nospec.h:58:9: note: in expansion of macro 'BUILD_BUG_ON' 58 | BUILD_BUG_ON(sizeof(_s) > sizeof(long));=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 \ | ^~~~~~~~~~~~ drivers/ata/libahci.c:1198:23: note: in expansion of macro 'array_index_nos= pec' 1198 | pmp =3D array_index_nospec(pmp, EM_MAX_SLOTS); | ^~~~~~~~~~~~~~~~~~ with the compiler invocation as follows: mips-linux-gnu-gcc -Wp,-MMD,drivers/ata/.libahci.o.d -nostdinc -I./arch/mips/include -I./arch/mips/include/generated -I./include -I./arch/mips/include/uapi -I./arch/mips/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -incl= ude ./include/linux/compiler_types.h -D__KERNEL__ -DVMLINUX_LOAD_ADDRESS=3D0xffffffff80100000 -DLINKER_LOAD_ADDRESS=3D0x80100= 000 -DDATAOFFSET=3D0 -fmacro-prefix-map=3D./=3D -Wall -Wundef -Werror=3Dstrict-= prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=3Dimplicit-function-declaration -Werror=3Dimplicit-int -Werror=3Dre= turn-type -Wno-format-security -std=3Dgnu11 -mno-check-zero-division -mabi=3D32 -G 0 -mno-abicalls -fno-pic -pipe -msoft-float -DGAS_HAS_SET_HARDFLOAT -Wa,-msoft-float -ffreestanding -EB -fno-stack-check -Wa,-mno-fix-loongson3-llsc -march=3Dmips32r2 -Wa,--trap -DTOOLCHAIN_SUPPORTS_VIRT -DTOOLCHAIN_SUPPORTS_XPA -DTOOLCHAIN_SUPPORTS_CRC -DTOOLCHAIN_SUPPORTS_DSP -DTOOLCHAIN_SUPPORTS_GINV -I./arch/mips/include/asm/mach-malta -I./arch/mips/include/asm/mach-generic -fno-asynchronous-unwind-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=3D2048 -fno-stack-protector -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-point= er -fomit-frame-pointer -fno-stack-clash-protection -Wdeclaration-after-statem= ent -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -Wimplicit-fallthrough=3D5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=3Ddate-time -Werror=3Dincompatible-pointer-types -Werror=3Ddesignated-init -Wno-packed-not-aligned -DKBUILD_MODFILE=3D'"drivers/ata/libahci"' -DKBUILD_BASENAME=3D'"libahci"' -DKBUILD_MODNAME=3D'"libahci"' -D__KBUILD_MODNAME=3Dkmod_libahci -c -o drivers/ata/libahci.o drivers/ata/libahci.c This code builds just fine with earlier GCC checkouts. I have attached preprocessor output from libahci.c.=