diff mbox series

[v2] arm: Don't ICE on arm_mve.h pragma without MVE types [PR117408]

Message ID 20241107165803.1896195-1-torbjorn.svensson@foss.st.com
State New
Headers show
Series [v2] arm: Don't ICE on arm_mve.h pragma without MVE types [PR117408] | expand

Commit Message

Torbjorn SVENSSON Nov. 7, 2024, 4:58 p.m. UTC
Changes since v1:

- Updated the error message to mention that arm_mve_types.h needs to be
  included.
- Corrected some spelling errors in commit message.

As the warning for pure functions returning void is not related to this
patch, I'll leave it for you Christophe to look into. :)

Ok for trunk and releases/gcc-14?

--

Starting with r14-435-g00d97bf3b5a, doing `#pragma arm "arm_mve.h"
false` or `#pragma arm "arm_mve.h" true` without first doing
`#pragma arm "arm_mve_types.h"` causes GCC to ICE.

gcc/ChangeLog:

      PR target/117408
      * config/arm/arm-mve-builtins.cc(handle_arm_mve_h): Detect if MVE
      types are missing and if so, return error.

gcc/testsuite/ChangeLog:

      PR target/117408
      * gcc.target/arm/mve/pr117408-1.c: New test.
      * gcc.target/arm/mve/pr117408-2.c: Likewise.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
---
 gcc/config/arm/arm-mve-builtins.cc            | 7 +++++++
 gcc/testsuite/gcc.target/arm/mve/pr117408-1.c | 7 +++++++
 gcc/testsuite/gcc.target/arm/mve/pr117408-2.c | 7 +++++++
 3 files changed, 21 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr117408-1.c
 create mode 100644 gcc/testsuite/gcc.target/arm/mve/pr117408-2.c
diff mbox series

Patch

diff --git a/gcc/config/arm/arm-mve-builtins.cc b/gcc/config/arm/arm-mve-builtins.cc
index af1908691b6..ed3d6000641 100644
--- a/gcc/config/arm/arm-mve-builtins.cc
+++ b/gcc/config/arm/arm-mve-builtins.cc
@@ -535,6 +535,13 @@  handle_arm_mve_h (bool preserve_user_namespace)
       return;
     }
 
+  if (!handle_arm_mve_types_p)
+    {
+      error ("this definition requires MVE types, please include %qs",
+	     "arm_mve_types.h");
+      return;
+    }
+
   /* Define MVE functions.  */
   function_table = new hash_table<registered_function_hasher> (1023);
   function_builder builder;
diff --git a/gcc/testsuite/gcc.target/arm/mve/pr117408-1.c b/gcc/testsuite/gcc.target/arm/mve/pr117408-1.c
new file mode 100644
index 00000000000..25eaf67e297
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/pr117408-1.c
@@ -0,0 +1,7 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+
+/* It doesn't really matter if this produces errors missing types,
+      but it mustn't trigger an ICE.  */
+#pragma GCC arm "arm_mve.h" false /* { dg-error "this definition requires MVE types, please include 'arm_mve_types.h'" } */
diff --git a/gcc/testsuite/gcc.target/arm/mve/pr117408-2.c b/gcc/testsuite/gcc.target/arm/mve/pr117408-2.c
new file mode 100644
index 00000000000..c3a0af25f77
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/pr117408-2.c
@@ -0,0 +1,7 @@ 
+/* { dg-do compile } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+
+/* It doesn't really matter if this produces errors missing types,
+      but it mustn't trigger an ICE.  */
+#pragma GCC arm "arm_mve.h" true /* { dg-error "this definition requires MVE types, please include 'arm_mve_types.h'" } */