public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug driver/108328] New: gcc --help -v doesn't work correctly in some circumstances in gcc>=10
@ 2023-01-07 11:26 sagimor6 at gmail dot com
  2023-01-07 11:35 ` [Bug driver/108328] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: sagimor6 at gmail dot com @ 2023-01-07 11:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108328
           Summary: gcc --help -v doesn't work correctly in some
                    circumstances in gcc>=10
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: driver
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sagimor6 at gmail dot com
  Target Milestone: ---

Created attachment 54210
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54210&action=edit
patch to fix the bug

works:
gcc --help -v 2>/dev/null | grep ffunction-sections

(prints the ffunction-section description)

doesn't work:
gcc -Wl,--some-flag --help -v 2>/dev/null | grep ffunction-sections

(nothing is printed)
I am sure that this behavior is incorrect.

also (but maybe less important):
gcc a.c a.c a.c a.c --help -v 2>/dev/null | grep ffunction-sections

this prints the help 4 times (as many times as there are input files).
I am also sure that this behavior is incorrect. 

Some programs depend on --help -v to work, for example python. python checks if
fwrapv is supported with the mechanism. buildroot uses something called
toolchain-wrapper to add default flags to gcc when you call it, if you would
check the bootlin compilers in aarch64 they add -Wl,-z,relro by default. So, if
you were to compile python with a bootlin compiler with gcc>=10 it will not
compile with all the correct flags (no fwrapv).
This is just one example (this is where I noticed the bug).


The bug was introduced in the following commit:
https://github.com/gcc-mirror/gcc/commit/2dcfc8722b6146e479039a2f8994050c772b25e6
(commit 2dcfc8722b6146e479039a2f8994050c772b25e6)

So the bug only exists in gcc>=10, and doesn't in gcc<=9.

I created a patch to revert a small part of this commit (will send to the gcc
patches mailing list as well). I tested the patch.

One of the reasons I am sure this is a bug is because of the comment above the
if statement: "Ensure we only invoke each subprocess once.", so the help should
be printed once and only once.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-01-08  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 11:26 [Bug driver/108328] New: gcc --help -v doesn't work correctly in some circumstances in gcc>=10 sagimor6 at gmail dot com
2023-01-07 11:35 ` [Bug driver/108328] " pinskia at gcc dot gnu.org
2023-01-07 11:40 ` pinskia at gcc dot gnu.org
2023-01-07 12:09 ` sagimor6 at gmail dot com
2023-01-08  6:54 ` sagimor6 at gmail dot com
2023-01-08  7:01 ` pinskia at gcc dot gnu.org
2023-01-08  8:45 ` sagimor6 at gmail dot com
2023-01-08  9:10 ` sagimor6 at gmail dot com

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).