diff mbox

[testsuite] : Adjust some tests of gcc.dg and gcc.c-torture for mingw targets

Message ID CAEwic4ZBE+kVYRXZLkAdmpbOtmreHXMoCA_TpWUEMtWcSGgjNg@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Feb. 23, 2012, 5:23 p.m. UTC
2012/2/23 Kai Tietz <ktietz70@googlemail.com>:
> 2012/2/23 Jakub Jelinek <jakub@redhat.com>:
>> Why?  I don't see extensions anywhere.  Or is __SIZE_TYPE__ on mingw
>> long long and requires __extension__?  If yes, it should at least go
>> right before the argument, but perhaps then it should be already
>> in the __SIZE_TYPE__ macro.
>
> The issue is that for LLP64 target __SIZE_TYPE__ is 'unsigned long long'.

And the underlying issue is that __extension__ can't be use before
__SIZE_TYPE__ here. gcc lacks to parse that proper.  You would get

opt-11.c:6:35: error: expected declaration specifiers or '...' before
'__extension__'
opt-11.c: In function 'main':
opt-11.c:28:3: warning: incompatible implicit declaration of built-in
function 'memset' [enabled by default]

So here is the updated version.

ChangeLog

2012-02-23  Kai Tietz  <ktietz@redhat.com>

	* gcc.dg/pack-test-5.c: Add -mno-ms-bitfields option
	for mingw-targets.
	* gcc.dg/Wpadded.c: Likewise.
	* gcc.dg/bf-ms-layout-2.c: Adjust offsets to fit ms-bitfield
	structure-layout.
	* gcc.dg/di-sync-multithread.c: Replace for mingw-target the use
	for sleep by Sleep and add windows.h include for this function.
	* gcc.dg/format/dfp-printf-1.c: Adjust dg-skip-if rule for mingw
	targets.
	* gcc.dg/stack-usage-1.c (SIZE): Provide proper SIZE for x64 mingw
	target.
	* gcc.dg/tls/thr-cse-1.c: Provide proper pattern for x64 mingw
	target.
	* gcc.dg/tls/opt-11.c (memset): Use __extension__ to avoid fail
	on x64 mingw target.
	* gcc.dg/bf-ms-attrib.c: Adjust expected size for ms_struct layout.
	* gcc.dg/pr50251.c: Disable test for x64 mingw target.
	* gcc.c-torture/execute/930930-1.c (long): Replace by ptr_t to avoid
	failure on LLP64 target.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_64-unknown-linux-gnu.  Ok for apply?

Regards,
Kai

Comments

Jakub Jelinek Feb. 23, 2012, 5:25 p.m. UTC | #1
On Thu, Feb 23, 2012 at 06:23:39PM +0100, Kai Tietz wrote:
> And the underlying issue is that __extension__ can't be use before
> __SIZE_TYPE__ here. gcc lacks to parse that proper.  You would get

Then please use
__extension__ typedef __SIZE_TYPE__ size_t;
and use size_t in the prototype.  __extension__ before the prototype
is simply too confusing.
Anyway, will defer the rest to the testsuite maintainers.

	Jakub
Mike Stump Feb. 23, 2012, 6:03 p.m. UTC | #2
On Feb 23, 2012, at 9:25 AM, Jakub Jelinek wrote:
> Anyway, will defer the rest to the testsuite maintainers.

Ok.
diff mbox

Patch

Index: gcc.dg/pack-test-5.c
===================================================================
--- gcc.dg/pack-test-5.c	(revision 184486)
+++ gcc.dg/pack-test-5.c	(working copy)
@@ -1,6 +1,7 @@ 
 /* PR c/11446: packed on a struct takes precedence over aligned on the type
    of a field.  */
 /* { dg-do run } */
+/* { dg-additional-options "-mno-ms-bitfields" { target *-*-mingw* } } */

 extern void abort (void);

Index: gcc.dg/bf-ms-layout-2.c
===================================================================
--- gcc.dg/bf-ms-layout-2.c	(revision 184503)
+++ gcc.dg/bf-ms-layout-2.c	(working copy)
@@ -158,27 +158,27 @@ 
   struct ten test_ten;

 #if defined (_TEST_MS_LAYOUT) || defined (_MSC_VER)
-  size_t exp_sizeof_one = 12;
-  size_t exp_sizeof_two = 16;
+  size_t exp_sizeof_one = 8;
+  size_t exp_sizeof_two = 12;
   size_t exp_sizeof_three =6;
   size_t exp_sizeof_four = 8;
   size_t exp_sizeof_five = 3;
   size_t exp_sizeof_six = 8;
   size_t exp_sizeof_seven = 3;
