Re: 1.1.49 cosmetic patches

eyal (eyal@eyal.emu.id.au)
Tue, 12 Aug 1997 23:05:16 +1000


Martin von Loewis wrote:
>
> > Also on binfmt_elf.c gcc barfs
> > -----
> > binfmt_elf.c: In function `load_elf_binary':
> > binfmt_elf.c:392: warning: `interpreter_dentry' might be used uninitialized in this function
> > -----
>
> gcc is wrong on this one: interpreter_dentry will never be used
> uninitialized. As Alan says, fix gcc not the Linux kernel. Adding an
> extra mov instruction to the assembly just to make gcc happy is not
> the way.

I often have to state the case against pre-initialization (in other
words, I
agree with Martin). Here is how I see it.

The compiler is actually the nice guy here, and the warning is with good
intent. As it
often is the case, there are paths through the program where that
variable remains
uninitialized. It is too complicated for the compiler to realise that
the places
where is is used are on dynamic paths where it is initialised.

As sometimes is the case, such a warning may expose a real problem in
the logic.
Now, initialising right at the top destroyes any chance for the compiler
to warn
you. The habit of initialising everything is wrong. It is perfectly
allright to have
an uninitialised variable - you should only initialise if it is true
that the variable
should have that value at that point.

Reading what I just wrote I find it overbearing. Heck, I will state
simply that losing
the services of the compiler is too much to pay for avoiding the few
wrong noises it makes
sometimes.

[kernel list? what kernel list? are you sure this is the kernel list?
doesn't look like one]

--
Eyal Lebedinsky		(eyal@eyal.emu.id.au)