public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch,testsuite,applied] PR52641 Fix more fallout from sloppy tests.
@ 2024-01-07 15:53 Georg-Johann Lay
  2024-01-07 16:45 ` [patch, testsuite, applied] " Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Georg-Johann Lay @ 2024-01-07 15:53 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

Made some tests more generic so they can pass on more targets.

Johann

--

testsuite/52641: Fix fallout from sloppy tests.

gcc/testsuite/
	PR testsuite/52641
	* gcc.dg/torture/pr110838.c: Use proper shift offset to get MSB or int.
	* gcc.dg/torture/pr112282.c: Use at least 32 bits for :20 bit-fields.
	* gcc.dg/tree-ssa/bitcmp-5.c: Use integral type with 32 bits or more.
	* gcc.dg/tree-ssa/bitcmp-6.c: Same.
	* gcc.dg/tree-ssa/cltz-complement-max.c: Same.
	* gcc.dg/tree-ssa/cltz-max.c: Same.
	* gcc.dg/tree-ssa/if-to-switch-8.c: Use literals that fit int.
	* gcc.dg/tree-ssa/if-to-switch-9.c [avr]: Set case-values-threshold=3.
	* gcc.dg/tree-ssa/negneg-3.c: Discriminate [not] large_double.
	* gcc.dg/tree-ssa/phi-opt-25b.c: Use types of correct widths for
	__builtin_bswapN.
	* gcc.dg/tree-ssa/pr55177-1.c: Same.
	* gcc.dg/tree-ssa/popcount-max.c: Use int32_t where required.
	* gcc.dg/tree-ssa/pr111583-1.c: Use intptr_t as needed.
	* gcc.dg/tree-ssa/pr111583-2.c: Same.

[-- Attachment #2: pr52641-3.diff --]
[-- Type: text/x-patch, Size: 7726 bytes --]

diff --git a/gcc/testsuite/gcc.dg/torture/pr110838.c b/gcc/testsuite/gcc.dg/torture/pr110838.c
index f039bd6c8ea..ae2874b6d0d 100644
--- a/gcc/testsuite/gcc.dg/torture/pr110838.c
+++ b/gcc/testsuite/gcc.dg/torture/pr110838.c
@@ -5,10 +5,12 @@ typedef __UINT8_TYPE__ uint8_t;
 typedef __INT8_TYPE__ int8_t;
 typedef uint8_t pixel;
 
+#define MSB (__CHAR_BIT__ * __SIZEOF_INT__ - 1)
+
 /* get the sign of input variable (TODO: this is a dup, make common) */
 static inline int8_t signOf(int x)
 {
-  return (x >> 31) | ((int)((((uint32_t)-x)) >> 31));
+  return (x >> MSB) | ((int)((((uint32_t)-x)) >> MSB));
 }
 
 __attribute__((noipa))
diff --git a/gcc/testsuite/gcc.dg/torture/pr112282.c b/gcc/testsuite/gcc.dg/torture/pr112282.c
index 6190b90cf66..cfe364f9a84 100644
--- a/gcc/testsuite/gcc.dg/torture/pr112282.c
+++ b/gcc/testsuite/gcc.dg/torture/pr112282.c
@@ -1,5 +1,11 @@
 /* { dg-do run } */
 
+#if __SIZEOF_INT__ < 4
+#define Xint __INT32_TYPE__
+#else
+#define Xint int
+#endif
+
 int printf(const char *, ...);
 void abort ();
 /* We need an abort that isn't noreturn.  */
@@ -10,8 +16,8 @@ void __attribute__((noipa)) my_abort ()
 int a, g, h, i, v, w = 2, x, y, ab, ac, ad, ae, af, ag;
 static int f, j, m, n, p, r, u, aa;
 struct b {
-  int c : 20;
-  int d : 20;
+  Xint c : 20;
+  Xint d : 20;
   int e : 10;
 };
 static struct b l, o, q = {3, 3, 5};
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c
index a6be14294b4..8def5ad3cca 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c
@@ -6,6 +6,9 @@
    of `(a & b) CMP a` and `(a | b) CMP a`
    which can be optimized to 1. */
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
 
 /* For `&`, the non-negativeness of b is not taken into account. */
 int f_and_le(int len) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c
index a86a19fbef2..cea377489eb 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c
@@ -6,6 +6,10 @@
    of `(a & b) CMP a` and `(a | b) CMP a`
    which can be optimized to 0. */
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
 /* For `&`, the non-negativeness of b is not taken into account. */
 int f_and_gt(int len) {
   len &= 0xfffff;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
index 1a29ca52e42..7b3599a8a4e 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
@@ -3,6 +3,10 @@
 
 #define PREC (__CHAR_BIT__)
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
 int clz_complement_count1 (unsigned char b) {
     int c = 0;
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
index a6bea3d3389..78b0d017be8 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
@@ -3,6 +3,10 @@
 
 #define PREC (__CHAR_BIT__)
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
 int clz_count1 (unsigned char b) {
     int c = 0;
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c
index f4d06fed2b6..36cb74b7279 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c
@@ -20,7 +20,7 @@ int foo(int a, int b)
     else if (a == 10)
       global2 = 12345;
     else if (a == 1)
-      global2 = 123456;
+      global2 = 23456;
   }
 }
 
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c
index e67198bf8c3..ce6dc341ded 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c
@@ -1,6 +1,7 @@
 /* PR tree-optimization/88702 */
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */
+/* { dg-additional-options "--param=case-values-threshold=3" { target { avr-*-* } } } */
 
 int IsHTMLWhitespace(int aChar) {                         
   return aChar == 0x0009 || aChar == 0x000A ||              
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c b/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c
index 9deb9f6f320..96031454832 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c
@@ -12,4 +12,5 @@ DEF(0, unsigned, long long)
 DEF(1, unsigned, unsigned long long)
 DEF(2, double, float)
 
-/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized"} } */
+/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized" { target { large_double } } } } */
+/* { dg-final { scan-tree-dump-times "negate_expr" 4 "optimized" { target { ! large_double } } } } */
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
index 0fd9b004a03..2cb4361dc00 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
@@ -5,17 +5,17 @@
 /* Test to make sure unrelated arguments and comparisons
    don't get optimized incorrectly. */
 
-unsigned short test_bswap16(unsigned short x, unsigned short y)
+__UINT16_TYPE__ short test_bswap16(__UINT16_TYPE__ x, __UINT16_TYPE__ y)
 {
   return x ? __builtin_bswap16(y) : 0;
 }
 
-unsigned int test_bswap32(unsigned int x, unsigned int y)
+__UINT32_TYPE__ test_bswap32(__UINT32_TYPE__ x, __UINT32_TYPE__ y)
 {
   return x ? __builtin_bswap32(y) : 0;
 }
 
-unsigned long long test_bswap64(unsigned long long x, unsigned long long y)
+__UINT64_TYPE__ test_bswap64(__UINT64_TYPE__ x, __UINT64_TYPE__ y)
 {
   return x ? __builtin_bswap64(y) : 0;
 }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
index ca7204cbc3c..8f012626f50 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
@@ -3,7 +3,7 @@
 
 #define PREC (__CHAR_BIT__)
 
-int count1 (unsigned char b) {
+__INT32_TYPE__ count1 (unsigned char b) {
     int c = 0;
 
     while (b) {
@@ -16,7 +16,7 @@ int count1 (unsigned char b) {
       return 34567;
 }
 
-int count2 (unsigned char b) {
+__INT32_TYPE__ count2 (unsigned char b) {
     int c = 0;
 
     while (b) {
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c
index 1dd8dbcf1d8..0dda1a72b57 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c
@@ -12,7 +12,7 @@ int main()
       a = 1;
       for (; a; a++) {
 	    {
-	      long b = j, d = h;
+	      __INTPTR_TYPE__ b = j, d = h;
 	      int c = 0;
 	      while (d--)
 		*(char *)b++ = c;
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c
index 0ee21854552..68d28116229 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c
@@ -18,7 +18,7 @@ static short m(unsigned k) {
   const unsigned short *n[65];
   g = &n[4];
   k || l();
-  long a = k;
+  __INTPTR_TYPE__ a = k;
   char i = 0;
   unsigned long j = k;
   while (j--)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c
index de1a264345c..2630707e061 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c
@@ -1,10 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-optimized" } */
-extern int x;
+extern __INT32_TYPE__ x;
 
 void foo(void)
 {
-  int a = __builtin_bswap32(x);
+  __INT32_TYPE__ a = __builtin_bswap32(x);
   a &= 0x5a5b5c5d;
   x = __builtin_bswap32(a);
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch, testsuite, applied] PR52641 Fix more fallout from sloppy tests.
  2024-01-07 15:53 [patch,testsuite,applied] PR52641 Fix more fallout from sloppy tests Georg-Johann Lay
@ 2024-01-07 16:45 ` Jeff Law
  2024-01-07 17:17   ` Georg-Johann Lay
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2024-01-07 16:45 UTC (permalink / raw)
  To: Georg-Johann Lay, gcc-patches



On 1/7/24 08:53, Georg-Johann Lay wrote:
> Made some tests more generic so they can pass on more targets.
> 
> Johann
> 
> -- 
> 
> testsuite/52641: Fix fallout from sloppy tests.
> 
> gcc/testsuite/
>      PR testsuite/52641
>      * gcc.dg/torture/pr110838.c: Use proper shift offset to get MSB or 
> int.
>      * gcc.dg/torture/pr112282.c: Use at least 32 bits for :20 bit-fields.
>      * gcc.dg/tree-ssa/bitcmp-5.c: Use integral type with 32 bits or more.
>      * gcc.dg/tree-ssa/bitcmp-6.c: Same.
>      * gcc.dg/tree-ssa/cltz-complement-max.c: Same.
>      * gcc.dg/tree-ssa/cltz-max.c: Same.
>      * gcc.dg/tree-ssa/if-to-switch-8.c: Use literals that fit int.
>      * gcc.dg/tree-ssa/if-to-switch-9.c [avr]: Set case-values-threshold=3.
>      * gcc.dg/tree-ssa/negneg-3.c: Discriminate [not] large_double.
>      * gcc.dg/tree-ssa/phi-opt-25b.c: Use types of correct widths for
>      __builtin_bswapN.
>      * gcc.dg/tree-ssa/pr55177-1.c: Same.
>      * gcc.dg/tree-ssa/popcount-max.c: Use int32_t where required.
>      * gcc.dg/tree-ssa/pr111583-1.c: Use intptr_t as needed.
>      * gcc.dg/tree-ssa/pr111583-2.c: Same.
Are you checking this on other targets?  My tester just started 
complaining about these (ft30-elf, fr30-elf), more expected as today's 
run progresses)


> Tests that now fail, but worked before (2 tests):
> 
> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)
> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)

Jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch, testsuite, applied] PR52641 Fix more fallout from sloppy tests.
  2024-01-07 16:45 ` [patch, testsuite, applied] " Jeff Law
