diff mbox

RFA: GCC Testsuite: Annotate compile tests that need at least 32-bit pointers/integers

Message ID 874n924ce2.fsf@redhat.com
State New
Headers show

Commit Message

Nick Clifton Sept. 30, 2013, 2:23 p.m. UTC
Hi Guys,

  Several tests in the gcc.c-torture/compile directory need a target
  with 32-bit integers and/or 32-bit pointers.  The patch below adds
  "dg-require-effective-target in32plus" to these tests.  This fixes
  ~200 unexpected failures for the MSP430, RL78 and XSTORMY16 targets.

  Note - I have used "dg-require-effective-target int32plus" in
  preference to "dg-require-effective-target ptr32plus" even if it 
  would appear that a pointer size test would be more appropriate.  This
  is because the check_effective_target_ptr32_plus test is broken for
  targets that use PSImode (eg the MSP430 in large mode).  On the MSP430
  for example a PSImode pointer is 20-bits long, but when it is stored
  in memory it occupies 32-bits.  So "sizeof(void *)" returns 4 but
  really a pointer cannot hold an entire 32-bit address.

  Tested with no regressions on msp430-elf, rl78-elf and xstormy16-elf
  targets.

  OK to apply ?

Cheers
  Nick

gcc/testsuite/ChangeLog
2013-09-30  Nick Clifton  <nickc@redhat.com>

	* gcc.c-torture/compile/20010327-1.c: Only run the test for
	int32plus targets.
	* gcc.c-torture/compile/990617-1.c: Likewise.
	* gcc.c-torture/compile/calls.c: Likewise.
	* gcc.c-torture/compile/limits-externdecl.c: Likewise.
	* gcc.c-torture/compile/pr41181.c: Likewise.
	* gcc.c-torture/compile/pr55955.c: Likewise.

Comments

Mike Stump Sept. 30, 2013, 7:42 p.m. UTC | #1
On Sep 30, 2013, at 7:23 AM, Nick Clifton <nickc@redhat.com> wrote:
>  Several tests in the gcc.c-torture/compile directory need a target
>  with 32-bit integers and/or 32-bit pointers.

>  OK to apply ?

Ok.

It may be reasonable to special case ptr32plus to say no on your platform, from check_effective_target_tls_native, we see code like:

proc check_effective_target_tls_native {} {
    # VxWorks uses emulated TLS machinery, but with non-standard helper                                                               
    # functions, so we fail to automatically detect it.                                                                                
    if { [istarget *-*-vxworks*] } {
        return 0
    }

    return [check_no_messages_and_pattern tls_native "!emutls" assembly {
        __thread int i;
        int f (void) { return i; }
        void g (int j) { i = j; }
    }]
}

so, instead of:

proc check_effective_target_ptr32plus { } {
    return [check_no_compiler_messages ptr32plus object {
        int dummy[sizeof (void *) >= 4 ? 1 : -1];
    }]
}

you could do something like:

proc check_effective_target_ptr32plus { } {
    # msp430 never really has 32 or more bits in a pointer.
    if { [istarget msp430-*-*] } {
        return 0
    }
    return [check_no_compiler_messages ptr32plus object {
        int dummy[sizeof (void *) >= 4 ? 1 : -1];
    }]
}

Then, you don't have to worry about people adding tests with this predicate and those test cases failing.  I don't have a good handle on wether this is better or not, so, I'll let you decide what you think is best.
Jeff Law Sept. 30, 2013, 7:54 p.m. UTC | #2
On 09/30/13 13:42, Mike Stump wrote:
> On Sep 30, 2013, at 7:23 AM, Nick Clifton <nickc@redhat.com> wrote:
>>   Several tests in the gcc.c-torture/compile directory need a target
>>   with 32-bit integers and/or 32-bit pointers.
>
>>   OK to apply ?
>
> Ok.
>
> It may be reasonable to special case ptr32plus to say no on your platform, from check_effective_target_tls_native, we see code like:
I'd tend to prefer this as well.  It's really a failing that ptr32plus 
can't reasonably detect that when a target uses PSImode for pointers. 
Special casing the msp port in that code seems reasonable to me.


