public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "frankhb1989 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options
Date: Fri, 28 Jul 2023 13:12:41 +0000	[thread overview]
Message-ID: <bug-110844-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 110844
           Summary: LTO sometimes fail with -save-temp -dumpdir options
           Product: gcc
           Version: 13.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frankhb1989 at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Cases:

$ cd /tmp
$ g++ --version
g++ (GCC) 13.1.1 20230714
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ echo 'int main(){}' > a.cc
$ g++ -flto -c a.cc -o a.o
$ g++ -flto -save-temps -dumpdir . a.o
$ g++ -flto -c a.cc -o a.o -save-temps -dumpdir .
$ g++ -flto -save-temps -dumpdir . a.o
$ g++ -flto -save-temps -dumpdir /tmp/ a.o
/usr/sbin/ld: error: could not open arguments file
collect2: error: ld returned 1 exit status

The error message is from lto-plugin.c. Setting the environment variables 
(indicated by 'g++ -v' and then 'collect2 -v' from the result) properly, by "b
fopen if *(char*)$rsi == 'w'" for ld running in gdb a few times, it shows
something goes wrong in 'link_output_name' which forms 'arguments_file_name':
the variable incorrectly contains all the remain characters in the command
line. (This is also reproduced in MSYS2 ld which has no debug symbols
distributed together, after changing $rsi to $rdx.) The parsing implementation
of '-dumpdir' arguments introduced in 1dedc12d186a110854537e1279b4e6c29f2df35a
then looks quite suspicious.

             reply	other threads:[~2023-07-28 13:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28 13:12 frankhb1989 at gmail dot com [this message]
2023-07-28 21:52 ` [Bug lto/110844] " pinskia at gcc dot gnu.org
2023-07-28 22:01 ` pinskia at gcc dot gnu.org
2023-07-31  8:11 ` rguenth at gcc dot gnu.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-110844-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).