From 34228d731df404e3c19b30e7cd0336b2cf7fe49e Mon Sep 17 00:00:00 2001 From: Andreas Krebbel Date: Tue, 5 Jun 2018 14:08:59 +0000 Subject: [PATCH] S/390: Fix __builtin_tbeginc signature The builtin was accidentally defined to have an integer return value. Fixed with the attached patch. gcc/ChangeLog: 2018-06-05 Andreas Krebbel Backport from mainline 2018-06-05 Andreas Krebbel * config/s390/s390-builtin-types.def: Add void function type. * config/s390/s390-builtins.def: Use the function type for the tbeginc builtin. gcc/testsuite/ChangeLog: 2018-06-05 Andreas Krebbel Backport from mainline 2018-06-05 Andreas Krebbel * gcc.target/s390/htm-builtins-compile-4.c: New test. From-SVN: r261203 --- gcc/ChangeLog | 9 +++++++++ gcc/config/s390/s390-builtin-types.def | 1 + gcc/config/s390/s390-builtins.def | 2 +- gcc/testsuite/ChangeLog | 7 +++++++ gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c | 10 ++++++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 62fb98588731..aee7fdd54bf3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-06-05 Andreas Krebbel + + Backport from mainline + 2018-06-05 Andreas Krebbel + + * config/s390/s390-builtin-types.def: Add void function type. + * config/s390/s390-builtins.def: Use the function type for the + tbeginc builtin. + 2018-06-01 Bill Schmidt PR tree-optimization/85712 diff --git a/gcc/config/s390/s390-builtin-types.def b/gcc/config/s390/s390-builtin-types.def index f5fcf986c8fb..28e107c29106 100644 --- a/gcc/config/s390/s390-builtin-types.def +++ b/gcc/config/s390/s390-builtin-types.def @@ -129,6 +129,7 @@ DEF_OPAQUE_VECTOR_TYPE (BT_BV2DI, B_VX, BT_BLONGLONG, 2) DEF_OPAQUE_VECTOR_TYPE (BT_BV8HI, B_VX, BT_BSHORT, 8) DEF_FN_TYPE_0 (BT_FN_INT, B_HTM, BT_INT) DEF_FN_TYPE_0 (BT_FN_UINT, 0, BT_UINT) +DEF_FN_TYPE_0 (BT_FN_VOID, B_HTM, BT_VOID) DEF_FN_TYPE_1 (BT_FN_INT_INT, B_VX, BT_INT, BT_INT) DEF_FN_TYPE_1 (BT_FN_INT_VOIDPTR, B_HTM, BT_INT, BT_VOIDPTR) DEF_FN_TYPE_1 (BT_FN_OV4SI_INT, B_VX, BT_OV4SI, BT_INT) diff --git a/gcc/config/s390/s390-builtins.def b/gcc/config/s390/s390-builtins.def index 4bcdb22d529f..612342d2ecbe 100644 --- a/gcc/config/s390/s390-builtins.def +++ b/gcc/config/s390/s390-builtins.def @@ -289,7 +289,7 @@ OB_DEF_VAR (, , , ) */ -B_DEF (tbeginc, tbeginc, 0, B_HTM, 0, BT_FN_INT) +B_DEF (tbeginc, tbeginc, 0, B_HTM, 0, BT_FN_VOID) B_DEF (tbegin, tbegin, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR) B_DEF (tbegin_nofloat, tbegin_nofloat, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR) B_DEF (tbegin_retry, tbegin_retry, returns_twice_attr, B_HTM, 0, BT_FN_INT_VOIDPTR_INT) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e21528939c42..b769f11f3f46 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2018-06-05 Andreas Krebbel + + Backport from mainline + 2018-06-05 Andreas Krebbel + + * gcc.target/s390/htm-builtins-compile-4.c: New test. + 2018-06-02 Eric Botcazou * gnat.dg/discr53.ad[sb]: New test. diff --git a/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c new file mode 100644 index 000000000000..c3866bde4a4c --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/htm-builtins-compile-4.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -march=zEC12 -mzarch" } */ + +/* A bug in the builtin definition made__builtin_tbeginc to have an + integer return argument. */ +void +must_not_compile1 (void) +{ + int rc = __builtin_tbeginc (); /* { dg-error "void value not ignored as it ought to be" } */ +} -- 2.47.2