From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2BB2538582A2; Wed, 6 Mar 2024 06:56:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2BB2538582A2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709708201; bh=PZeWaphgwVyvE5d5L01oPwrJN6vIWU8dl+mKJAS2qD4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K6ZsWiTUXGEVc1L9MnLEr3FRTS2+9F2wdAtPw6k2Ps+CbF5+V3RGvHTehgQf76B0u bFylgecv/G+4SSxzA4iIKGgRJ31v8F/Z5pUgAyPBpUvdCCVYiOXYihRIlipVDz9jJr F+6+lh37fXf+N4BjgDZYC4Kt5Hab9U+hQbyf0eC0= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/114245] Defaulted virtual destructors that do no work overwrite the vtable with `-O0` Date: Wed, 06 Mar 2024 06:56:40 +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.2.0 X-Bugzilla-Keywords: link-failure X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.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: 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=3D114245 --- Comment #2 from Andrew Pinski --- I am trying to understand the issue of having the vtable writing to the obj= ect. Is the issue you have an order issue where an object is destroyed but still= in use else where, that sounds like an undefined behavior in your code. >you easily run into static de-init fiasco issues=20 Yes this sounds like you are runing into what I have described as being undefined behavior. Changing GCC here just works around the broken code whi= ch I doubt is a good idea. If you need a specific order, across TUs, well C++ do= es not define them. GCC does have an init_priority attribute which could be used here to fix the issue as earlier initializations are deconstructed later.=