Subject: Re: shutdown(8) Heisenbug?
To: Mason Loring Bliss <email@example.com>
From: Frederick Bruckman <firstname.lastname@example.org>
Date: 09/30/1999 01:44:50
On Wed, 29 Sep 1999, Mason Loring Bliss wrote:
> On Wed, Sep 29, 1999 at 06:38:59PM -0500, Frederick Bruckman wrote:
> > I think you're onto something. shutdown.c in -current and 1.4.1 are
> > the same, and dofast is *never* *initialized*. That's bad.
> Are you saying it's bad that it's not explicitly initialized in the code,
> or that the compiler's not initializing it? It's not a problem for the
> code itself not to initialize it, IMHO - the language spec says that the
> variable will dependably be zero with no intervention required. But maybe
> that's what you're saying...?
That is what I'm saying, that you should never rely on the value of an
uninitialized variable. At least, that's what I always thought. I
think maybe variables are automatically initialized to zero in C++ and
Java, but not C.
This is curious, too, that -Wuninitialized doesn't catch it:
root@handy-> COPTS=-Wuninitialized make
cc -O2 -Wuninitialized -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wpointer-arith -Werror -c /usr/src/sbin/shutdown/shutdown.c
cc -static -o shutdown shutdown.o
> > I looked at the m68k assembly, and egcs-1.1.1 does *not* initialize
> > "dofast" to zero.
> *That* is a problem, as I understand it. I'll see if I can figure it out
> on my i386.