This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] [SH] Fix target/48596
- From: Oleg Endo <oleg dot endo at t-online dot de>
- To: Kaz Kojima <kkojima at rr dot iij4u dot or dot jp>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 05 Mar 2012 23:59:10 +0100
- Subject: Re: [PATCH] [SH] Fix target/48596
- References: <20120301.131149.253359368.kkojima@rr.iij4u.or.jp>
On Thu, 2012-03-01 at 13:11 +0900, Kaz Kojima wrote:
> Hi,
>
> The attached patch is to avoid PR target/48596 which is a 4.7
> regression on SH.
> [...]
I'd like to add the test case from the PR to the testsuite.
Tested with
make check-gcc RUNTESTFLAGS="sh.exp=pr48596.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a-single/-mb,
-m4-single/-ml,-m4-single/-mb,-m4a-single/-ml,-m4a-single/-mb}"
OK?
Cheers,
Oleg
testsuite/ChangeLog:
PR target/48596
* gcc.target/sh/pr48596.c: New.
Index: gcc/testsuite/gcc.target/sh/pr48596.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr48596.c (revision 0)
+++ gcc/testsuite/gcc.target/sh/pr48596.c (revision 0)
@@ -0,0 +1,31 @@
+/* Check that the following code compiles without errors. */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+
+enum { nrrdCenterUnknown, nrrdCenterNode, nrrdCenterCell, nrrdCenterLast };
+typedef struct { int size; int center; } NrrdAxis;
+typedef struct { int dim; NrrdAxis axis[10]; } Nrrd;
+typedef struct { } NrrdKernel;
+typedef struct { const NrrdKernel *kernel[10]; int samples[10]; } Info;
+
+void
+foo (Nrrd *nout, Nrrd *nin, const NrrdKernel *kernel, const double *parm,
+ const int *samples, const double *scalings)
+{
+ Info *info;
+ int d, p, np, center;
+ for (d=0; d<nin->dim; d++)
+ {
+ info->kernel[d] = kernel;
+ if (samples)
+ info->samples[d] = samples[d];
+ else
+ {
+ center = _nrrdCenter(nin->axis[d].center);
+ if (nrrdCenterCell == center)
+ info->samples[d] = nin->axis[d].size*scalings[d];
+ else
+ info->samples[d] = (nin->axis[d].size - 1)*scalings[d] + 1;
+ }
+ }
+}