From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0D00B385840E; Thu, 3 Nov 2022 07:57:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0D00B385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667462264; bh=sW+Hrb4PLSjXjETSxeFbV3pbihRzIwfc30PElKUHG2M=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hVJtRziJKBXerm5ObbnEQSRpOXWTIJFOk/wB5GTjuozAbLaaOc+bvIIAmEznSdz9s zs2T0hi04P5dse0mBm0NFBZmLbWioDueTy3I3H9vOCIHCRp4y8p7edR89XYTtffdiS bSSR4Fs0widlFTry3tWlAxAdHPyo2PB9mmu8ILIk= From: "rdiezmail-gcc at yahoo dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107500] Useless atexit entry for ~constant_init in eh_globals.cc Date: Thu, 03 Nov 2022 07:57: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: 12.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rdiezmail-gcc at yahoo dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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=3D107500 --- Comment #16 from R. Diez --- I am slowly arriving at a different conclusion. "struct __cxa_eh_globals" has neither a constructor nor a destructor. Its members are pointers or integers, so GCC will not have automatically genera= ted any constructor or destructor for this structure. Therefore, variable "static __cxa_eh_globals eh_globals" in the past was already initialised before any users (probably because static memory being zeroed on start-up). The situation has not changed now. This static variable already outlived anything else, as there was no destru= ctor changing anything on termination. Your patch introduced wrapper "struct constant_init" around it, which makes= GCC generate a constructor for the wrapper solely to register an empty destruct= or with atexit(). Otherwise, the wrapper does nothing else useful. Your patch also changes '__eh_globals_init::_M_init' (a different global object) to a static member. Is that not enough to fix the original problem?=