[Xorp-cvs] XORP cvs commit: xorp/libxorp

Pavlin Radoslavov pavlin at ICSI.Berkeley.EDU
Tue Apr 22 10:42:42 PDT 2008


> Pavlin Radoslavov wrote:
> > The above commit fixes the compilation error, but doesn't fix the
> > problem.
> > In the original code, variable "junk_seed" has been intentionally
> > left uninitialized so when used it will increase the
> > unpredictability in the randomness.
> > In fact, "junk_seed" has been used to feed the unpredicted value
> > into variable "junk" as a compiler work-around.
> > Is there any way to rewrite the code to keep the gcc-4.2 compiler
> > happy and keep junk_seed unintialized?
> > E.g., maybe by using a pointer to "junk_seed" or an array of 1-2
> > elements of type "long" or something like this.
> 
> Without compiler pragmas, it is difficult to do so without changing 
> compiler options on a per-file basis -- unless we turn off -Werror, and 
> that ain't gonna happen.
> 
> Boost.Build will allow changing CFLAGS on a per-file basis, it has a 
> different syntax for this. We could in theory do same with automake...
> 
> I could back it out, but that breaks g++ 4.2 compilation w/-Werror.

No, I wasn't thinking of doing something about CFLAGS for this
particular file, and I don't think you should back it out and break
the g++ 4.2 compilation.

I was thinking about trivial work-around in the code itself like:

    unsigned long junk = 0;
    unsigned long junk_seed[2];

    junk = junk_seed[1];


What OS and compiler version are you using?
I have FreeBSD-7.0 (amd64) with the following compiler version
and the original code was compiling for me without a warning:

gcc (GCC) 4.2.1 20070719  [FreeBSD]

Pavlin



More information about the Xorp-cvs mailing list