From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0148C3858D3C; Fri, 11 Mar 2022 11:00:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0148C3858D3C From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/104869] [12 Regression] Miscompilation of qt5-qtdeclarative since r12-6342-ge7a7dbb5ca5dd696 Date: Fri, 11 Mar 2022 11:00:24 +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: 12.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status everconfirmed 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: Fri, 11 Mar 2022 11:00:25 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104869 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2022-03-11 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Jakub Jelinek --- Reduced self-contained testcase for the testsuite: // PR rtl-optimization/104869 // { dg-do run } // { dg-options "-O2 -fvisibility=3Dhidden" } // { dg-require-visibility "" } struct QBasicAtomicInteger { [[gnu::noipa]] int loadRelaxed() { return 1; } }; struct RefCount { bool deref() { int count =3D atomic.loadRelaxed(); if (count) return false; return deref(); } QBasicAtomicInteger atomic; }; struct QArrayData { RefCount ref; }; struct QString { ~QString(); QArrayData d; }; int ok; QString::~QString() { d.ref.deref(); } struct Label { bool isValid() { return generator; } int *generator; int index; }; struct ControlFlow; struct Codegen { [[gnu::noipa]] bool visit(); ControlFlow *controlFlow; }; struct ControlFlow { enum UnwindType { EE }; struct UnwindTarget { Label linkLabel; }; ControlFlow *parent; UnwindType unwindTarget_type; UnwindTarget unwindTarget() { QString label; ControlFlow *flow =3D this; while (flow) { Label l =3D getUnwindTarget(unwindTarget_type, label); if (l.isValid()) return {l}; flow =3D flow->parent; } return UnwindTarget(); } [[gnu::noipa]] Label getUnwindTarget(UnwindType, QString &) { Label l =3D { &ok, 0 }; return l; } }; [[gnu::noipa]] void foo(int) { ok =3D 1; } [[gnu::noipa]] bool Codegen::visit() { if (!controlFlow) return false; ControlFlow::UnwindTarget target =3D controlFlow->unwindTarget(); if (target.linkLabel.isValid()) foo(2); return false; } int main() { ControlFlow cf =3D { nullptr, ControlFlow::UnwindType::EE }; Codegen c =3D { &cf }; c.visit(); if (!ok) __builtin_abort (); }=