public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cnsun at uwaterloo dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/104237] [11 Regression] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute since r11-3126-ga8f9b4c54cc35062
Date: Wed, 23 Feb 2022 16:03:43 +0000	[thread overview]
Message-ID: <bug-104237-4-DXGHaWSoI7@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104237-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #13 from Chengnian Sun <cnsun at uwaterloo dot ca> ---
(In reply to Jakub Jelinek from comment #10)
> Because -fcompare-debug tells the driver to compile the TU twice, once
> without and once with -gtoggle, and compare the result.
> So, if there is a difference in the generated IL e.g. for -flto
> -ffat-lto-objects, it will detect it.
> Just watch
> gcc -flto -O1 pr104237.c  -o pr104237 -g -fcompare-debug -v 2>&1 | grep
> 'cc1\|lto1'
> to see that, cc1 is invoked twice, once without -gtoggle, once with it, but
> lto1 is invoked just twice, once for wpa and once for ltrans.
> Even if you convince the linker plugin to pass -fcompare-debug even to the
> driver that invokes lto1, that would again compare lto1 with and without -g
> but only
> on a single input (depending on whether the original command line has -g
> with or without debug stmts in it).
> To reproduce this bug, one needs to do a "manual -fcompare-debug", which is
> gcc -flto -O1 pr104237.c  -o pr104237 -g // + force lto1 to pass
> -fdump-final-insns=1
> gcc -flto -O1 pr104237.c  -o pr104237 // + force lto1 to pass
> -fdump-final-insns=2
> diff -up 1 2
> Now, in theory the driver could arrange that, but it would only handle the
> trivial case when the compilation and linking are from the same command.
> Typically with LTO, compilation is done separately and linking is done
> separately, and I don't see how the driver could arrange for that to work,
> we need in that case two sets of *.o files with the IL, one with -g0 and one
> with -g, link twice and compare the result at the end.

Thank you so much for the detailed explanation.

  parent reply	other threads:[~2022-02-23 16:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  6:06 [Bug lto/104237] New: Emitted binary code changes when -g is enabled at -O1 -flto tlwang at uwaterloo dot ca
2022-01-26  6:13 ` [Bug lto/104237] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute pinskia at gcc dot gnu.org
2022-01-26  8:39 ` [Bug lto/104237] [11/12 Regression] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute since r11-3126-ga8f9b4c54cc35062 marxin at gcc dot gnu.org
2022-01-27 14:59 ` jakub at gcc dot gnu.org
2022-01-27 16:26 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:58 ` dmalcolm at gcc dot gnu.org
2022-01-28 10:49 ` cvs-commit at gcc dot gnu.org
2022-01-28 10:57 ` [Bug lto/104237] [11 " jakub at gcc dot gnu.org
2022-01-29  6:35 ` cnsun at uwaterloo dot ca
2022-01-29  9:07 ` jakub at gcc dot gnu.org
2022-02-19  8:02 ` cvs-commit at gcc dot gnu.org
2022-02-19  8:06 ` jakub at gcc dot gnu.org
2022-02-23 16:03 ` cnsun at uwaterloo dot ca [this message]
2022-03-08 20:34 ` cnsun at uwaterloo dot ca
2022-03-08 20:48 ` pinskia at gcc dot gnu.org
2022-03-08 20:49 ` jakub at gcc dot gnu.org
2022-03-08 21:07 ` cnsun at uwaterloo dot ca
2022-06-01 15:02 ` cnsun at uwaterloo dot ca
2022-06-01 16:23 ` pinskia at gcc dot gnu.org
2022-06-01 16:42 ` jakub at gcc dot gnu.org
2022-06-01 17:12 ` cnsun at uwaterloo dot ca

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-104237-4-DXGHaWSoI7@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).