Different object code generated each time file is compiled

Burt Bicksler bbicksler@fortresstech.com
Tue Sep 30 21:12:00 GMT 2008

Thanks Brian,

That's one I hadn't thought of, the anonymous name spaces.

I already have the developer working on diffing the assembler output
so that should tell us something too.


Brian Dessent wrote:
> Burt Bicksler wrote:
>> It is only two source files that we see this difference with and it is
>> always 4 bytes in each object file that is different.
>> Has anyone encountered anything like this before?
> There are several things that can cause this.  The most common is the
> use of the __TIME__ or __DATE__ macros, however this doesn't seem
> applicable in your case if you are compiling preprocessed source since
> the expansion will have already occurred.
> Another less obvious source of differences are anonymous namespaces. 
> Because the standard says that they must be unique to each translation
> unit, the compiler has to add some random strings to their mangled names
> to uniquify them so that no two can clash.  The -frandom-seed option is
> provided as a way for the user to specify their own uniquifier string:
> <http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#index-frandom_002dstring-571>
> If that doesn't cover your problem then you'll probably have to
> investigate further.  Try diffing the assembler output (-S) of two runs
> and the source of the difference should jump out at you.
> Brian

More information about the Gcc-help mailing list