This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH] Fix combine.c compilation warnings (take 3)


Hi Richard,

The following e-mail was sent to you prviately three days ago to
avoid any embarrassment on your part.  Here it is to the list for
the record.


---------- Forwarded message ----------
Date: Wed, 3 Jul 2002 20:32:36 -0600 (MDT)
From: Roger Sayle <roger@eyesopen.com>
To: Richard Henderson <rth@redhat.com>
Subject: Re: [PATCH] Fix combine.c compilation warnings (take 2)


On Wed, 3 Jul 2002, Richard Henderson wrote:
> On Wed, 3 Jul 2002, Roger Sayle wrote:
> >   	  && num_sign_bit_copies (XEXP (x, 0), GET_MODE (XEXP (x, 0)))
> > - 	     >= GET_MODE_BITSIZE (mode) + 1
> > + 	     >= (unsigned int) (GET_MODE_BITSIZE (mode) + 1)
>
> Looks like these were introduced by reducing mode_bitsize
> from "unsigned int" to "unsigned short", such that it now
> promotes to "int" with arithmetic.
>
> Perhaps a better solution is
>
> - #define GET_MODE_BITSIZE(MODE)  (mode_bitsize[(int) (MODE)])
> + #define GET_MODE_BITSIZE(MODE)  ((unsigned int) mode_bitsize[(int) (MODE)])


After commiting the hunks approved so far, I quickly checked the effects
of the single line change above.  As I feared it doesn't improve the
situation.  Without the cast there are 21 warnings in combine.c, and
with the cast to unsigned int there are 22 (of these only six warnings
were unaffected by the change).  Globally, the situtation is even worse,
with 3 more warnings in cse.c, 3 more in optabs.c and one more in
expr.c, fold-const.c and profile.c.  No warnings outside of combine.c
were silenced by the change.

If its OK with you, I'd like to resubmit a revised patch to tackle
the 21 remaining warnings in combine.c by adding the appropriate
casts (fixing the errors you've pointed out).  However, if you still
prefer the above approach, I'll happily to submit a patch to tweak
all of the files mentioned above.

Roger
--


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