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:29:27PM -0700, Richard Henderson wrote:
> On Fri, Jul 14, 2000 at 05:19:06PM +0200, Jakub Jelinek wrote:
> > +  if (foo(255))
> 
> Actually, looking at this again, perhaps `(unsigned char)~0'
> would be better than 255.

Sure, will change that.
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'll start bootstrap soonish to see...

2000-07-14  Jakub Jelinek  <jakub@redhat.com>

	* fold-const.c (extract_muldiv): Check unsignedness of type, not
	ctype.

--- gcc/fold-const.c.jj	Mon Jul 10 08:08:36 2000
+++ gcc/fold-const.c	Fri Jul 14 22:15:04 2000
@@ -4516,8 +4516,8 @@ extract_muldiv (t, c, code, wide_type)
       /* If we have an unsigned type is not a sizetype, we cannot widen
 	 the operation since it will change the result if the original
 	 computation overflowed.  */
-      if (TREE_UNSIGNED (ctype)
-	  && ! TYPE_IS_SIZETYPE (ctype)
+      if (TREE_UNSIGNED (type)
+	  && ! TYPE_IS_SIZETYPE (type)
 	  && ctype != type)
 	break;
 


	Jakub

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