diff mbox

[SH] PR 30807 - Add test case

Message ID 1383684273.2445.401.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo Nov. 5, 2013, 8:44 p.m. UTC
Hi,

This adds a test case for PR 30807 which is based on the PR's attachment
17961.  Tested with
make -k check-gcc RUNTESTFLAGS="sh-torture.exp --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}

OK to add?

Cheers,
Oleg

testsuite/ChangeLog:

	PR target/30807
	gcc.target/sh/torture/pr30807.c: New.

Comments

Mike Stump Nov. 5, 2013, 9:33 p.m. UTC | #1
On Nov 5, 2013, at 12:44 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> +/* { dg-do compile { target "sh*-*-*" } } */

Why do this, when sh-torture.exp does this:

if { ![istarget sh*-*-*] } then {
  return
}

?  I suspect you merely copied the style from the other test cases.  If there isn't a good reason to do this, please don't.

Other ports that seem to do this at least to some extent: aarch64, bfin, h8300, ia64, m68k, powerpc, s390 and sh.

If no one has a good reason to do this, I'd ask people to remove target lines that don't shrink in some way the list of targets.

> OK to add?

I'll let the sh folks comment as normal on the rest of it…  seems fine to me.
Oleg Endo Nov. 5, 2013, 9:45 p.m. UTC | #2
On Tue, 2013-11-05 at 13:33 -0800, Mike Stump wrote:
> On Nov 5, 2013, at 12:44 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> > +/* { dg-do compile { target "sh*-*-*" } } */
> 
> Why do this, when sh-torture.exp does this:
> 
> if { ![istarget sh*-*-*] } then {
>   return
> }
> 
> ?  I suspect you merely copied the style from the other test cases.  

Exactly.

> If there isn't a good reason to do this, please don't.
> 

You're right,  it's redundant.  It should be just
/* { dg-do compile } */

shouldn't it?

I can change that before committing, no problem.
I can also fix the other existing SH tests to prevent further copy pasta
as a separate patch.

Cheers,
Oleg
Mike Stump Nov. 5, 2013, 9:50 p.m. UTC | #3
On Nov 5, 2013, at 1:45 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> You're right,  it's redundant.  It should be just
> /* { dg-do compile } */
> 
> shouldn't it?

Yup, that's my take.

> I can change that before committing, no problem.

Thanks.
Kaz Kojima Nov. 5, 2013, 11:09 p.m. UTC | #4
Oleg Endo <oleg.endo@t-online.de> wrote:
> This adds a test case for PR 30807 which is based on the PR's attachment
> 17961.  Tested with
> make -k check-gcc RUNTESTFLAGS="sh-torture.exp --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}
> 
> OK to add?

OK with the changes suggested by Mike and you.

> I can also fix the other existing SH tests to prevent further copy pasta
> as a separate patch.

It's pre-approved.

Regards,
	kaz
Hans-Peter Nilsson Nov. 21, 2013, 10:22 a.m. UTC | #5
On Tue, 5 Nov 2013, Mike Stump wrote:
> On Nov 5, 2013, at 1:45 PM, Oleg Endo <oleg.endo@t-online.de> wrote:
> > You're right,  it's redundant.  It should be just
> > /* { dg-do compile } */
> >
> > shouldn't it?
>
> Yup, that's my take.

Or nothing at all, as compile seems to be the default here.
(grep for dg-do-what-default)

brgds, H-P
diff mbox

Patch

