From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BDB23959CA8; Wed, 26 Oct 2022 08:39:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BDB23959CA8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666773547; bh=Jbw8BhVVXApBlz0PLqB9v24NyKN3MdL+6LONKWX45Y4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=V7VT+Gu9FcTKY4ejbyWOhw3nf2WmRriPXAgDdhbXcFPC/O3iGcxOcOq0aMeihOgXV 9vDS2d0zaUk38DzwVuXICjdvTINlRx2FdEIw9zIZDLkL2Bu9kmGP+Iefp/5eQchw5n TQTwOwdazbV/sP8ePnPihCsDjuZWbVAGTq4fvN0U= From: "jirislaby at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107405] enums can be wrongly long in gcc-13 (in gnu99) Date: Wed, 26 Oct 2022 08:39:05 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed 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: NEW 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: Message-ID: In-Reply-To: References: 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 --- Comment #10 from Jiri Slaby --- (In reply to Jonathan Wakely from comment #9) > (In reply to Jiri Slaby from comment #4) > > Another question is why B is affected by A at all? Also sizeof of that = enum > > (if one gives it a name) is 8 with gcc-13. That is not allowed by the > > standard, IMO. >=20 > C99, C11, and C17 all say: >=20 > "The expression that defines the value of an enumeration constant shall be > an integer > constant expression that has a value representable as an int." >=20 > So enum { A =3D 0xffffffff } is a constraint violation and not allowed by= the > standard anyway. Such code was always non-conforming and relying on an > (undocumented?) GCC extension, so the standard has nothing to say about t= he > type. Ah, that's correct. So the question then is: is it a feature we can rely on (even if undocumented -- can the behavior can be documented in gcc?), or we should drop enum uses for values > MAX_INT?=