This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix 35620, passing deref of ptr to _Decimal32
On Fri, 2008-04-04 at 10:37 +0100, Richard Guenther wrote:
> On Fri, Apr 4, 2008 at 12:17 AM, Janis Johnson <janis187@us.ibm.com> wrote:
> >
> > On Thu, 2008-04-03 at 15:01 -0700, Janis Johnson wrote:
> > > On Thu, 2008-04-03 at 22:32 +0200, Richard Guenther wrote:
> > > > On Thu, Apr 3, 2008 at 10:27 PM, Janis Johnson <janis187@us.ibm.com> wrote:
> > > > > The fix to pass SDmode arguments in registers resulted in an ICE for
> > > > > passing a dereferenced pointer to _Decimal32. This patch fixes it.
> > > > > There's a small test that fails without the patch, and two new tests
> > > > > for argument passing to fill in testing gaps.
> > > > >
> > > > > Boostrapped and regression tested on powerpc64-linux with -m32/-m64.
> > > > > OK for trunk? OK for the 4.3 branch after testing there?
> > > > >
> > > > > 2008-04-03 Janis Johnson <janis187@us.ibm.com>
> > > > >
> > > > > gcc/
> > > > > PR target/35620
> > > > > * config/rs6000/rs6000.c (rs6000_check_sdmode): Handle indirect ref.
> > > > >
> > > > > testsuite/
> > > > > PR target/35620
> > > > > * gcc.dg/dfp/pr35620.c: New test.
> > > > > * gcc.dg/dfp/func-pointer.c: New test.
> > > > > * gcc.dg/dfp/func-deref.c: New test.
> > > > >
> > > > > Index: gcc/config/rs6000/rs6000.c
> > > > > ===================================================================
> > > > > --- gcc/config/rs6000/rs6000.c (revision 133794)
> > > > > +++ gcc/config/rs6000/rs6000.c (working copy)
> > > > > @@ -11231,6 +11233,7 @@ rs6000_check_sdmode (tree *tp, int *walk
> > > > > case FIELD_DECL:
> > > > > case RESULT_DECL:
> > > > > case REAL_CST:
> > > > > + case INDIRECT_REF:
> > > >
> > > > What about ALIGN_INDIRECT_REF and MISALIGNED_INDIRECT_REF? What
> > > > about VIEW_CONVERT_EXPR? The latter can be probably constructed with
> > > > union type-punning now.
> > >
> > > Thanks, I thought there might be more I was missing. I'll figure
> > > out how to construct examples so I can test those.
> >
> > I don't see how any of ALIGN_INDIRECT_REF, MISALIGNED_INDIRECT_REF,
> > or VIEW_CONVERT_EXPR could be used to pass a _Decimal32 argument.
> > I can add them here anyway without testcases, or add asserts that
> > they won't be seen in this function. Thoughts?
>
> For VIEW_CONVERT_EXPR you might try
>
> int32 x;
> union { _Decimal32 a; int32 b; } u;
> u.b = x;
> _Decimal32 tmp = u.a;
> foo(tmp);
>
> I don't know if TER will move a V_C_E into a call stmt though, but
> the load from u.a should be a V_C_E (x).
>
> Otherwise I'd just add asserts that those do not occur.
Score! That example causes an ICE, fixed by adding VIEW_CONVERT_EXPR
to the case. I'll add asserts for the other two.
Janis