This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch for PR/23522
- From: Ian Lance Taylor <ian at airs dot com>
- To: Alexey Starovoytov <alexey dot starovoytov at sun dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: 28 Sep 2005 16:40:14 -0700
- Subject: Re: patch for PR/23522
- References: <Pine.GSO.4.31.0509281631200.2070-100000@boojum>
Alexey Starovoytov <alexey.starovoytov@sun.com> writes:
> On Wed, 28 Sep 2005, Ian Lance Taylor wrote:
>
> > Alexey Starovoytov <alexey.starovoytov@sun.com> writes:
> >
> > > > What if we change the condition to
> > > > if (TREE_CODE (arg1_unw) != INTEGER_CST
> > > > || !int_fits_type_p (arg1_unw, shorter_type))
> > > > return NULL_TREE;
> > > >
> > > > Does that fix the problem?
> > >
> > > Yes.
> > > and going even further the 'if' should probably look like:
> > >
> > > if (TREE_CODE (arg1_unw) != INTEGER_CST
> > > || TREE_CODE (shorter_type) != INTEGER_TYPE
> > > || !int_fits_type_p (arg1_unw, shorter_type))
> > > return NULL_TREE;
> > >
> > > Certianly solves the problem and more safe.
> >
> > I think you can reasonably use INTEGRAL_TYPE_P (shorter_type) instead
> > of TREE_CODE (shorter_type) != INTEGER_TYPE.
>
> Then we should probably change the couple lines above that spot
> to use INTEGRAL_TYPE_P as well.
Oh, sorry, you're right. != INTEGER_TYPE is correct. Forget what I
said. Please test your patch above:
if (TREE_CODE (arg1_unw) != INTEGER_CST
|| TREE_CODE (shorter_type) != INTEGER_TYPE
|| !int_fits_type_p (arg1_unw, shorter_type))
return NULL_TREE;
Thanks!
Ian