From 6496ae5c9651206c9de43f63018a549a2ef2244e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 6 Oct 2021 11:02:38 +0200 Subject: Properly parse invariant &MEM addresses in the GIMPLE FE Currently the frontend rejects those addresses as not lvalues because the C frontend doens't expect MEM_REF or TARGET_MEM_REF to appear (but they would be valid lvalues there). The following fixes that by amending lvalue_p. The change also makes the dumping of the source of the testcase valid for the GIMPLE FE by not eliding the '&' when dumping string literals. 2021-10-06 Richard Biener gcc/c/ * c-typeck.c (lvalue_p): Also allow MEM_REF and TARGET_MEM_REF. gcc/ * tree-pretty-print.c (dump_generic_node): Do not elide printing '&' when dumping with -gimple. gcc/testsuite/ * gcc.dg/gimplefe-47.c: New testcase. --- gcc/c/c-typeck.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/c') diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index f9eb0e5..0aac978 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -4968,6 +4968,10 @@ lvalue_p (const_tree ref) case STRING_CST: return true; + case MEM_REF: + case TARGET_MEM_REF: + /* MEM_REFs can appear from -fgimple parsing or folding, so allow them + here as well. */ case INDIRECT_REF: case ARRAY_REF: case VAR_DECL: -- cgit v1.1