From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5384C3858425; Thu, 10 Mar 2022 18:33:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5384C3858425 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104777] [9/10/11 Regression] gcc crashes while compiling a custom coroutine library sample Date: Thu, 10 Mar 2022 18:33:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: ice-on-valid-code, inline-asm X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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 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, 10 Mar 2022 18:33:30 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104777 --- Comment #10 from CVS Commits --- The releases/gcc-11 branch has been updated by Marek Polacek : https://gcc.gnu.org/g:d66c45fdc14bf88f7390a75129462640c59ce48e commit r11-9647-gd66c45fdc14bf88f7390a75129462640c59ce48e Author: Marek Polacek Date: Mon Mar 7 16:15:46 2022 -0500 rtl: ICE with thread_local and inline asm [PR104777] In r270550, Jakub fixed classify_insn to handle asm goto: if the asm can jump to a label, the insn should be a JUMP_INSN. However, as the following testcase shows, non-null ASM_OPERANDS_LABEL_V= EC doesn't guarantee that the rtx has any actual labels it can branch to. Here, the rtvec has 0 elements because expand_asm_stmt created it: rtvec labelvec =3D rtvec_alloc (nlabels); // nlabels =3D=3D 0 This causes an ICE in update_br_prob_note: BRANCH_EDGE (bb) crashes because there's no branch edge. I think we can fix this by checking that there is at least one label the asm can jump to before wrapping the ASM_OPERANDS in a JUMP_INSN. PR rtl-optimization/104777 gcc/ChangeLog: * rtl.c (classify_insn): For ASM_OPERANDS, return JUMP_INSN onl= y if ASM_OPERANDS_LABEL_VEC has at least one element. gcc/testsuite/ChangeLog: * gcc.dg/torture/tls/pr104777.c: New test. (cherry picked from commit e1133c0205a7e2a65834a1af780b8da15eead2a9)=