@ 2024-01-07 17:17   ` Georg-Johann Lay
  2024-01-07 19:10     ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Georg-Johann Lay @ 2024-01-07 17:17 UTC (permalink / raw)
  To: Jeff Law, gcc-patches



Am 07.01.24 um 17:45 schrieb Jeff Law:
> 
> 
> On 1/7/24 08:53, Georg-Johann Lay wrote:
>> Made some tests more generic so they can pass on more targets.
>>
>> Johann
>>
>> -- 
>>
>> testsuite/52641: Fix fallout from sloppy tests.
>>
>> gcc/testsuite/
>>      PR testsuite/52641
>>      * gcc.dg/torture/pr110838.c: Use proper shift offset to get MSB 
>> or int.
>>      * gcc.dg/torture/pr112282.c: Use at least 32 bits for :20 
>> bit-fields.
>>      * gcc.dg/tree-ssa/bitcmp-5.c: Use integral type with 32 bits or 
>> more.
>>      * gcc.dg/tree-ssa/bitcmp-6.c: Same.
>>      * gcc.dg/tree-ssa/cltz-complement-max.c: Same.
>>      * gcc.dg/tree-ssa/cltz-max.c: Same.
>>      * gcc.dg/tree-ssa/if-to-switch-8.c: Use literals that fit int.
>>      * gcc.dg/tree-ssa/if-to-switch-9.c [avr]: Set 
>> case-values-threshold=3.
>>      * gcc.dg/tree-ssa/negneg-3.c: Discriminate [not] large_double.
>>      * gcc.dg/tree-ssa/phi-opt-25b.c: Use types of correct widths for
>>      __builtin_bswapN.
>>      * gcc.dg/tree-ssa/pr55177-1.c: Same.
>>      * gcc.dg/tree-ssa/popcount-max.c: Use int32_t where required.
>>      * gcc.dg/tree-ssa/pr111583-1.c: Use intptr_t as needed.
>>      * gcc.dg/tree-ssa/pr111583-2.c: Same.
> Are you checking this on other targets?  My tester just started 
> complaining about these (ft30-elf, fr30-elf), more expected as today's 
> run progresses)
> 
> 
>> Tests that now fail, but worked before (2 tests):
>>
>> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)
>> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)
> 
> Jeff

Hi Jeff, thanks for fixing the typo.

It slipped through because "int short" works in that place.

Usually when going after PR52641 I used dg-require, dg-skip or
dg-xfail for tests that fail on 16-bit int etc.

The take above was more ambitious in that it tried to make some
tests work without breaking other platforms of course.

It's not always easy to get the intent of a test case and how
to make it more generic though.

Johann

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch, testsuite, applied] PR52641 Fix more fallout from sloppy tests.
  2024-01-07 17:17   ` Georg-Johann Lay
