This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Uninitialized variable warnings


On Mon, 15 Mar 1999 21:27:58 +0000 (GMT), Joern Rennecke wrote:
>> -- definitely real bugs --
>...
>definitely not!
>
>> reload1.c	reload			    is_scalar
>
>is_scalar is always set when reg_equiv_memory_loc[i] is non-zero.
>addr is only set when reg_equiv_mem[i] or reg_equiv_address[i] is non-zero.
>
>One of the latter two is always non-zero if reg_equiv_memory_loc[i] is
>non-zero (of course the compiler doesn't know about that when compiling
>itself, which just goes to show that -Wuninitialized can't work quite
>right without solving the halting problem).

I didn't know that either.  Is there a difference between
(reg_equiv_mem[i] || reg_equiv_address[i]) and
reg_equiv_memory_loc[i]?  If not, why is there a separate table?

>> varasm.c	const_hash		    hi
>
>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.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]