From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 073E4385843E; Tue, 10 Jan 2023 14:05:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 073E4385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1673359502; bh=B9nPGlHNEgSdllo+WfouRKma4cH2FtSOP7iFYh2kAyY=; h=From:To:Subject:Date:From; b=L1DWjh4Tgdcdf56V8csnC/Hej1rLLoIOf3Q0HhEZtd+QlxI703XoiwyJW8hfbrz/m 100s11ORM233qniJl89Axy+7KLUL8Gvgqg6/FOVFByz6OKogtbA4q9st78o8HlsV7A hwIk0qSmGkV38EcJNTHMNZfqZ25rPIrw+2rtNu0I= From: "eric-bugs at omnifarious dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108361] New: Assembly code that is never called emitted on x86_64 Date: Tue, 10 Jan 2023 14:05:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eric-bugs at omnifarious dot 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D108361 Bug ID: 108361 Summary: Assembly code that is never called emitted on x86_64 Product: gcc Version: 12.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: eric-bugs at omnifarious dot org Target Milestone: --- Created attachment 54236 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54236&action=3Dedit Preprocessed C++ code that generates unneeded assembly The nature of this bug makes a concise test case hard to whittle down to something minimal... The attached code generates a whole bunch of assembly that isn't needed. Th= is assembly references external symbols as well, which creates unnecessary lin= ker errors. Clang handles it just fine. :-) Attached is both the preprocessed C++ code, and the assembly it generates. = The only needed assembly is the code for main and the static data main needs. _start is defined as a global in a separate file, which is also attached. The compile command I'm using: g++ -std=3Dc++20 -march=3Dznver2 -static -O3 -nostartfiles -nostdlib -I/usr/include/c++/12 -I/home/hopper/src/posixpp/pubincludes -Wl,-e_start preprocessed.s x86_64_start.s=