This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -frandom-seed


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]