On Tue, 2012-03-06 at 08:24 +0900, Kaz Kojima wrote: > Oleg Endo <oleg.e...@t-online.de> wrote: > > 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? > > A gcc.c-torture/compile test is better, isn't it? >
I just noticed that I've accidentally added the pr48596.c to gcc.target/sh in another commit. I'm sorry about that. The attached patch moves it as suggested to gcc.c-torture/compile. Briefly tested by running the gcc.c-torture/compile set on sh-him -m4a-single -ml. testsuite/ChangeLog: PR target/48596 * gcc.target/sh/pr48596.c: Move accidentally added new test case to ... * gcc.c-torture/compile/pr48596.c: ... here.
Index: gcc/testsuite/gcc.target/sh/pr48596.c =================================================================== --- gcc/testsuite/gcc.target/sh/pr48596.c (revision 185191) +++ gcc/testsuite/gcc.target/sh/pr48596.c (working copy) @@ -1,31 +0,0 @@ -/* 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; - } - } -} Index: gcc/testsuite/gcc.c-torture/compile/pr48596.c =================================================================== --- gcc/testsuite/gcc.c-torture/compile/pr48596.c (revision 0) +++ gcc/testsuite/gcc.c-torture/compile/pr48596.c (revision 0) @@ -0,0 +1,31 @@ +/* PR target/48596 */ +/* { dg-do compile } */ +/* { 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; + } + } +}