This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: parameter type of -frandom-seed
- From: Martin Sebor <msebor at gmail dot com>
- To: Stephan Gatzka <stephan dot gatzka at gmail dot com>, gcc-help at gcc dot gnu dot org
- Date: Tue, 25 Aug 2015 17:42:50 -0600
- Subject: Re: parameter type of -frandom-seed
- Authentication-results: sourceware.org; auth=none
- References: <1440521295 dot 3861 dot 3 dot camel at gmail dot 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