From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 071DB384B837; Wed, 26 Oct 2022 07:27:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 071DB384B837 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666769262; bh=lvrDK6hYDhbjTEew9Np8hSb4QzCpOKyZS6rioEZYtg8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=rZKpccEEXeIvvlaFLmsrrfCk9TEz7/VnOAVBFBOq38zTTes6mSxjwmbdYQuNtE56D bKqx/p7v4Rtf5IX6D3VcY2ulZdVWAoWCcx1JWG6Pl++TFNWOToOCR5D8YAUEI5rj4C Ihzuv7wWhcSjRRTxVUQu+OLACYJ3RFnzlBJDSWFY= 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 07:27:41 +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 #4 from Jiri Slaby --- (In reply to Martin Li=C5=A1ka from comment #3) > > enum { A =3D 0xffffffff, B =3D 1 << 31, }; > > int main() { printf("%lx %x %zu\n", A, B, sizeof(B)); } > >=20 >=20 > Apparently, 0xffffffff is treated by the compiler as unsigned int constant > and thus it likely leads to the promotion to a longer interger. The problem is that is breaks existing code (which will be barely fixed as = this is clearly gcc-13's bug (or change of behavior at least)). 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.=