public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] -fprofile-reproducible: fix option value handling
@ 2020-09-11 21:55 Sergei Trofimovich
  2020-09-14  7:34 ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Trofimovich @ 2020-09-11 21:55 UTC (permalink / raw)
  To: gcc-patches, Martin Liska; +Cc: Sergei Trofimovich

From: Sergei Trofimovich <siarheit@google.com>

Before the change option handling did not accept an argument:
  xgcc: error: unknown profile reproducibility method '=serial'
  xgcc: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?

The change also includes trailing '=' as part of option prefix.

gcc/ChangeLog:

	* common.opt: Fix handling of '-fprofile-reproducible' option.
---
 gcc/common.opt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/common.opt b/gcc/common.opt
index dd68c61ae1d..84bf521128d 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2228,7 +2228,7 @@ Enum(profile_reproducibility) String(parallel-runs) Value(PROFILE_REPRODUCIBILIT
 EnumValue
 Enum(profile_reproducibility) String(multithreaded) Value(PROFILE_REPRODUCIBILITY_MULTITHREADED)
 
-fprofile-reproducible
+fprofile-reproducible=
 Common Joined RejectNegative Var(flag_profile_reproducible) Enum(profile_reproducibility) Init(PROFILE_REPRODUCIBILITY_SERIAL)
 -fprofile-reproducible=[serial|parallel-runs|multithreaded]	Control level of reproducibility of profile gathered by -fprofile-generate.
 
-- 
2.28.0


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

* Re: [PATCH] -fprofile-reproducible: fix option value handling
  2020-09-11 21:55 [PATCH] -fprofile-reproducible: fix option value handling Sergei Trofimovich
@ 2020-09-14  7:34 ` Richard Biener
  2020-09-14 22:57   ` Sergei Trofimovich
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2020-09-14  7:34 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: GCC Patches, Martin Liska, Sergei Trofimovich

On Fri, Sep 11, 2020 at 11:56 PM Sergei Trofimovich via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> From: Sergei Trofimovich <siarheit@google.com>
>
> Before the change option handling did not accept an argument:
>   xgcc: error: unknown profile reproducibility method '=serial'
>   xgcc: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?
>
> The change also includes trailing '=' as part of option prefix.

Does it still work without an option then?

OK if so.

> gcc/ChangeLog:
>
>         * common.opt: Fix handling of '-fprofile-reproducible' option.
> ---
>  gcc/common.opt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index dd68c61ae1d..84bf521128d 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -2228,7 +2228,7 @@ Enum(profile_reproducibility) String(parallel-runs) Value(PROFILE_REPRODUCIBILIT
>  EnumValue
>  Enum(profile_reproducibility) String(multithreaded) Value(PROFILE_REPRODUCIBILITY_MULTITHREADED)
>
> -fprofile-reproducible
> +fprofile-reproducible=
>  Common Joined RejectNegative Var(flag_profile_reproducible) Enum(profile_reproducibility) Init(PROFILE_REPRODUCIBILITY_SERIAL)
>  -fprofile-reproducible=[serial|parallel-runs|multithreaded]    Control level of reproducibility of profile gathered by -fprofile-generate.
>
> --
> 2.28.0
>

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

* Re: [PATCH] -fprofile-reproducible: fix option value handling
  2020-09-14  7:34 ` Richard Biener
@ 2020-09-14 22:57   ` Sergei Trofimovich
  2020-09-15  6:40     ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Sergei Trofimovich @ 2020-09-14 22:57 UTC (permalink / raw)
  To: Richard Biener; +Cc: GCC Patches, Martin Liska, Sergei Trofimovich

On Mon, 14 Sep 2020 09:34:08 +0200
Richard Biener <richard.guenther@gmail.com> wrote:

> On Fri, Sep 11, 2020 at 11:56 PM Sergei Trofimovich via Gcc-patches
> <gcc-patches@gcc.gnu.org> wrote:
> >
> > From: Sergei Trofimovich <siarheit@google.com>
> >
> > Before the change option handling did not accept an argument:
> >   xgcc: error: unknown profile reproducibility method '=serial'
> >   xgcc: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?
> >
> > The change also includes trailing '=' as part of option prefix.  
> 
> Does it still work without an option then?

'-fprofile-reproducible' seems to be unacceptable value.

Initially when I sent the patch I though there was no way to pass
the option to gcc. But now I understand how to do it (case 4):

Before:
  1 $ gcc-11.0.0 -c -fprofile-reproducible a.c -o a
  gcc-11.0.0: error: missing argument to '-fprofile-reproducible'
  2 $ gcc-11.0.0 -c -fprofile-reproducible= a.c -o a
  gcc-11.0.0: error: unknown profile reproducibility method '='
  gcc-11.0.0: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial
  3 $ gcc-11.0.0 -c -fprofile-reproducible=serial a.c -o a
  gcc-11.0.0: error: unknown profile reproducibility method '=serial'
  gcc-11.0.0: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?
  4 $ gcc-11.0.0 -c -fprofile-reproducibleserial a.c -o a
  # ok

Note: case 4 was a way to pass the option.

After:
  1 $ ./xgcc -B. -c -fprofile-reproducible a.c -o a.o
  xgcc: error: unrecognized command-line option '-fprofile-reproducible'; did you mean '-fprofile-reproducible='?
  2 $ ./xgcc -B. -c -fprofile-reproducible= a.c -o a.o
  xgcc: error: missing argument to '-fprofile-reproducible='
  3 $ ./xgcc -B. -c -fprofile-reproducible=serial a.c -o a.o
  # ok
  4 $ ./xgcc -B. -c -fprofile-reproducibleserial a.c -o a.o
  xgcc: error: unrecognized command-line option '-fprofile-reproducibleserial'; did you mean '-fprofile-reproducible=serial'?

Note: two problems here:
a) case 2 got worse diagnostic
b) case 4 broke something that worked before

