public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing [PR102024]
       [not found]   ` <Yjn+roEFo0Aysrd3@tucnak>
@ 2022-03-24 10:40     ` Jakub Jelinek
  2022-03-24 10:41       ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2022-03-24 10:40 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

On Tue, Mar 22, 2022 at 05:51:58PM +0100, Jakub Jelinek via Gcc wrote:
> I guess it would be nice to include the testcases we are talking about,
> like { float x; int : 0; float y; } and { float x; int : 0; } and
> { int : 0; float x; } into compat.exp testsuite so that we see ABI
> differences in compat testing.

Here is a patch that does that.  It uses the struct-layout-1* framework,
but isn't generated because we don't want in this case pseudo-random
structure layouts, but particular ones we know cause or could cause problems
on some targets.  If other problematic cases are discovered, we can add
further ones.

Tested on x86_64-linux with:
make check-gcc check-g++ RUNTESTFLAGS='ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ compat.exp=pr102*'
and with
make check-gcc check-g++ RUNTESTFLAGS='compat.exp=pr102*'
The former as expected has:
FAIL: gcc.dg/compat/pr102024 c_compat_x_tst.o-c_compat_y_alt.o execute 
FAIL: gcc.dg/compat/pr102024 c_compat_x_alt.o-c_compat_y_tst.o execute 
fails because on x86_64 we've changed the C ABI but kept the C++ ABI here.
E.g. on rs6000 it should be the g++.dg such tests to fail (all assuming
the alt gcc/g++ is GCC 4.5 through 11).

Ok for trunk?

2022-03-24  Jakub Jelinek  <jakub@redhat.com>

	PR target/102024
	* gcc.dg/compat/pr102024_main.c: New test.
	* gcc.dg/compat/pr102024_test.h: New test.
	* gcc.dg/compat/pr102024_x.c: New test.
	* gcc.dg/compat/pr102024_y.c: New test.
	* g++.dg/compat/pr102024_main.C: New test.
	* g++.dg/compat/pr102024_test.h: New test.
	* g++.dg/compat/pr102024_x.C: New test.
	* g++.dg/compat/pr102024_y.C: New test.