-  size_t exp_sizeof_eight = 4;
+  size_t exp_sizeof_eight = 2;
   size_t exp_sizeof_nine = 8;
-  size_t exp_sizeof_ten = 16;
+  size_t exp_sizeof_ten = 8;

-  unsigned char exp_one_c = 8;
-  unsigned char exp_two_c  = 12;
+  unsigned char exp_one_c = 7;
+  unsigned char exp_two_c  = 9;
   unsigned char exp_three_c = 4;
   unsigned char exp_four_c = 4;
   char exp_five_c = 2;
   char exp_six_c = 5;
   char exp_seven_c = 2;
-  char exp_eight_c = 2;
+  char exp_eight_c = 1;
   char exp_nine_c = 0;
-  char exp_ten_c = 8;
+  char exp_ten_c = 1;

 #else /* testing -mno-ms-bitfields */

Index: gcc.dg/di-sync-multithread.c
===================================================================
--- gcc.dg/di-sync-multithread.c	(revision 184486)
+++ gcc.dg/di-sync-multithread.c	(working copy)
@@ -10,6 +10,9 @@ 

 #include <pthread.h>
 #include <unistd.h>
+#ifdef _WIN32
+#include <windows.h>
+#endif

 /*#define DEBUGIT 1 */

@@ -175,7 +178,11 @@ 
 	t, err);
   };

+#ifdef _WIN32
+  Sleep (5000);
+#else
   sleep (5);
+#endif

   /* Stop please.  */
   __sync_lock_test_and_set (&doquit, 1ll);
Index: gcc.dg/format/dfp-printf-1.c
===================================================================
--- gcc.dg/format/dfp-printf-1.c	(revision 184486)
+++ gcc.dg/format/dfp-printf-1.c	(working copy)
@@ -3,7 +3,7 @@ 
 /* { dg-do compile } */
 /* { dg-require-effective-target dfp } */
 /* { dg-options "-Wformat" } */
-/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } } */
+/* { dg-skip-if "No scanf/printf dfp support" { *-*-mingw* } { "*" }
{ "" } } */

 extern int printf (const char *restrict, ...);

Index: gcc.dg/Wpadded.c
===================================================================
--- gcc.dg/Wpadded.c	(revision 184486)
+++ gcc.dg/Wpadded.c	(working copy)
@@ -5,7 +5,8 @@ 
    packing to be larger than 1, which cannot be guaranteed for all targets.
    We won't get a warning anyway if the target has "packed" structure
    layout.  */
-/* { dg-options "-Wpadded -fpack-struct=8" } */
+/* { dg-additional-options "-Wpadded -fpack-struct=8" } */
+/* { dg-additional-options "-mno-ms-bitfields" { target *-*-mingw* } } */

 struct foo {
   char bar;
Index: gcc.dg/stack-usage-1.c
===================================================================
--- gcc.dg/stack-usage-1.c	(revision 184486)
+++ gcc.dg/stack-usage-1.c	(working copy)
@@ -10,7 +10,11 @@ 
 #if defined(__i386__)
 #  define SIZE 248
 #elif defined(__x86_64__)
-#  define SIZE 356
+#  ifndef _WIN64
+#    define SIZE 356
+#  else
+#    define SIZE (256 - 24)
+#  endif
 #elif defined (__sparc__)
 #  if defined (__arch64__)
 #    define SIZE 76
Index: gcc.dg/pr49544.c
===================================================================
--- gcc.dg/pr49544.c	(revision 184486)
+++ gcc.dg/pr49544.c	(working copy)
@@ -3,6 +3,8 @@ 
 /* { dg-options "-g -O2" } */
 /* { dg-require-effective-target ptr32plus } */

+__extension__ typedef __PTRDIFF_TYPE__ ptr_t;
+
 int baz (int, int, void *);

 static inline __attribute__ ((always_inline)) long
@@ -16,5 +18,5 @@ 
 long
 bar (long x, long y, long z)
 {
-  return foo (x, y, (void *) z);
+  return foo (x, y, (void *) (ptr_t) z);
 }
Index: gcc.dg/tls/thr-cse-1.c
===================================================================
--- gcc.dg/tls/thr-cse-1.c	(revision 184486)
+++ gcc.dg/tls/thr-cse-1.c	(working copy)
@@ -18,10 +18,11 @@ 
   return a;
 }

