public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eric-bugs at omnifarious dot org" <gcc-bugzilla@gcc.gnu.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	[thread overview]
Message-ID: <bug-108361-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108361

            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=54236&action=edit
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. This
assembly references external symbols as well, which creates unnecessary linker
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=c++20 -march=znver2 -static -O3 -nostartfiles -nostdlib
-I/usr/include/c++/12 -I/home/hopper/src/posixpp/pubincludes -Wl,-e_start
preprocessed.s x86_64_start.s

             reply	other threads:[~2023-01-10 14:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-10 14:05 eric-bugs at omnifarious dot org [this message]
2023-01-10 14:05 ` [Bug c++/108361] " eric-bugs at omnifarious dot org
2023-01-10 14:06 ` eric-bugs at omnifarious dot org
2023-01-10 18:25 ` pinskia at gcc dot gnu.org
2023-01-10 18:26 ` pinskia at gcc dot gnu.org
2023-01-10 18:30 ` pinskia at gcc dot gnu.org
2023-01-10 19:00 ` eric-bugs at omnifarious dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108361-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).