This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: added: tests for uninit variable warnings
- To: Zack Weinberg <zack at rabi dot columbia dot edu>
- Subject: Re: added: tests for uninit variable warnings
- From: Jeffrey A Law <law at hurl dot cygnus dot com>
- Date: Thu, 11 Mar 1999 17:42:17 -0700
- cc: egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199903120010.TAA03507@blastula.phys.columbia.edu>you write:
> uninit-4.c is bizarre: the warning goes away if you remove the '1'
> case, or if you replace 'struct operation' by an int, or even if you
> make 'struct operation' smaller! Also, if you take out the default
> case _and_ the '1' case, the warning goes away, but it shouldn't (what
> if cpp_lex returns 3?)
Not weird at all. Changing the numberof cases or density of the switch may
cause the compiler to emit it as a series of cascaded if/else statements which
the compiler is better able to analyze.
Structures also present some interesting problems to the uninitialized
variable analysis. It's quite a bit more difficult for the compiler to
determine that an entire structure has been initialized as opposed to a simple
integer or floating point variable.
> The tests are marked XFAIL - all systems. I'm interested to know if
> they pass on anyone's machine.
They probably will pass on some machines because of differences in switch
table density threshholds (at least uninit-4)
jeff