public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7223] c/104505 - ICE with internal function call in diagnostic expression
@ 2022-02-14 10:26 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-02-14 10:26 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:f7e26913187ce0ed35e340c4fd14104bbcd1932e

commit r12-7223-gf7e26913187ce0ed35e340c4fd14104bbcd1932e
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Feb 14 09:29:20 2022 +0100

    c/104505 - ICE with internal function call in diagnostic expression
    
    The following handles internal function calls similar to how the
    C++ frontend does, avoiding ICEing on those.
    
    2022-02-14  Richard Biener  <rguenther@suse.de>
    
            PR c/104505
    gcc/c-family/
            * c-pretty-print.cc (c_pretty_printer::postfix_expression): Handle
            internal function calls.
    
    gcc/testsuite/
            * c-c++-common/pr104505.c: New testcase.

Diff:
---
 gcc/c-family/c-pretty-print.cc        |  6 +++++-
 gcc/testsuite/c-c++-common/pr104505.c | 12 ++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/gcc/c-family/c-pretty-print.cc b/gcc/c-family/c-pretty-print.cc
index ceedaea962a..dac17753acb 100644
--- a/gcc/c-family/c-pretty-print.cc
+++ b/gcc/c-family/c-pretty-print.cc
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "selftest.h"
 #include "langhooks.h"
 #include "options.h"
+#include "internal-fn.h"
 
 /* The pretty-printer code is primarily designed to closely follow
    (GNU) C and C++ grammars.  That is to be contrasted with spaghetti
@@ -1601,7 +1602,10 @@ c_pretty_printer::postfix_expression (tree e)
       {
 	call_expr_arg_iterator iter;
 	tree arg;
-	postfix_expression (CALL_EXPR_FN (e));
+	if (CALL_EXPR_FN (e) != NULL_TREE)
+	  postfix_expression (CALL_EXPR_FN (e));
+	else
+	  pp_string (this, internal_fn_name (CALL_EXPR_IFN (e)));
 	pp_c_left_paren (this);
 	FOR_EACH_CALL_EXPR_ARG (arg, iter, e)
 	  {
diff --git a/gcc/testsuite/c-c++-common/pr104505.c b/gcc/testsuite/c-c++-common/pr104505.c
new file mode 100644
index 00000000000..7fa3d841197
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr104505.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+typedef char __attribute__((__vector_size__ (8))) U;
+typedef short __attribute__((__vector_size__ (16))) V;
+
+U u;
+
+void
+foo (V v)
+{
+  u = __builtin_shufflevector (u, u, __builtin_convertvector (v, U)); /* { dg-error "invalid element index" } */
+}


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

only message in thread, other threads:[~2022-02-14 10:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 10:26 [gcc r12-7223] c/104505 - ICE with internal function call in diagnostic expression Richard Biener

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