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: Unreviewed Patch


 > From: Michael Matz <matz@suse.de>
 > 
 > Hi,
 > 
 > On Wed, 14 Aug 2002, Kaveh R. Ghazi wrote:
 > 
 > > If someone would please review this I would very much appreciate it.
 > 
 > Wouldn't it make more sense to directly use a unsigned variable, instead
 > of those ugly casts?  E.g. in loop.c 'i' is only used in unsigned context,
 > except in one loop in move_movables() (where it's compared with XVECLEN).
 > 
 > Similar the usage of the macros CLASS_MAX_NREGS and HARD_REGNO_NREGS.  I
 > think they should be defined to return unsigned numbers.  I guess such a
 > change would need to be followed by many other changes in the compiler to
 > honor that.  I at least feel, that casts are an ugly way to silence the
 > warnings, and additionally also hide real errors with signed/unsigned
 > mismatches, plus optimization opportunities, when it's known that
 > variables are >=0, but not marked unsigned.

Michael,

The problem is that there is no consistency among the various ports.
Some definitions of these macros resolve to signed values and others
to unsigned.  That's why e.g. most of the warnings only appeared on
either mips or sparc but not both.  Because of that, I cast each use
to the signedness of the variable it was being compared to.  That's
the only mechanism guaranteed to be warning-free everywhere.

Were I to follow your suggestion and switch the variable's signedness,
I would just prick some other configuration and cause warnings there.
I would still need "ugly" casts, just of the other signedness.  The
other suggestion whereby I would insert a cast in each port's
definition of these macro to ensure a particular signedness is much
more invasive and I cannot possibly regression test all combinations.

I prefer to leave the patch as it is.  However I would be willing to
change the signedness of `i' and invert all of the relevant casts.
I'll leave that up to the reviewer to decide.

		Thanks,
		--Kaveh
--
Kaveh R. Ghazi			Director of Systems Architecture
ghazi@caip.rutgers.edu		Qwest Solutions


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