public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options
@ 2023-07-28 13:12 frankhb1989 at gmail dot com
2023-07-28 21:52 ` [Bug lto/110844] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: frankhb1989 at gmail dot com @ 2023-07-28 13:12 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/110844] LTO sometimes fail with -save-temp -dumpdir options
2023-07-28 13:12 [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options frankhb1989 at gmail dot com
@ 2023-07-28 21:52 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28 21:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110844
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 55655
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55655&action=edit
strace output
Attached is the `strace -f` output of invoking `g++ -flto -save-temps -dumpdir
/tmp/ a.o` for the trunk.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/110844] LTO sometimes fail with -save-temp -dumpdir options
2023-07-28 13:12 [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options frankhb1989 at gmail dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-28 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110844
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2023-07-28
Status|UNCONFIRMED |NEW
Keywords| |link-failure
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The file that is being tried to open is:
[pid 1299400] openat(AT_FDCWD, "/tmp/ -v -shared-libgcc -mtune=generic
-march=x86-64 -dumpdir /tmp/lto_wrapper_args", O_WRONLY|O_CREAT|O_TRUNC, 0666)
= -1 ENOENT (No such file or directory)
COLLECT_GCC_OPTIONS='-flto' '-save-temps' '-dumpdir' '/tmp/' '-v'
'-shared-libgcc' '-mtune=generic' '-march=x86-64' '-dumpdir' '/tmp/'
The code in lto-plugin/lto-plugin.c:1614 does not handle the case where there
are 2 -dumpdir option.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug lto/110844] LTO sometimes fail with -save-temp -dumpdir options
2023-07-28 13:12 [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options frankhb1989 at gmail dot com
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
2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-31 8:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110844
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
we shouldn't pass it two times either
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-31 8:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28 13:12 [Bug lto/110844] New: LTO sometimes fail with -save-temp -dumpdir options frankhb1989 at gmail dot com
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
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).