This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [testsuite] fold_const serious bug
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: [testsuite] fold_const serious bug
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 14 Jul 2000 22:37:50 +0200
- Cc: gcc-patches at gcc dot gnu dot org
- References: <20000714171906.F17419@sunsite.ms.mff.cuni.cz> <20000714132927.A8748@cygnus.com>
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
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