Index: gcc/testsuite/gcc.target/sh/torture/pr30807.c
===================================================================
--- gcc/testsuite/gcc.target/sh/torture/pr30807.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/torture/pr30807.c	(revision 0)
@@ -0,0 +1,218 @@ 
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-additional-options "-fpic -std=c99" }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
+
+typedef unsigned int size_t;
+typedef struct
+{
+  unsigned long __val[(1024 / (8 * sizeof (unsigned long)))];
+}  __sigset_t;
+struct __jmp_buf_tag
+{
+  __sigset_t __saved_mask;
+};
+typedef struct __jmp_buf_tag sigjmp_buf[1];
+struct stat
+{
+  long long st_dev;
+  unsigned short int __pad1;
+  int tm_isdst;
+  long int tm_gmtoff;
+  char *tm_zone;
+};
+
+typedef size_t STRLEN;
+typedef struct op OP;
+typedef struct cop COP;
+typedef struct interpreter PerlInterpreter;
+typedef struct sv SV;
+typedef struct av AV;
+typedef struct cv CV;
+typedef struct gp GP;
+typedef struct gv GV;
+typedef struct xpv XPV;
+typedef struct xpvio XPVIO;
+typedef union any ANY;
+typedef unsigned char U8;
+typedef long I32;
+typedef unsigned long U32;
+typedef U32 line_t;
+typedef struct _PerlIO PerlIOl;
+typedef PerlIOl *PerlIO;
+struct sv
+{
+  void *sv_any;
+  U32 sv_flags;
+  union
+  {
+    char *svu_pv;
+  } sv_u;
+};
+struct gv
+{
+  U32 sv_flags;
+  union
+  {
+    GP *svu_gp;
+  } sv_u;
+};
+struct io
+{
+  XPVIO *sv_any;
+};
+struct xpv
+{
+  STRLEN xpv_cur;
+};
+struct xpvio
+{
+  PerlIO *xio_ofp;
+};
+struct gp
+{
+  SV *gp_sv;
+  struct io *gp_io;
+};
+struct jmpenv
+{
+  struct jmpenv *je_prev;
+  sigjmp_buf je_buf;
+  int je_ret;
+};
+typedef struct jmpenv JMPENV;
+struct cop
+{
+  line_t cop_line;
+  struct refcounted_he *cop_hints_hash;
+};
+struct interpreter
+{
+  SV **Istack_sp;
+  OP *Iop;
+  SV **Icurpad;
+  SV **Istack_base;
+  SV **Istack_max;
+  I32 *Iscopestack;
+  I32 Iscopestack_ix;
+  I32 Iscopestack_max;
+  ANY *Isavestack;
+  I32 Isavestack_ix;
+  I32 Isavestack_max;
+  SV **Itmps_stack;
+  I32 Itmps_ix;
+  I32 Itmps_floor;
+  I32 Itmps_max;
+  I32 Imodcount;
+  I32 *Imarkstack;
+  I32 *Imarkstack_ptr;
+  I32 *Imarkstack_max;
+  SV *ISv;
+  XPV *IXpv;
+  STRLEN Ina;
+  struct stat Istatbuf;
+  struct stat Istatcache;
+  OP *Irestartop;
+  COP *volatile Icurcop;
+  JMPENV *Itop_env;
+  U8 Iexit_flags;
+  I32 Istatusvalue;
+  I32 Istatusvalue_posix;
+  GV *Istderrgv;
+  GV *Ierrgv;
+  AV *Ibeginav;
+  AV *Iunitcheckav;
+  COP Icompiling;
+  char Isavebegin;
+  volatile U32 Idebug;
+  AV *Ibeginav_save;
+  AV *Icheckav_save;
+  AV *Iunitcheckav_save;
+};
+
+void S_my_exit_jump (PerlInterpreter *my_perl __attribute__((unused)))
+  __attribute__((noreturn));
+
+int Perl_av_len (PerlInterpreter*, AV*);
+void Perl_av_create_and_push (PerlInterpreter*, AV**, SV*);
+int __sigsetjmp (sigjmp_buf env, int savemask);
+void Perl_sv_2pv_flags (PerlInterpreter*, SV*, STRLEN*, int);
+void Perl_deb (PerlInterpreter*,
+	       const char*, const char*, int, const char*, int);
+void Perl_croak (PerlInterpreter*, const char*, void*);
+void foo (void);
+
+void
+Perl_call_list (PerlInterpreter *my_perl __attribute__((unused)),
+		I32 oldscope, AV *paramList)
+{
+  SV *atsv;
+  CV *cv;
+  STRLEN len;
+  int ret;
+  JMPENV cur_env;
+  GV *shplep;
+  volatile line_t oldline;
+
+  oldline = (my_perl->Icurcop) ? my_perl->Icurcop->cop_line : 0;
+
+  while (Perl_av_len (my_perl, paramList) >= 0)
+    {
+      if (my_perl->Isavebegin)
+	{
+	  if (paramList == my_perl->Ibeginav)
+	    {
+	      Perl_av_create_and_push (my_perl, &my_perl->Ibeginav_save,
+				       (SV*) cv);
+	      Perl_av_create_and_push(my_perl, &my_perl->Icheckav_save,
+				      (SV*) cv);
+	    }
+	  else if (paramList == my_perl->Iunitcheckav)
+	    Perl_av_create_and_push(my_perl, &my_perl->Iunitcheckav_save,
+				    (SV*) cv);
+	}
+
+      cur_env.je_ret = __sigsetjmp (cur_env.je_buf, 0);
+
+      switch (ret)
+	{
+	case 0:
+	  shplep = (GV *) my_perl->Ierrgv;
+	  *my_perl->Imarkstack_ptr = my_perl->Istack_sp - my_perl->Istack_base;
+	  atsv = shplep->sv_u.svu_gp->gp_sv;
+	  if (atsv->sv_flags & 0x00000400 == 0x00000400)
+	    len = ((XPV*) ((SV *) atsv)->sv_any)->xpv_cur;
+	  else
+	    Perl_sv_2pv_flags (my_perl, atsv, &len, 2|32);
+
+	  if (len)
+	    {
+	      my_perl->Icurcop = &my_perl->Icompiling;
+	      while (my_perl->Iscopestack_ix > oldscope)
+		{
+		  if (my_perl->Idebug & 0x00000004)
+		    Perl_deb (my_perl, "scope", "LEAVE",
+			      my_perl->Iscopestack_ix, "perl.c", 5166);
+		  (my_perl->Itop_env) = cur_env.je_prev;
+		}
+
+	      Perl_croak (my_perl, "%""-p""", (void*) atsv);
+	    }
+
+	case 1:
+	  my_perl->Istatusvalue = 1;
+	  my_perl->Istatusvalue_posix = 1;
+	case 2:
+	  while (my_perl->Iscopestack_ix > oldscope)
+	    if (my_perl->Idebug & 0x00000004)
+	      foo ();
+	  my_perl->Icurcop = &my_perl->Icompiling;
+	  my_perl->Icurcop->cop_line = oldline;
+	  if (my_perl->Idebug & 0x00000004)
+	    foo ();
+	  S_my_exit_jump (my_perl);
+	case 3:
+	  if (my_perl->Irestartop)
+	    foo ();
+	}
+    }
+}