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]

Re: [testsuite] fold_const serious bug


On Fri, Jul 14, 2000 at 01:53:03PM -0700, Richard Henderson wrote:
> On Fri, Jul 14, 2000 at 10:37:50PM +0200, Jakub Jelinek wrote:
> > BTW: Here is what fixes this bug for me. ctype is guaranteed to be larger
> > than type unless it is equal, and IMHO we're interested in unsignedness of
> > the smaller type, IMHO the signedness of the larger type does not change
> > anything.
> > Does this look correct?
> 
> I don't think so.  According to the commentary, wide_type, and therefore
> ctype, is the type that should be used for the computation.  Pedantically
> it seems like we should only be worried about the computation overflowing.
> 
> As a correllary, it would appear from the test case that we've illegally
> asked for the computation to be widened.

The wide_type argument setting was done before it actually knew there is
something like uchar lurking in there, it was set as a result of the
NOP_EXPR which was of type int.
If op0 was not plus_expr with type uchar, but say just a uchar variable,
then it would make a lot of sense to do the whole operation in wide_type, so
I think such test has to be done in the inner extract_muldiv (PLUS_EXPR
case), not in the outer one (NOP_EXPR case).
What's the purpose of that ctype != type && TREE_UNSIGNED (ctype) test then?

	Jakub

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