@ 2024-01-07 19:10     ` Jeff Law
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Law @ 2024-01-07 19:10 UTC (permalink / raw)
  To: Georg-Johann Lay, gcc-patches



On 1/7/24 10:17, Georg-Johann Lay wrote:
> 
> 
> Am 07.01.24 um 17:45 schrieb Jeff Law:
>>
>>
>> On 1/7/24 08:53, Georg-Johann Lay wrote:
>>> Made some tests more generic so they can pass on more targets.
>>>
>>> Johann
>>>
>>> -- 
>>>
>>> testsuite/52641: Fix fallout from sloppy tests.
>>>
>>> gcc/testsuite/
>>>      PR testsuite/52641
>>>      * gcc.dg/torture/pr110838.c: Use proper shift offset to get MSB 
>>> or int.
>>>      * gcc.dg/torture/pr112282.c: Use at least 32 bits for :20 
>>> bit-fields.
>>>      * gcc.dg/tree-ssa/bitcmp-5.c: Use integral type with 32 bits or 
>>> more.
>>>      * gcc.dg/tree-ssa/bitcmp-6.c: Same.
>>>      * gcc.dg/tree-ssa/cltz-complement-max.c: Same.
>>>      * gcc.dg/tree-ssa/cltz-max.c: Same.
>>>      * gcc.dg/tree-ssa/if-to-switch-8.c: Use literals that fit int.
>>>      * gcc.dg/tree-ssa/if-to-switch-9.c [avr]: Set 
>>> case-values-threshold=3.
>>>      * gcc.dg/tree-ssa/negneg-3.c: Discriminate [not] large_double.
>>>      * gcc.dg/tree-ssa/phi-opt-25b.c: Use types of correct widths for
>>>      __builtin_bswapN.
>>>      * gcc.dg/tree-ssa/pr55177-1.c: Same.
>>>      * gcc.dg/tree-ssa/popcount-max.c: Use int32_t where required.
>>>      * gcc.dg/tree-ssa/pr111583-1.c: Use intptr_t as needed.
>>>      * gcc.dg/tree-ssa/pr111583-2.c: Same.
>> Are you checking this on other targets?  My tester just started 
>> complaining about these (ft30-elf, fr30-elf), more expected as today's 
>> run progresses)
>>
>>
>>> Tests that now fail, but worked before (2 tests):
>>>
>>> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)
>>> ft32-sim: gcc: gcc.dg/tree-ssa/phi-opt-25b.c (test for excess errors)
>>
>> Jeff
> 
> Hi Jeff, thanks for fixing the typo.
> 
> It slipped through because "int short" works in that place.
> 
> Usually when going after PR52641 I used dg-require, dg-skip or
> dg-xfail for tests that fail on 16-bit int etc.
Yea.  We're not terribly good about keeping the testsuite 16bit clean. 
Just not that much interest in such ports.  Just to be clear -- I'm 
happy to see the testsuite improved by reducing noise, even on these 
lesser used platforms.

> 
> The take above was more ambitious in that it tried to make some
> tests work without breaking other platforms of course.
ACK.  It happens.  Just a reminder to be careful.  I've already fixed it 
on the trunk.



> 
> It's not always easy to get the intent of a test case and how
> to make it more generic though.
Absolutely true.

Thanks again,

jeff


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [patch,testsuite,applied] PR52641: Fix more fallout from sloppy tests.
@ 2024-01-07 12:14 Georg-Johann Lay
  0 siblings, 0 replies; 5+ messages in thread
From: Georg-Johann Lay @ 2024-01-07 12:14 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]

This patch rectifies more tests that make assumptions on
sizeof(int), sizeof(void*), etc.

Johann

--

testsuite/52641: Fix fallout from sloppy tests.

gcc/testsuite/
	PR testsuite/52641
	* gcc.dg/memchr-3.c [avr]: Anticipate -Wbuiltin-declaration-mismatch.
	* gcc.dg/pr103207.c: Use __INT32_TYPE__ instead of int.
	* gcc.dg/pr103451.c [void* != long]: Anticipate -Wpointer-to-int-cast.
	* gcc.dg/pr110496.c [void* != long]: Anticipate -Wint-to-pointer-cast.
	* gcc.dg/pr109977.c: Use __SIZEOF_DOUBLE__ instead of 8.
	* gcc.dg/pr110506-2.c: Use __UINT32_TYPE__ for uint32_t.
	* gcc.dg/pr110582.c: Require int32plus.
	* gcc.dg/pr111039.c: [sizeof(int) < 4]: Use __INT32_TYPE__.
	* gcc.dg/pr111599.c: Same.
	* gcc.dg/builtin-dynamic-object-size-0.c: Require size20plus.
	* gcc.dg/builtin-object-size-1.c [avr]: Skip tests with strndup.
	* gcc.dg/builtin-object-size-2.c: Same.
	* gcc.dg/builtin-object-size-3.c: Same.
	* gcc.dg/builtin-object-size-4.c: Same.
	* gcc.dg/pr111070.c: Use __UINTPTR_TYPE__ instead of unsigned long.
	* gcc.dg/debug/btf/btf-pr106773.c: Same.
	* gcc.dg/debug/btf/btf-bitfields-2.c: [sizeof(int) < 4]: Use
	__UINT32_TYPE__.

[-- Attachment #2: pr52641-2.diff --]
[-- Type: text/x-patch, Size: 8766 bytes --]

diff --git a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c
index 07e3da6f254..c3ac6230d4d 100644
--- a/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c
+++ b/gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c
@@ -1,5 +1,6 @@
 /* { dg-do run } */
 /* { dg-options "-O2" } */
+/* { dg-require-effective-target size20plus } */
 
 #include "builtin-object-size-common.h"
 
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-1.c b/gcc/testsuite/gcc.dg/builtin-object-size-1.c
index db325801f93..64c4bc4da39 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-1.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-1.c
@@ -621,6 +621,7 @@ test10 (void)
     }
 }
 
+#ifndef __AVR__ /* avr has no strndup */
 /* Tests for strdup/strndup.  */
 size_t
 __attribute__ ((noinline))
@@ -708,6 +709,7 @@ test11 (void)
     FAIL ();
   free (res);
 }
+#endif /* avr */
 
 int
 main (void)
@@ -724,6 +726,8 @@ main (void)
   test8 ();
   test9 (1);
   test10 ();
+#ifndef __AVR__ /* avr has no strndup */
   test11 ();
+#endif
   DONE ();
 }
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-2.c b/gcc/testsuite/gcc.dg/builtin-object-size-2.c
index 4c71b1f6a37..da10b6b0632 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-2.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-2.c
@@ -536,6 +536,7 @@ test8 (unsigned cond)
 #endif
 }
 
+#ifndef __AVR__ /* avr has no strndup */
 /* Tests for strdup/strndup.  */
 size_t
 __attribute__ ((noinline))
@@ -623,6 +624,7 @@ test9 (void)
     FAIL ();
   free (res);
 }
+#endif /* avr */
 
 int
 main (void)
@@ -637,6 +639,8 @@ main (void)
   test6 ();
   test7 ();
   test8 (1);
+#ifndef __AVR__ /* avr has no strndup */
   test9 ();
+#endif
   DONE ();
 }
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-3.c b/gcc/testsuite/gcc.dg/builtin-object-size-3.c
index 3d907ef4814..f23873bec38 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-3.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-3.c
@@ -628,6 +628,7 @@ test10 (void)
     }
 }
 
+#ifndef __AVR__ /* avr has no strndup */
 /* Tests for strdup/strndup.  */
 size_t
 __attribute__ ((noinline))
@@ -716,6 +717,7 @@ test11 (void)
     FAIL ();
   free (res);
 }
+#endif /* avr */
 
 int
 main (void)
@@ -732,6 +734,8 @@ main (void)
   test8 ();
   test9 (1);
   test10 ();
+#ifndef __AVR__ /* avr has no strndup */
   test11 ();
+#endif
   DONE ();
 }
diff --git a/gcc/testsuite/gcc.dg/builtin-object-size-4.c b/gcc/testsuite/gcc.dg/builtin-object-size-4.c
index c9af07499a4..dcb042f34b6 100644
--- a/gcc/testsuite/gcc.dg/builtin-object-size-4.c
+++ b/gcc/testsuite/gcc.dg/builtin-object-size-4.c
@@ -509,6 +509,7 @@ test8 (unsigned cond)
 #endif
 }
 
+#ifndef __AVR__ /* avr has no strndup */
 /* Tests for strdup/strndup.  */
 size_t
 __attribute__ ((noinline))
@@ -596,6 +597,7 @@ test9 (void)
     FAIL ();
   free (res);
 }
+#endif /* avr */
 
 int
 main (void)
@@ -610,6 +612,8 @@ main (void)
   test6 ();
   test7 ();
   test8 (1);
+#ifndef __AVR__ /* avr has no strndup */
   test9 ();
+#endif
   DONE ();
 }
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
index 03c323a6d49..2ec00dc6796 100644
--- a/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-bitfields-2.c
@@ -18,6 +18,10 @@
 /* Only 2 members.  */
 /* { dg-final { scan-assembler-times "MEMBER" 2 } } */
 
+#if __SIZEOF_INT__ < 4
+#define unsigned __UINT32_TYPE__
+#endif
+
 struct foo
 {
   unsigned a : 31;
diff --git a/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c
index f90fa773a4b..511a54f800d 100644
--- a/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c
+++ b/gcc/testsuite/gcc.dg/debug/btf/btf-pr106773.c
@@ -17,8 +17,8 @@
 extern const void foo __attribute__((weak)) __attribute__((section (".ksyms")));
 extern const void bar __attribute__((weak)) __attribute__((section (".ksyms")));
 
-unsigned long func () {
-  unsigned long x = (unsigned long) &foo;
+__UINTPTR_TYPE__ long func () {
+  __UINTPTR_TYPE__ x = (__UINTPTR_TYPE__) &foo;
 
   return x;
 }
diff --git a/gcc/testsuite/gcc.dg/memchr-3.c b/gcc/testsuite/gcc.dg/memchr-3.c
index 9c73265a89e..9a357351950 100644
--- a/gcc/testsuite/gcc.dg/memchr-3.c
+++ b/gcc/testsuite/gcc.dg/memchr-3.c
@@ -6,7 +6,7 @@
 typedef __INT8_TYPE__  int8_t;
 typedef __INT32_TYPE__ int32_t;
 
-extern void* memchr (const void*, int, long); /* { dg-warning "-Wbuiltin-declaration-mismatch" "" { target llp64 } } */
+extern void* memchr (const void*, int, long); /* { dg-warning "-Wbuiltin-declaration-mismatch" "" { target { llp64 || avr-*-* } } } */
 
 struct SX
 {
diff --git a/gcc/testsuite/gcc.dg/pr103207.c b/gcc/testsuite/gcc.dg/pr103207.c
index 69c0f555f86..b3043f471fb 100644
--- a/gcc/testsuite/gcc.dg/pr103207.c
+++ b/gcc/testsuite/gcc.dg/pr103207.c
@@ -1,7 +1,7 @@
 // { dg-do compile }
 // { dg-options "-O2 --param case-values-threshold=1 -w" }
 
-int f (int i)
+int f (__INT32_TYPE__ i)
 {
   switch (i) {
   case 2147483647:
diff --git a/gcc/testsuite/gcc.dg/pr103451.c b/gcc/testsuite/gcc.dg/pr103451.c
index db724aa1233..6fa84b406b3 100644
--- a/gcc/testsuite/gcc.dg/pr103451.c
+++ b/gcc/testsuite/gcc.dg/pr103451.c
@@ -13,7 +13,7 @@ void func_10(long li_8)
 
 void func_9_s_8(void)
 {
-  func_10((long) func_9_s_8);
+  func_10((long) func_9_s_8); /* { dg-warning "-Wpointer-to-int-cast" "" { target { ! ptr_eq_long } } } */
 }
 
 // { dg-final { scan-tree-dump " / 0" "optimized" } }
diff --git a/gcc/testsuite/gcc.dg/pr109977.c b/gcc/testsuite/gcc.dg/pr109977.c
index 03d9a333134..c0be161ef4e 100644
--- a/gcc/testsuite/gcc.dg/pr109977.c
+++ b/gcc/testsuite/gcc.dg/pr109977.c
@@ -2,8 +2,8 @@
 /* { dg-do compile } */
 /* { dg-options "-Og" } */
 
-typedef double __attribute__((__vector_size__ (8))) V;
-typedef double __attribute__((__vector_size__ (16))) W;
+typedef double __attribute__((__vector_size__ (__SIZEOF_DOUBLE__))) V;
+typedef double __attribute__((__vector_size__ (__SIZEOF_DOUBLE__*2))) W;
 V v;
 int i;
 extern void bar (void *);
diff --git a/gcc/testsuite/gcc.dg/pr110496.c b/gcc/testsuite/gcc.dg/pr110496.c
index 3c3d12fb532..5a168fde3e1 100644
--- a/gcc/testsuite/gcc.dg/pr110496.c
+++ b/gcc/testsuite/gcc.dg/pr110496.c
@@ -7,7 +7,7 @@ int f_MV0__x;
 void f() {
   unsigned char *rptr;
   unsigned char valbuf[6];
-  rptr = (unsigned char *)contents;
+  rptr = (unsigned char *)contents;  /* { dg-warning "-Wint-to-pointer-cast" "" { target { ! ptr_eq_long } } } */
   if (decide())
     do {
       __builtin_memcpy(valbuf, &f_MV0__x, sizeof(int));
diff --git a/gcc/testsuite/gcc.dg/pr110506-2.c b/gcc/testsuite/gcc.dg/pr110506-2.c
index aabca0fa156..4bc9089a206 100644
--- a/gcc/testsuite/gcc.dg/pr110506-2.c
+++ b/gcc/testsuite/gcc.dg/pr110506-2.c
@@ -1,7 +1,7 @@
 /* { dg-do compile } */
 /* { dg-options "-O2" } */
 
-typedef unsigned uint32_t;
+typedef __UINT32_TYPE__ uint32_t;
 typedef uint32_t uint32x4 __attribute__((vector_size(16)));
 typedef struct {
   uint32x4 b, d;
diff --git a/gcc/testsuite/gcc.dg/pr110582.c b/gcc/testsuite/gcc.dg/pr110582.c
index ae0650d3ae7..6607cf5c895 100644
--- a/gcc/testsuite/gcc.dg/pr110582.c
+++ b/gcc/testsuite/gcc.dg/pr110582.c
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
 /* { dg-options "-O2 -fdump-tree-vrp2" } */
+/* { dg-require-effective-target int32plus } */
 
 int a, b;
 int main() {
diff --git a/gcc/testsuite/gcc.dg/pr111039.c b/gcc/testsuite/gcc.dg/pr111039.c
index bec9983b35f..a64c46c7edc 100644
--- a/gcc/testsuite/gcc.dg/pr111039.c
+++ b/gcc/testsuite/gcc.dg/pr111039.c
@@ -1,6 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-O" } */
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
 int _setjmp ();
 void abcd ();
 void abcde ();
diff --git a/gcc/testsuite/gcc.dg/pr111070.c b/gcc/testsuite/gcc.dg/pr111070.c
index 1ebc7adf782..1de3a3680fe 100644
--- a/gcc/testsuite/gcc.dg/pr111070.c
+++ b/gcc/testsuite/gcc.dg/pr111070.c
@@ -12,9 +12,9 @@ char d_ary[1] = {1};
 
 int main ()
 {
-  if (((unsigned long)&c_ary[0] & 7) != 0)
+  if (((__UINTPTR_TYPE__)&c_ary[0] & 7) != 0)
     return 1;
-  if (((unsigned long)&d_ary[0] & 7) != 0)
+  if (((__UINTPTR_TYPE__)&d_ary[0] & 7) != 0)
     return 1;
   return 0;
 }
diff --git a/gcc/testsuite/gcc.dg/pr111599.c b/gcc/testsuite/gcc.dg/pr111599.c
index 25880b759f7..e2f2542c561 100644
--- a/gcc/testsuite/gcc.dg/pr111599.c
+++ b/gcc/testsuite/gcc.dg/pr111599.c
@@ -1,6 +1,10 @@
 /* { dg-do compile } */
 /* { dg-options "-O3 -fno-inline-functions-called-once -fno-inline-small-functions -fno-tree-dce -fno-tree-forwprop -fno-tree-fre" } */
 
+#if __SIZEOF_INT__ < 4
+#define int __INT32_TYPE__
+#endif
+
 int h(void);
 void l(int);
 void func_56(int p_57, unsigned p_58) {

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-07 19:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-07 15:53 [patch,testsuite,applied] PR52641 Fix more fallout from sloppy tests Georg-Johann Lay
2024-01-07 16:45 ` [patch, testsuite, applied] " Jeff Law
2024-01-07 17:17   ` Georg-Johann Lay
2024-01-07 19:10     ` Jeff Law
  -- strict thread matches above, loose matches on Subject: below --
2024-01-07 12:14 [patch,testsuite,applied] PR52641: " Georg-Johann Lay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).