This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Uninitialized variable warnings
- To: Zack Weinberg <zack at rabi dot columbia dot edu>
- Subject: Re: Uninitialized variable warnings
- From: Jeffrey A Law <law at upchuck dot cygnus dot com>
- Date: Sun, 28 Mar 1999 01:02:20 -0700
- cc: Joern Rennecke <amylaar at cygnus dot co dot uk>, egcs at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199903160417.XAA29108@blastula.phys.columbia.edu>you write:
> >This is pretty straightforward setting hi in both arms of an if-else
> >or even unconditionally in each of the disjoint lifetimes.
>
> case ADDR_EXPR:
> {
> struct addr_const value;
>
> decode_addr_const (exp, &value);
> if (GET_CODE (value.base) == SYMBOL_REF)
> {
> /* Don't hash the address of the SYMBOL_REF;
> only use the offset and the symbol name. */
> hi = value.offset;
> p = XSTR (value.base, 0);
> for (i = 0; p[i] != 0; i++)
> hi = ((hi * 613) + (unsigned) (p[i]));
> }
> else if (GET_CODE (value.base) == LABEL_REF)
> hi = value.offset + CODE_LABEL_NUMBER (XEXP (value.base, 0)) * 13
> ;
>
> hi &= (1 << HASHBITS) - 1;
>
> If GET_CODE (value.base) is not SYMBOL_REF or LABEL_REF, hi is used
> unintialized. Maybe that never happens with correct RTL, but we ought
> at least to have an `else abort()' in there. I considered all the
> cases like this to be real bugs.
Adding an else abort () seems quite reasonable to me. If it ever triggers
we've got a real bug to track down.
These are precisely the kinds of things we need to spend time looking at --
no -W flag will ever know enough about the semantics of this code to determine
whether or not the variable can be used without being set.
jeff