John Regehr wrote:
I would only be worried for cases where no warning is issued *and*
unitialized accesses are eliminated.

Yeah, it would be excellent if GCC maintained the invariant that for all uses of uninitialized storage, either the compiler or else valgrind will issue a warning.

I find that reasonable at -O0, but an intolerable restriction if
optimization is active, since it would force inefficient code in
some cases.

BTW, the Ada front end has a very nice feature for dealing with
uninitialized storage. Pragma Initialize_Scalars forces everything
to be initialized, and you can change the initializing pattern at
link time or at run time with an environment variable. Then if the
program behavior changes when you change the initialization pattern,
you know something is wrong.

We could test for violations of this. Several times I've thought about cross-testing various compilers and versions of compilers for consistency of warnings. But I never managed to convince myself that developers would care enough to make it worth the trouble.

It's impossible in practice to be 100% precise about when warnings
are issued and when they are not.

John

Reply via email to