This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -frandom-seed
- From: Ian Lance Taylor <iant at google dot com>
- To: morrell at alumni dot ucsd dot edu
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 10 Mar 2009 17:13:00 -0700
- Subject: Re: -frandom-seed
- References: <592621.53517.qm@web54605.mail.re2.yahoo.com>
Michael Morrell <morrell@alumni.ucsd.edu> writes:
> I want g++ to produce an identical binary when given the same source.
> If I don't use __DATE__ or __TIME__, I believe this will happen with
> one exception. Certain symbols get a randomly created component in
> their names which I can eliminate using an option like
> -frandom-seed=0.
>
> However, the man page wasn't clear as to why this option was needed and made
> me a little nervous anout using it. Can someone give me a test case where
> using -frandom-seed will break things?
With gcc 4.3 and later I think it's pretty hard to break things using
-frandom-seed, as gcc now turns functions defined in anonymous
namespaces into static symbols. You may be able to confuse the debugger
by having multiple static functions with the same name.
Anyhow, you will always be safe if you compile each file using a
different value for -frandom-seed. The easiest way to do that is to use
the filename itself as the seed. The random seed can be any string.
Ian