-/* { dg-final { scan-assembler-not
"emutls_get_address.*emutls_get_address.*" { target { ! {
"*-wrs-vxworks"  "*-*-darwin8"  "hppa*-*-hpux*" "spu-*-*"
"i?86-*-mingw*" } } } } } */
+/* { dg-final { scan-assembler-not
"emutls_get_address.*emutls_get_address.*" { target { ! {
"*-wrs-vxworks"  "*-*-darwin8"  "hppa*-*-hpux*" "spu-*-*"
"i?86-*-mingw*" "x86_64-*-mingw*" } } } } } */
 /* { dg-final { scan-assembler-not
"call\tL___emutls_get_address.stub.*call\tL___emutls_get_address.stub.*"
{ target "*-*-darwin8" } } } */
 /* { dg-final { scan-assembler-not "(b,l|bl)
__emutls_get_address.*(b,l|bl) __emutls_get_address.*" { target
"hppa*-*-hpux*" } } } */
 /* { dg-final { scan-assembler-not
"(brsl|brasl)\t__emutls_get_address.*(brsl|brasl)\t__emutls_get_address.*"
{ target spu-*-* } } } */
 /* { dg-final { scan-assembler-not "tls_lookup.*tls_lookup.*" {
target *-wrs-vxworks } } } */
 /* { dg-final { scan-assembler-not
"call\t___emutls_get_address.*call\t___emutls_get_address" { target
"i?86-*-mingw*" } } } */
+/* { dg-final { scan-assembler-not
"call\t__emutls_get_address.*call\t__emutls_get_address" { target
"x86_64-*-mingw*" } } } */

Index: gcc.dg/tls/opt-11.c
===================================================================
--- gcc.dg/tls/opt-11.c	(revision 184486)
+++ gcc.dg/tls/opt-11.c	(working copy)
@@ -3,7 +3,7 @@ 
 /* { dg-add-options tls } */

 extern void abort (void);
-extern void *memset (void *, int, __SIZE_TYPE__);
+__extension__ extern void *memset (void *, int, __SIZE_TYPE__);

 struct A
 {
Index: gcc.dg/bf-ms-attrib.c
===================================================================
--- gcc.dg/bf-ms-attrib.c	(revision 184486)
+++ gcc.dg/bf-ms-attrib.c	(working copy)
@@ -32,7 +32,7 @@ 
     /* As long as the sizes are as expected, we know attributes are working.
        bf-ms-layout.c makes sure the right thing happens when the attribute
        is on. */
-    if (sizeof(struct one_ms) != 12)
+    if (sizeof(struct one_ms) != 8)
 	abort();
     if (sizeof(struct one_gcc) != 8)
 	abort();
Index: gcc.dg/pr50251.c
===================================================================
--- gcc.dg/pr50251.c	(revision 184486)
+++ gcc.dg/pr50251.c	(working copy)
@@ -1,4 +1,4 @@ 
-/* { dg-do compile } */
+/* { dg-do compile { target { ! { x86_64-*-mingw* } } } } */
 /* { dg-options "-O2" } */
 /* { dg-additional-options "-mpreferred-stack-boundary=12" { target
x86_64-*-* } } */

Index: gcc.c-torture/execute/930930-1.c
===================================================================
--- gcc.c-torture/execute/930930-1.c	(revision 184486)
+++ gcc.c-torture/execute/930930-1.c	(working copy)
@@ -1,23 +1,24 @@ 
-long *wm_TR;
-long *wm_HB;
-long *wm_SPB;
+__extension__ typedef __PTRDIFF_TYPE__ ptr_t;
+ptr_t *wm_TR;
+ptr_t *wm_HB;
+ptr_t *wm_SPB;

-long mem[100];
+ptr_t mem[100];

 f (mr_TR, mr_SPB, mr_HB, reg1, reg2)
-     long *mr_TR;
-     long *mr_SPB;
-     long *mr_HB;
-     long *reg1;
-     long *reg2;
+     ptr_t *mr_TR;
+     ptr_t *mr_SPB;
+     ptr_t *mr_HB;
+     ptr_t *reg1;
+     ptr_t *reg2;
 {
-  long *x = mr_TR;
+  ptr_t *x = mr_TR;

   for (;;)
     {
       if (reg1 < reg2)
 	goto out;
-      if ((long *) *reg1 < mr_HB && (long *) *reg1 >= mr_SPB)
+      if ((ptr_t *) *reg1 < mr_HB && (ptr_t *) *reg1 >= mr_SPB)
 	*--mr_TR = *reg1;
       reg1--;
     }
@@ -29,7 +30,7 @@ 

 main ()
 {
-  mem[99] = (long) mem;
+  mem[99] = (ptr_t) mem;
   f (mem + 100, mem + 6, mem + 8, mem + 99, mem + 99);
   exit (0);
 }