public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Committed] IBM Z: Fix ICE with overloading and checking enabled
@ 2023-11-14 10:51 Andreas Krebbel
  0 siblings, 0 replies; only message in thread
From: Andreas Krebbel @ 2023-11-14 10:51 UTC (permalink / raw)
  To: gcc-patches

s390_resolve_overloaded_builtin, when called on NON_DEPENDENT_EXPR,
ICEs when using the type from it which ends up as error_mark_node.

This particular instance of the problem does not occur anymore since
NON_DEPENDENT_EXPR has been removed.  Nevertheless that case needs to
be handled here.

Bootstrapped and regression tested on IBM Z.

Committed to mainline.

gcc/ChangeLog:

	* config/s390/s390-c.cc (s390_fn_types_compatible): Add a check
	for error_mark_node.

gcc/testsuite/ChangeLog:

	* g++.target/s390/zvec-templ-1.C: New test.
---
 gcc/config/s390/s390-c.cc                    |  3 +++
 gcc/testsuite/g++.target/s390/zvec-templ-1.C | 24 ++++++++++++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 gcc/testsuite/g++.target/s390/zvec-templ-1.C

diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 269f4f8e978..fce569342f3 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -781,6 +781,9 @@ s390_fn_types_compatible (enum s390_builtin_ov_type_index typeindex,
       tree in_arg = (*arglist)[i];
       tree in_type = TREE_TYPE (in_arg);
 
+      if (in_type == error_mark_node)
+	goto mismatch;
+
       if (VECTOR_TYPE_P (b_arg_type))
 	{
 	  /* Vector types have to match precisely.  */
diff --git a/gcc/testsuite/g++.target/s390/zvec-templ-1.C b/gcc/testsuite/g++.target/s390/zvec-templ-1.C
new file mode 100644
index 00000000000..07bb65f199b
--- /dev/null
+++ b/gcc/testsuite/g++.target/s390/zvec-templ-1.C
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-O0 -mzvector -march=arch14 -mzarch" }
+// { dg-bogus "internal compiler error" "ICE" { target s390*-*-* } 23 }
+// { dg-excess-errors "" }
+
+/* This used to ICE with checking enabled because
+   s390_resolve_overloaded_builtin gets called on NON_DEPENDENT_EXPR
+   arguments. We then try to determine the type of it, get an error
+   node and ICEd consequently when using this.
+
+   This particular instance of the problem disappeared when
+   NON_DEPENDENT_EXPRs got removed with:
+
+   commit dad311874ac3b3cf4eca1c04f67cae80c953f7b8
+   Author: Patrick Palka <ppalka@redhat.com>
+   Date:   Fri Oct 20 10:45:00 2023 -0400
+
+    c++: remove NON_DEPENDENT_EXPR, part 1
+
+   Nevertheless we should check for error mark nodes in that code.  */
+
+template <typename> void foo() {
+  __builtin_s390_vec_perm( , , );
+}
-- 
2.41.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-11-14 10:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-14 10:51 [Committed] IBM Z: Fix ICE with overloading and checking enabled Andreas Krebbel

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