diff mbox series

aarch64: Add missing error_mark_node check [PR99381]

Message ID 20210304140146.dvz5cq6iyul6mojg@arm.com
State New
Headers show
Series aarch64: Add missing error_mark_node check [PR99381] | expand

Commit Message

Alex Coplan March 4, 2021, 2:01 p.m. UTC
Hi!

As the PR shows, we were missing a check in
function_resolver::require_vector_type to see if the argument type was already
invalid. This was causing us to attempt to emit a diagnostic and subsequently
ICE in print_type. Fixed thusly.

Bootstrapped and regtested on aarch64-linux-gnu. OK for trunk?

Thanks,
Alex

---

gcc/ChangeLog:

	PR target/99381
	* config/aarch64/aarch64-sve-builtins.cc
	(function_resolver::require_vector_type): Handle error_mark_node.

gcc/testsuite/ChangeLog:

	* gcc.target/aarch64/pr99381.c: New test.

Comments

Richard Sandiford March 4, 2021, 2:26 p.m. UTC | #1
Alex Coplan <alex.coplan@arm.com> writes:
> Hi!
>
> As the PR shows, we were missing a check in
> function_resolver::require_vector_type to see if the argument type was already
> invalid. This was causing us to attempt to emit a diagnostic and subsequently
> ICE in print_type. Fixed thusly.
>
> Bootstrapped and regtested on aarch64-linux-gnu. OK for trunk?
>
> Thanks,
> Alex
>
> ---
>
> gcc/ChangeLog:
>
> 	PR target/99381
> 	* config/aarch64/aarch64-sve-builtins.cc
> 	(function_resolver::require_vector_type): Handle error_mark_node.
>
> gcc/testsuite/ChangeLog:
>
> 	* gcc.target/aarch64/pr99381.c: New test.

OK, thanks.  It would be good to backport to GCC 10 too if possible
(pre-approved).

Richard
diff mbox series

Patch

diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc
index 6270b51fbf4..25612d2ea52 100644
--- a/gcc/config/aarch64/aarch64-sve-builtins.cc
+++ b/gcc/config/aarch64/aarch64-sve-builtins.cc
@@ -1467,6 +1467,9 @@  function_resolver::require_vector_type (unsigned int argno,
 {
   tree expected = acle_vector_types[0][type];
   tree actual = get_argument_type (argno);
+  if (actual == error_mark_node)
+    return false;
+
   if (!matches_type_p (expected, actual))
     {
       error_at (location, "passing %qT to argument %d of %qE, which"
diff --git a/gcc/testsuite/gcc.target/aarch64/pr99381.c b/gcc/testsuite/gcc.target/aarch64/pr99381.c
new file mode 100644
index 00000000000..8b4c5b82f68
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr99381.c
@@ -0,0 +1,10 @@ 
+/* { dg-do compile } */
+/* { dg-options "-march=armv8-a" } */
+/* PR99381: we shouldn't ICE if the user forgets -march=armv8.2-a+sve. */
+
+#include <arm_sve.h>
+_Bool a;
+int main()
+{
+  a = svaddv(svptrue_b8(), svdup_s8(0)); /* { dg-error "ACLE function 'svptrue_b8' requires ISA extension 'sve'" } */
+}