From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D00783858C39; Thu, 9 Dec 2021 20:59:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D00783858C39 From: "js-gcc at webkeks dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug objc/103639] New: [REGRESSION] GCC 11.2 (or even earlier) breaks switch case with break in fast enumeration loop Date: Thu, 09 Dec 2021 20:59:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: objc X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: js-gcc at webkeks dot org 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Dec 2021 20:59:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103639 Bug ID: 103639 Summary: [REGRESSION] GCC 11.2 (or even earlier) breaks switch case with break in fast enumeration loop Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: objc Assignee: unassigned at gcc dot gnu.org Reporter: js-gcc at webkeks dot org Target Milestone: --- The following code is miscompiled by GCC 11.2.1. I don't know when this started, but this is a regression and used to work just fine in older versi= on: for (id object in someCollection) { switch (someVar) { case 0: puts("0"); break; } puts("this should print but doesn't"); } The break breaks out of the for loop instead of the switch case. Changing the code to this makes it work: for (id object in someCollection) { if (someVar =3D=3D 0) { puts("0"); break; } puts("this should print and does"); } This worked just fine with older GCC versions and also works fine with all versions of Clang.=