--- gcc/testsuite/gcc.dg/compat/pr102024_main.c.jj	2022-03-24 10:56:13.283921666 +0100
+++ gcc/testsuite/gcc.dg/compat/pr102024_main.c	2022-03-24 11:20:36.186978012 +0100
@@ -0,0 +1,22 @@
+/* { dg-require-effective-target int32plus } */
+/* { dg-options "-Wno-abi" } */
+/* { dg-options "-mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+/* { dg-prune-output ".*-Wno-abi.*" } */
+/* { dg-prune-output ".*Offset of packed bit-field.*" } */
+#include "struct-layout-1.h"
+
+#define TX(n, type, attrs, fields, ops) extern void test##n (void);
+#include "pr102024_test.h"
+#undef TX
+
+int main (void)
+{
+#define TX(n, type, attrs, fields, ops)   test##n ();
+#include "pr102024_test.h"
+#undef TX
+  exit (fails != 0);
+}
--- gcc/testsuite/gcc.dg/compat/pr102024_test.h.jj	2022-03-24 10:56:16.137880896 +0100
+++ gcc/testsuite/gcc.dg/compat/pr102024_test.h	2022-03-24 11:12:43.616742282 +0100
@@ -0,0 +1,6 @@
+T(0,float a;int:0;float b;,F(0,a,42.0f,43.125f)F(0,b,-17.5f,35.75f))
+T(1,float a;int:0;,F(1,a,1.0f,17.125f))
+T(2,int:0;float a;,F(2,a,2.25f,16.5f))
+T(3,double a;long long:0;double b;,F(3,a,42.0,43.125)F(3,b,-17.5,35.75))
+T(4,double a;long long:0;,F(4,a,1.0,17.125))
+T(5,long long:0;double a;,F(5,a,2.25,16.5))
--- gcc/testsuite/gcc.dg/compat/pr102024_x.c.jj	2022-03-24 10:56:18.957840614 +0100
+++ gcc/testsuite/gcc.dg/compat/pr102024_x.c	2022-03-24 11:21:09.975494401 +0100
@@ -0,0 +1,10 @@
+/* { dg-options "-w -Wno-abi" } */
+/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+#include "struct-layout-1_x1.h"
+#include "pr102024_test.h"
+#include "struct-layout-1_x2.h"
+#include "pr102024_test.h"
--- gcc/testsuite/gcc.dg/compat/pr102024_y.c.jj	2022-03-24 10:56:21.893798677 +0100
+++ gcc/testsuite/gcc.dg/compat/pr102024_y.c	2022-03-24 11:21:17.288389732 +0100
@@ -0,0 +1,10 @@
+/* { dg-options "-w -Wno-abi" } */
+/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+#include "struct-layout-1_y1.h"
+#include "pr102024_test.h"
+#include "struct-layout-1_y2.h"
+#include "pr102024_test.h"
--- gcc/testsuite/g++.dg/compat/pr102024_main.C.jj	2022-03-24 10:56:13.283921666 +0100
+++ gcc/testsuite/g++.dg/compat/pr102024_main.C	2022-03-24 11:30:15.822681715 +0100
@@ -0,0 +1,26 @@
+/* { dg-require-effective-target int32plus } */
+/* { dg-options "-Wno-abi" } */
+/* { dg-options "-mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+
+#include "struct-layout-1.h"
+
+#define TX(n, type, attrs, fields, ops) extern void test##n (void);
+#include "pr102024_test.h"
+#undef TX
+
+int main (void)
+{
+#define TX(n, type, attrs, fields, ops)   test##n ();
+#include "pr102024_test.h"
+#undef TX
+  if (fails)
+    {
+      fflush (stdout);
+      abort ();
+    }
+  exit (0);
+}
--- gcc/testsuite/g++.dg/compat/pr102024_test.h.jj	2022-03-24 10:56:16.137880896 +0100
+++ gcc/testsuite/g++.dg/compat/pr102024_test.h	2022-03-24 11:12:43.616742282 +0100
@@ -0,0 +1,6 @@
+T(0,float a;int:0;float b;,F(0,a,42.0f,43.125f)F(0,b,-17.5f,35.75f))
+T(1,float a;int:0;,F(1,a,1.0f,17.125f))
+T(2,int:0;float a;,F(2,a,2.25f,16.5f))
+T(3,double a;long long:0;double b;,F(3,a,42.0,43.125)F(3,b,-17.5,35.75))
+T(4,double a;long long:0;,F(4,a,1.0,17.125))
+T(5,long long:0;double a;,F(5,a,2.25,16.5))
--- gcc/testsuite/g++.dg/compat/pr102024_x.C.jj	2022-03-24 10:56:18.957840614 +0100
+++ gcc/testsuite/g++.dg/compat/pr102024_x.C	2022-03-24 11:30:21.470600878 +0100
@@ -0,0 +1,11 @@
+/* { dg-options "-w -Wno-abi" } */
+/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+
+#include "struct-layout-1_x1.h"
+#include "pr102024_test.h"
+#include "struct-layout-1_x2.h"
+#include "pr102024_test.h"
--- gcc/testsuite/g++.dg/compat/pr102024_y.C.jj	2022-03-24 10:56:21.893798677 +0100
+++ gcc/testsuite/g++.dg/compat/pr102024_y.C	2022-03-24 11:30:26.078534922 +0100
@@ -0,0 +1,11 @@
+/* { dg-options "-w -Wno-abi" } */
+/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
+/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
+/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
+/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
+
+#include "struct-layout-1_y1.h"
+#include "pr102024_test.h"
+#include "struct-layout-1_y2.h"
+#include "pr102024_test.h"


	Jakub


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

