public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Pretty-print IFN_REPLACE_ADDRESS_VALUE
@ 2022-05-06 14:45 Matthew Malcomson
  0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2022-05-06 14:45 UTC (permalink / raw)
  To: gcc-cvs

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

commit cd602fea43877dbe5a68f79f457174f818f4c447
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Wed Apr 27 20:11:40 2022 +0100

    Pretty-print IFN_REPLACE_ADDRESS_VALUE
    
    This patch tries to pretty-print IFN_REPLACE_ADDRESS_VALUE
    calls as casts, which is what they represent from the user's
    point of view.  Previously we would crash when trying to print
    the (null) CALL_EXPR_FN.

Diff:
---
 gcc/c-family/c-pretty-print.c                          | 6 ++++++
 gcc/testsuite/gcc.target/aarch64/morello/cond-expr-1.c | 8 ++++++++
 2 files changed, 14 insertions(+)

diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index 8fc96a486bd..c225e1e3be7 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -1512,6 +1512,12 @@ c_pretty_printer::postfix_expression (tree e)
 
     case CALL_EXPR:
       {
+	if (CALL_EXPR_IFN (e) == IFN_REPLACE_ADDRESS_VALUE)
+	  {
+	    pp_c_type_cast (this, TREE_TYPE (e));
+	    pp_c_cast_expression (this, CALL_EXPR_ARG (e, 1));
+	    break;
+	  }
 	call_expr_arg_iterator iter;
 	tree arg;
 	postfix_expression (CALL_EXPR_FN (e));
diff --git a/gcc/testsuite/gcc.target/aarch64/morello/cond-expr-1.c b/gcc/testsuite/gcc.target/aarch64/morello/cond-expr-1.c
new file mode 100644
index 00000000000..c4ba9cefbdc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/morello/cond-expr-1.c
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fno-diagnostics-show-caret" } */
+
+void foo4(char *__capability p, char *q)
+{
+  (p < q ? p : q)();		/* { dg-error "is not a function" } */
+  (p > q ? p : q)();		/* { dg-error "is not a function" } */
+}


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

only message in thread, other threads:[~2022-05-06 14:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-06 14:45 [gcc(refs/vendors/ARM/heads/morello)] Pretty-print IFN_REPLACE_ADDRESS_VALUE Matthew Malcomson

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