I'll look at "a)" to check if it can be easily fixed. Is "b)" worth handling as well?
I'll need a hint or example how to handle an alias like that.

> OK if so.
> 
> > gcc/ChangeLog:
> >
> >         * common.opt: Fix handling of '-fprofile-reproducible' option.
> > ---
> >  gcc/common.opt | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/gcc/common.opt b/gcc/common.opt
> > index dd68c61ae1d..84bf521128d 100644
> > --- a/gcc/common.opt
> > +++ b/gcc/common.opt
> > @@ -2228,7 +2228,7 @@ Enum(profile_reproducibility) String(parallel-runs) Value(PROFILE_REPRODUCIBILIT
> >  EnumValue
> >  Enum(profile_reproducibility) String(multithreaded) Value(PROFILE_REPRODUCIBILITY_MULTITHREADED)
> >
> > -fprofile-reproducible
> > +fprofile-reproducible=
> >  Common Joined RejectNegative Var(flag_profile_reproducible) Enum(profile_reproducibility) Init(PROFILE_REPRODUCIBILITY_SERIAL)
> >  -fprofile-reproducible=[serial|parallel-runs|multithreaded]    Control level of reproducibility of profile gathered by -fprofile-generate.
> >
> > --
> > 2.28.0
> >  


-- 

  Sergei

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

* Re: [PATCH] -fprofile-reproducible: fix option value handling
  2020-09-14 22:57   ` Sergei Trofimovich
@ 2020-09-15  6:40     ` Richard Biener
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2020-09-15  6:40 UTC (permalink / raw)
  To: Sergei Trofimovich; +Cc: GCC Patches, Martin Liska, Sergei Trofimovich

On Tue, Sep 15, 2020 at 12:57 AM Sergei Trofimovich <slyfox@gentoo.org> wrote:
>
> On Mon, 14 Sep 2020 09:34:08 +0200
> Richard Biener <richard.guenther@gmail.com> wrote:
>
> > On Fri, Sep 11, 2020 at 11:56 PM Sergei Trofimovich via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > From: Sergei Trofimovich <siarheit@google.com>
> > >
> > > Before the change option handling did not accept an argument:
> > >   xgcc: error: unknown profile reproducibility method '=serial'
> > >   xgcc: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?
> > >
> > > The change also includes trailing '=' as part of option prefix.
> >
> > Does it still work without an option then?
>
> '-fprofile-reproducible' seems to be unacceptable value.
>
> Initially when I sent the patch I though there was no way to pass
> the option to gcc. But now I understand how to do it (case 4):
>
> Before:
>   1 $ gcc-11.0.0 -c -fprofile-reproducible a.c -o a
>   gcc-11.0.0: error: missing argument to '-fprofile-reproducible'
>   2 $ gcc-11.0.0 -c -fprofile-reproducible= a.c -o a
>   gcc-11.0.0: error: unknown profile reproducibility method '='
>   gcc-11.0.0: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial
>   3 $ gcc-11.0.0 -c -fprofile-reproducible=serial a.c -o a
>   gcc-11.0.0: error: unknown profile reproducibility method '=serial'
>   gcc-11.0.0: note: valid arguments to '-fprofile-reproducible' are: multithreaded parallel-runs serial; did you mean 'serial'?
>   4 $ gcc-11.0.0 -c -fprofile-reproducibleserial a.c -o a
>   # ok
>
> Note: case 4 was a way to pass the option.
>
> After:
>   1 $ ./xgcc -B. -c -fprofile-reproducible a.c -o a.o
>   xgcc: error: unrecognized command-line option '-fprofile-reproducible'; did you mean '-fprofile-reproducible='?
>   2 $ ./xgcc -B. -c -fprofile-reproducible= a.c -o a.o
>   xgcc: error: missing argument to '-fprofile-reproducible='
>   3 $ ./xgcc -B. -c -fprofile-reproducible=serial a.c -o a.o
>   # ok
>   4 $ ./xgcc -B. -c -fprofile-reproducibleserial a.c -o a.o
>   xgcc: error: unrecognized command-line option '-fprofile-reproducibleserial'; did you mean '-fprofile-reproducible=serial'?
>
> Note: two problems here:
> a) case 2 got worse diagnostic
> b) case 4 broke something that worked before
>
> I'll look at "a)" to check if it can be easily fixed. Is "b)" worth handling as well?
> I'll need a hint or example how to handle an alias like that.