jeff
Nick Clifton Oct. 1, 2013, 9:18 a.m. UTC | #3
Hi Mike,

> It may be reasonable to special case ptr32plus to say no on your platform, from check_effective_target_tls_native, we see code like:

> you could do something like:
>
> proc check_effective_target_ptr32plus { } {
>      # msp430 never really has 32 or more bits in a pointer.
>      if { [istarget msp430-*-*] } {
>          return 0
>      }
>      return [check_no_compiler_messages ptr32plus object {
>          int dummy[sizeof (void *) >= 4 ? 1 : -1];
>      }]
> }
>
> Then, you don't have to worry about people adding tests with this predicate and those test cases failing.  I don't have a good handle on wether this is better or not, so, I'll let you decide what you think is best.

Thanks - that is a good idea.  (I am embarrassed that I did not think of 
it myself).  I have checked the patch in with this change added.

Cheers
   Nick
diff mbox

Patch

Index: gcc/testsuite/gcc.c-torture/compile/20010327-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20010327-1.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/20010327-1.c	(working copy)
@@ -1,7 +1,4 @@ 
-/* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */
-/* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */ 
-/* { dg-skip-if "HI mode pointer for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ 
-/* { dg-skip-if "non-SI pointers for w64" { "x86_64-*-mingw*" } { "*" } { "" } } */ 
+/* { dg-require-effective-target int32plus } */
 
 /* This testcase tests whether GCC can produce static initialized data
    that references addresses of size 'unsigned long', even if that's not
Index: gcc/testsuite/gcc.c-torture/compile/20020604-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20020604-1.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/20020604-1.c	(working copy)
@@ -1,7 +1,6 @@ 
 /* { dg-do assemble } */
-/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ 
+/* { dg-require-effective-target ptr32plus } */
 /* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */
-/* { dg-skip-if "" { m32c-*-* } { } { } } */
 
 /* PR c/6957
    This testcase ICEd at -O2 on IA-32, because
Index: gcc/testsuite/gcc.c-torture/compile/20080625-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/20080625-1.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/20080625-1.c	(working copy)
@@ -1,4 +1,5 @@ 
-/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" "pdp11-*-*" } { "*" } { "" } } */
+/* { dg-require-effective-target int32plus } */
+
 struct peakbufStruct {
     unsigned int lnum [5000];
     int lscan [5000][4000];
Index: gcc/testsuite/gcc.c-torture/compile/990617-1.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/990617-1.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/990617-1.c	(working copy)
@@ -1,7 +1,5 @@ 
-/* 0x70000000 is too large a constant to become a pointer on
-   xstormy16. */
 /* { dg-do assemble } */
-/* { dg-xfail-if "" { xstormy16-*-* } { "*" } { "" } } */
+/* { dg-require-effective-target int32plus } */
 
 int main()
 {
Index: gcc/testsuite/gcc.c-torture/compile/calls.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/calls.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/calls.c	(working copy)
@@ -1,3 +1,4 @@ 
+/* { dg-require-effective-target int32plus } */
 typedef void  *(*T)(void);
 f1 ()
 {
Index: gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/limits-externdecl.c	(working copy)
@@ -1,3 +1,4 @@ 
+/* { dg-require-effective-target int32plus } */
 /* Inspired by the test case for PR middle-end/52640.  */
 
 typedef struct
@@ -52,4 +53,4 @@ 
 REFERENCE references[] = {
   LIM5 (X)
   0
-}; /* { dg-error "size of array is too large" "" { target avr-*-* } } */
+};
Index: gcc/testsuite/gcc.c-torture/compile/pr41181.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr41181.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/pr41181.c	(working copy)
@@ -1,3 +1,4 @@ 
+/* { dg-require-effective-target int32plus } */
 /* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ 
 char paths[1024];
 static void x264_slicetype_path(char (*best_paths)[250], int n, int length)
Index: gcc/testsuite/gcc.c-torture/compile/pr55955.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr55955.c	(revision 203032)
+++ gcc/testsuite/gcc.c-torture/compile/pr55955.c	(working copy)
@@ -1,3 +1,4 @@ 
+/* { dg-require-effective-target int32plus } */
 /* PR tree-optimization/55955 */
 
 int b;