From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BCB43858409; Wed, 2 Nov 2022 13:36:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BCB43858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667396208; bh=5UgxXuiqloKJEEGAlJJ1czvisJ4zlA0Ete5EfHIS99E=; h=From:To:Subject:Date:In-Reply-To:References:From; b=FnARfT6FT+sSELQKxby3003N5R9j+kBV7fjF3DNNdVRrYbpZdGU0L/tz0Kj3D72nR qh2NvYciFf8hY1phZ/kUeQ/GLXOBTsMniiggHHVZ6UGtzuwLWyE5flO2JKRQBSC4wS zOIry9Md76xSnednzpW/kSrzWDawsDVtD5fNK+ms= 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: Wed, 02 Nov 2022 13:36:48 +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: NEW 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=3D107500 --- Comment #9 from R. Diez --- > [...] > not just "turn on -Os and all the code gets removed". I am sure that the solution is not as trivial as "turn on -Os". But, as an outsider, it is hard to believe that it "takes non-trivial analysis of the destructor body". The destructor is empty! I am not talking about the GCC optimiser realising afterwards that the code= is generating an atexit() entry that does nothing. I am saying that GCC should= not generate so much code for an empty function for starters, and that GCC shou= ld not generate the destructor registration at all if the destructor is empty.= I would imagine that those steps come before the optimiser gets to see the generated code.=