I think you want sth like

fdiagnostics-color
Common Alias(fdiagnostics-color=,always,never)
;

fdiagnostics-color=
Driver Common Joined RejectNegative Var(flag_diagnostics_show_color)
Enum(diagnostic_color_rule) Init(DIAGNOSTICS_COLOR_NO)
-fdiagnostics-color=[never|always|auto] Colorize diagnostics.

thus have -fprofile-reproducible an alias to
fprofile-reproducible=,<default>, (not sure if it works to omit
the -fno-profile-reproducible case).  Note I don't know what <default> should be
(parallel-runs or multithreaded) but since 'multithreaded' isn't even
documented (eh), that should
be probably the default.

Maybe Martin has sth to say here.  The question is what
-fprofile-reproducible did up until now...

Richard.

> > OK if so.
> >
> > > gcc/ChangeLog:
> > >
> > >         * common.opt: Fix handling of '-fprofile-reproducible' option.
> > > ---
> > >  gcc/common.opt | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/common.opt b/gcc/common.opt
> > > index dd68c61ae1d..84bf521128d 100644
> > > --- a/gcc/common.opt
> > > +++ b/gcc/common.opt
> > > @@ -2228,7 +2228,7 @@ Enum(profile_reproducibility) String(parallel-runs) Value(PROFILE_REPRODUCIBILIT
> > >  EnumValue
> > >  Enum(profile_reproducibility) String(multithreaded) Value(PROFILE_REPRODUCIBILITY_MULTITHREADED)
> > >
> > > -fprofile-reproducible
> > > +fprofile-reproducible=
> > >  Common Joined RejectNegative Var(flag_profile_reproducible) Enum(profile_reproducibility) Init(PROFILE_REPRODUCIBILITY_SERIAL)
> > >  -fprofile-reproducible=[serial|parallel-runs|multithreaded]    Control level of reproducibility of profile gathered by -fprofile-generate.
> > >
> > > --
> > > 2.28.0
> > >
>
>
> --
>
>   Sergei

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

end of thread, other threads:[~2020-09-15  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-11 21:55 [PATCH] -fprofile-reproducible: fix option value handling Sergei Trofimovich
2020-09-14  7:34 ` Richard Biener
2020-09-14 22:57   ` Sergei Trofimovich
2020-09-15  6:40     ` Richard Biener

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