public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0
@ 2020-12-14 13:55 pexu@gcc-bugzilla.mail.kapsi.fi
2020-12-14 16:15 ` [Bug lto/98275] " marxin at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pexu@gcc-bugzilla.mail.kapsi.fi @ 2020-12-14 13:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98275
Bug ID: 98275
Summary: -flto=auto fails if nthreads_var is zero, must not
pass -j0
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: pexu@gcc-bugzilla.mail.kapsi.fi
CC: marxin at gcc dot gnu.org
Target Milestone: ---
Host: mingw64
Hi.
When using `-flto=auto' if the number of threads is not detected, i.e.
`nthreads_var' equals to zero, lto-wrapper must not pass -j0 to GNU make as -j
expects a positive, non-zero integer (if any given).
>From GNU make manual: ``If the ‘-j’ option is followed by an integer, this is
the number of recipes to execute at once; this is called the number of job
slots. If there is nothing looking like an integer after the ‘-j’ option, there
is no limit on the number of job slots.''.
gcc/lto-wrapper.c:
2001 snprintf (jobs, 31, "-j%ld",
2002 auto_parallel ? nthreads_var : parallel);
$ make -j0
make: the '-j' option requires a positive integer argument
Tried GNU make 4.2.1 (2016 vintage) and 4.2.93 (2020). For the latest trunk
argument parsing happens at src/main.c around line 2961 [1]; It basically does
``int i = atoi(arg); if (i < 1 || not-all-chars-are-digits) { handle-bad-arg
}''.
[1] https://git.savannah.gnu.org/cgit/make.git/tree/src/main.c#n2961
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/98275] -flto=auto fails if nthreads_var is zero, must not pass -j0
2020-12-14 13:55 [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0 pexu@gcc-bugzilla.mail.kapsi.fi
@ 2020-12-14 16:15 ` marxin at gcc dot gnu.org
2020-12-15 9:07 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-14 16:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98275
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2020-12-14
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Thank you for the bug report.
Can you please test the following patch:
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c
index 68ccb156521..da1305c1696 100644
--- a/gcc/lto-wrapper.c
+++ b/gcc/lto-wrapper.c
@@ -1780,6 +1780,8 @@ cont1:
{
char buf[256];
init_num_threads ();
+ if (nthreads_var == 0)
+ nthreads_var = 1;
if (verbose)
fprintf (stderr, "LTO parallelism level set to %ld\n",
nthreads_var);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/98275] -flto=auto fails if nthreads_var is zero, must not pass -j0
2020-12-14 13:55 [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0 pexu@gcc-bugzilla.mail.kapsi.fi
2020-12-14 16:15 ` [Bug lto/98275] " marxin at gcc dot gnu.org
@ 2020-12-15 9:07 ` cvs-commit at gcc dot gnu.org
2020-12-15 9:10 ` marxin at gcc dot gnu.org
2020-12-15 10:12 ` pexu@gcc-bugzilla.mail.kapsi.fi
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-15 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98275
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:
https://gcc.gnu.org/g:cab1b0ebc00ea53040afcbe4b91e653a87915092
commit r11-6040-gcab1b0ebc00ea53040afcbe4b91e653a87915092
Author: Martin Liska <mliska@suse.cz>
Date: Tue Dec 15 09:59:04 2020 +0100
lto: set nthreads_var to 1 if it is zero
gcc/ChangeLog:
PR lto/98275
* lto-wrapper.c: Do not use -j0 when we are unable to detect
number of cores.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/98275] -flto=auto fails if nthreads_var is zero, must not pass -j0
2020-12-14 13:55 [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0 pexu@gcc-bugzilla.mail.kapsi.fi
2020-12-14 16:15 ` [Bug lto/98275] " marxin at gcc dot gnu.org
2020-12-15 9:07 ` cvs-commit at gcc dot gnu.org
@ 2020-12-15 9:10 ` marxin at gcc dot gnu.org
2020-12-15 10:12 ` pexu@gcc-bugzilla.mail.kapsi.fi
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-12-15 9:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98275
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Should be fixed now.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug lto/98275] -flto=auto fails if nthreads_var is zero, must not pass -j0
2020-12-14 13:55 [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0 pexu@gcc-bugzilla.mail.kapsi.fi
` (2 preceding siblings ...)
2020-12-15 9:10 ` marxin at gcc dot gnu.org
@ 2020-12-15 10:12 ` pexu@gcc-bugzilla.mail.kapsi.fi
3 siblings, 0 replies; 5+ messages in thread
From: pexu@gcc-bugzilla.mail.kapsi.fi @ 2020-12-15 10:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98275
--- Comment #4 from Pekka S <pexu@gcc-bugzilla.mail.kapsi.fi> ---
(I wrote this prior the ticked was modifed and the patch committed.)
Thanks.
Applied the patch on the latest trunk, built aarch64-none-gcc cross compiler
(mingw64). Using -flto=auto -v reports `LTO parallelism level set to 1' and
`make -f <temporary.mk> -j1 all'; Linking now succeeds.
Tested using GNU make 4.2.93 and 4.3 (msys2).
I do not know whether or not the number of processors should be actually
detectable. I presume I'll be simply using -flto=N (N>1) as it appears to work
just fine.
As a side note behaviour is now slightly different between -flto=auto if
nthreads_var<=1 and -flto=N where N<=1.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-12-15 10:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 13:55 [Bug lto/98275] New: -flto=auto fails if nthreads_var is zero, must not pass -j0 pexu@gcc-bugzilla.mail.kapsi.fi
2020-12-14 16:15 ` [Bug lto/98275] " marxin at gcc dot gnu.org
2020-12-15 9:07 ` cvs-commit at gcc dot gnu.org
2020-12-15 9:10 ` marxin at gcc dot gnu.org
2020-12-15 10:12 ` pexu@gcc-bugzilla.mail.kapsi.fi
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).