_Bool needs to be defined as macro in order to trigger the
context-sensitive macro expansion mechanism.

Bootstrapped and regtested on s390x.

Committed to mainline.

gcc/ChangeLog:

        * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define
        _Bool as macro expanding to _Bool.

gcc/testsuite/ChangeLog:

        * gcc.target/s390/zvector/vec-_Bool.c: New test.
---
 gcc/config/s390/s390-c.c                          | 2 ++
 gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c | 7 +++++++
 2 files changed, 9 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c

diff --git a/gcc/config/s390/s390-c.c b/gcc/config/s390/s390-c.c
index 7dbd8bf5da3..4cce2619ce4 100644
--- a/gcc/config/s390/s390-c.c
+++ b/gcc/config/s390/s390-c.c
@@ -367,6 +367,8 @@ s390_cpu_cpp_builtins_internal (cpp_reader *pfile,
                               old_opts, opts, "vector=vector", "vector");
       s390_def_or_undef_macro (pfile, target_flag_set_p (MASK_ZVECTOR),
                               old_opts, opts, "bool=bool", "bool");
+      s390_def_or_undef_macro (pfile, target_flag_set_p (MASK_ZVECTOR),
+                              old_opts, opts, "_Bool=_Bool", "_Bool");
       if (TARGET_ZVECTOR_P (opts->x_target_flags) && __vector_keyword == NULL)
        {
          __vector_keyword = get_identifier ("__vector");
diff --git a/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c 
b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c
new file mode 100644
index 00000000000..525b950253c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/s390/zvector/vec-_Bool.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=z13 -mzvector" } */
+
+vector _Bool char bc;
+vector _Bool short int bs;
+vector _Bool int bi;
+vector _Bool long long bll;
-- 
2.31.1

Reply via email to