* Re: [PATCH] testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing [PR102024]
  2022-03-24 10:40     ` [PATCH] testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing [PR102024] Jakub Jelinek
@ 2022-03-24 10:41       ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2022-03-24 10:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Thu, 24 Mar 2022, Jakub Jelinek wrote:

> On Tue, Mar 22, 2022 at 05:51:58PM +0100, Jakub Jelinek via Gcc wrote:
> > I guess it would be nice to include the testcases we are talking about,
> > like { float x; int : 0; float y; } and { float x; int : 0; } and
> > { int : 0; float x; } into compat.exp testsuite so that we see ABI
> > differences in compat testing.
> 
> Here is a patch that does that.  It uses the struct-layout-1* framework,
> but isn't generated because we don't want in this case pseudo-random
> structure layouts, but particular ones we know cause or could cause problems
> on some targets.  If other problematic cases are discovered, we can add
> further ones.
> 
> Tested on x86_64-linux with:
> make check-gcc check-g++ RUNTESTFLAGS='ALT_CC_UNDER_TEST=gcc ALT_CXX_UNDER_TEST=g++ compat.exp=pr102*'
> and with
> make check-gcc check-g++ RUNTESTFLAGS='compat.exp=pr102*'
> The former as expected has:
> FAIL: gcc.dg/compat/pr102024 c_compat_x_tst.o-c_compat_y_alt.o execute 
> FAIL: gcc.dg/compat/pr102024 c_compat_x_alt.o-c_compat_y_tst.o execute 
> fails because on x86_64 we've changed the C ABI but kept the C++ ABI here.
> E.g. on rs6000 it should be the g++.dg such tests to fail (all assuming
> the alt gcc/g++ is GCC 4.5 through 11).
> 
> Ok for trunk?

OK.

Richard.

> 2022-03-24  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR target/102024
> 	* gcc.dg/compat/pr102024_main.c: New test.
> 	* gcc.dg/compat/pr102024_test.h: New test.
> 	* gcc.dg/compat/pr102024_x.c: New test.
> 	* gcc.dg/compat/pr102024_y.c: New test.
> 	* g++.dg/compat/pr102024_main.C: New test.
> 	* g++.dg/compat/pr102024_test.h: New test.
> 	* g++.dg/compat/pr102024_x.C: New test.
> 	* g++.dg/compat/pr102024_y.C: New test.
> 
> --- gcc/testsuite/gcc.dg/compat/pr102024_main.c.jj	2022-03-24 10:56:13.283921666 +0100
> +++ gcc/testsuite/gcc.dg/compat/pr102024_main.c	2022-03-24 11:20:36.186978012 +0100
> @@ -0,0 +1,22 @@
> +/* { dg-require-effective-target int32plus } */
> +/* { dg-options "-Wno-abi" } */
> +/* { dg-options "-mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +/* { dg-prune-output ".*-Wno-abi.*" } */
> +/* { dg-prune-output ".*Offset of packed bit-field.*" } */
> +#include "struct-layout-1.h"
> +
> +#define TX(n, type, attrs, fields, ops) extern void test##n (void);
> +#include "pr102024_test.h"
> +#undef TX
> +
> +int main (void)
> +{
> +#define TX(n, type, attrs, fields, ops)   test##n ();
> +#include "pr102024_test.h"
> +#undef TX
> +  exit (fails != 0);
> +}
> --- gcc/testsuite/gcc.dg/compat/pr102024_test.h.jj	2022-03-24 10:56:16.137880896 +0100
> +++ gcc/testsuite/gcc.dg/compat/pr102024_test.h	2022-03-24 11:12:43.616742282 +0100
> @@ -0,0 +1,6 @@
> +T(0,float a;int:0;float b;,F(0,a,42.0f,43.125f)F(0,b,-17.5f,35.75f))
> +T(1,float a;int:0;,F(1,a,1.0f,17.125f))
> +T(2,int:0;float a;,F(2,a,2.25f,16.5f))
> +T(3,double a;long long:0;double b;,F(3,a,42.0,43.125)F(3,b,-17.5,35.75))
> +T(4,double a;long long:0;,F(4,a,1.0,17.125))
> +T(5,long long:0;double a;,F(5,a,2.25,16.5))
> --- gcc/testsuite/gcc.dg/compat/pr102024_x.c.jj	2022-03-24 10:56:18.957840614 +0100
> +++ gcc/testsuite/gcc.dg/compat/pr102024_x.c	2022-03-24 11:21:09.975494401 +0100
> @@ -0,0 +1,10 @@
> +/* { dg-options "-w -Wno-abi" } */
> +/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +#include "struct-layout-1_x1.h"
> +#include "pr102024_test.h"
> +#include "struct-layout-1_x2.h"
> +#include "pr102024_test.h"
> --- gcc/testsuite/gcc.dg/compat/pr102024_y.c.jj	2022-03-24 10:56:21.893798677 +0100
> +++ gcc/testsuite/gcc.dg/compat/pr102024_y.c	2022-03-24 11:21:17.288389732 +0100
> @@ -0,0 +1,10 @@
> +/* { dg-options "-w -Wno-abi" } */
> +/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +#include "struct-layout-1_y1.h"
> +#include "pr102024_test.h"
> +#include "struct-layout-1_y2.h"
> +#include "pr102024_test.h"
> --- gcc/testsuite/g++.dg/compat/pr102024_main.C.jj	2022-03-24 10:56:13.283921666 +0100
> +++ gcc/testsuite/g++.dg/compat/pr102024_main.C	2022-03-24 11:30:15.822681715 +0100
> @@ -0,0 +1,26 @@
> +/* { dg-require-effective-target int32plus } */
> +/* { dg-options "-Wno-abi" } */
> +/* { dg-options "-mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +
> +#include "struct-layout-1.h"
> +
> +#define TX(n, type, attrs, fields, ops) extern void test##n (void);
> +#include "pr102024_test.h"
> +#undef TX
> +
> +int main (void)
> +{
> +#define TX(n, type, attrs, fields, ops)   test##n ();
> +#include "pr102024_test.h"
> +#undef TX
> +  if (fails)
> +    {
> +      fflush (stdout);
> +      abort ();
> +    }
> +  exit (0);
> +}
> --- gcc/testsuite/g++.dg/compat/pr102024_test.h.jj	2022-03-24 10:56:16.137880896 +0100
> +++ gcc/testsuite/g++.dg/compat/pr102024_test.h	2022-03-24 11:12:43.616742282 +0100
> @@ -0,0 +1,6 @@
> +T(0,float a;int:0;float b;,F(0,a,42.0f,43.125f)F(0,b,-17.5f,35.75f))
> +T(1,float a;int:0;,F(1,a,1.0f,17.125f))
> +T(2,int:0;float a;,F(2,a,2.25f,16.5f))
> +T(3,double a;long long:0;double b;,F(3,a,42.0,43.125)F(3,b,-17.5,35.75))
> +T(4,double a;long long:0;,F(4,a,1.0,17.125))
> +T(5,long long:0;double a;,F(5,a,2.25,16.5))
> --- gcc/testsuite/g++.dg/compat/pr102024_x.C.jj	2022-03-24 10:56:18.957840614 +0100
> +++ gcc/testsuite/g++.dg/compat/pr102024_x.C	2022-03-24 11:30:21.470600878 +0100
> @@ -0,0 +1,11 @@
> +/* { dg-options "-w -Wno-abi" } */
> +/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +
> +#include "struct-layout-1_x1.h"
> +#include "pr102024_test.h"
> +#include "struct-layout-1_x2.h"
> +#include "pr102024_test.h"
> --- gcc/testsuite/g++.dg/compat/pr102024_y.C.jj	2022-03-24 10:56:21.893798677 +0100
> +++ gcc/testsuite/g++.dg/compat/pr102024_y.C	2022-03-24 11:30:26.078534922 +0100
> @@ -0,0 +1,11 @@
> +/* { dg-options "-w -Wno-abi" } */
> +/* { dg-options "-w -mno-mmx -Wno-abi" { target i?86-*-* x86_64-*-* } } */
> +/* { dg-options "-w -fno-common" { target hppa*-*-hpux* powerpc*-*-darwin* } } */
> +/* { dg-options "-w -mno-mmx -fno-common -Wno-abi" { target i?86-*-darwin* x86_64-*-darwin* } } */
> +/* { dg-options "-w -mno-base-addresses" { target mmix-*-* } } */
> +/* { dg-options "-w -mlongcalls -mtext-section-literals" { target xtensa*-*-* } } */
> +
> +#include "struct-layout-1_y1.h"
> +#include "pr102024_test.h"
> +#include "struct-layout-1_y2.h"
> +#include "pr102024_test.h"
> 
> 
> 	Jakub
> 
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Ivo Totev; HRB 36809 (AG Nuernberg)

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

end of thread, other threads:[~2022-03-24 10:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Yjinv1L21rVwLanm@tucnak>
     [not found] ` <121930f1-4c90-eb69-a87f-7158000f1592@foss.arm.com>
     [not found]   ` <Yjn+roEFo0Aysrd3@tucnak>
2022-03-24 10:40     ` [PATCH] testsuite: Add compat.exp testcase for most common zero width bitfld ABI passing [PR102024] Jakub Jelinek
2022-03-24 10:41       ` Richard Biener

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).