public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Stephan Gatzka <stephan.gatzka@gmail.com>, gcc-help@gcc.gnu.org
Subject: Re: parameter type of  -frandom-seed
Date: Tue, 25 Aug 2015 23:42:00 -0000	[thread overview]
Message-ID: <55DCFD7A.3090609@gmail.com> (raw)
In-Reply-To: <1440521295.3861.3.camel@gmail.com>

On 08/25/2015 10:48 AM, Stephan Gatzka wrote:
> Hi!
>
> I'm a bit confused about the parameter I have to deliver to -frandom
> -seed.
>
> My manual page states it must be a number, others say it's a string.
>
> If I browse through the sources of gcc, it's also not not obvious to me.
>
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/common.opt;hb=HEAD
>
> https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/po/de.po;hb=HEAD
>
> So what's the correct parameter ffor -frandom-seed? A number
> (decimal/hex) or a string?

According to the online manual for the latest GCC it's supposed to
be a non-negative number:

   $ gcc -v --help 2>&1 | grep random-seed
   -frandom-seed               This switch lacks documentation
   -frandom-seed=<number>      Make compile reproducible using <number>

but it looks like there's a bug in the option's specification that
prevents invalid (non-numeric) arguments from being diagnosed, making
GCC accept anything (including negative numbers).

The otherwise untested patch below fixes it for me and makes GCC
accept only non-negative numbers.

A bug should probably be filed for this.

Martin

diff --git a/gcc/common.opt b/gcc/common.opt
index 4dcd518..4776d1f 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1868,7 +1868,7 @@ frandom-seed
  Common Var(common_deferred_options) Defer

  frandom-seed=
-Common Joined RejectNegative Var(common_deferred_options) Defer
+Common Joined RejectNegative UInteger Var(common_deferred_options) Defer
  -frandom-seed=<number> Make compile reproducible using <number>

  ; This switch causes the command line that was used to create an

  reply	other threads:[~2015-08-25 23:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 16:48 Stephan Gatzka
2015-08-25 23:42 ` Martin Sebor [this message]
2015-08-27  5:36   ` Stephan Gatzka
2015-08-27 15:31     ` Martin Sebor
2015-08-27 18:16       ` Stephan Gatzka
2015-09-01 17:33         ` Martin Sebor
2015-09-01 18:31           ` Stephan Gatzka

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=55DCFD7A.3090609@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=stephan.gatzka@gmail.com \
    /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).