diff options
author | Richard Biener <rguenther@suse.de> | 2021-10-06 11:02:38 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-10-07 08:19:39 +0200 |
commit | 6496ae5c9651206c9de43f63018a549a2ef2244e (patch) | |
tree | 40def05c8bbc1491a6f61ce807a2c20d3a417dc6 /gcc/tree-pretty-print.c | |
parent | 57c7ec62ee0fbc33cacc5feb3e26d3ad4f765cdb (diff) | |
download | gcc-6496ae5c9651206c9de43f63018a549a2ef2244e.zip gcc-6496ae5c9651206c9de43f63018a549a2ef2244e.tar.gz gcc-6496ae5c9651206c9de43f63018a549a2ef2244e.tar.bz2 |
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 <rguenther@suse.de>
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.
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r-- | gcc/tree-pretty-print.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 30a3945..275dc7d 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -2888,10 +2888,13 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags, case PREDECREMENT_EXPR: case PREINCREMENT_EXPR: case INDIRECT_REF: - if (TREE_CODE (node) == ADDR_EXPR + if (!(flags & TDF_GIMPLE) + && TREE_CODE (node) == ADDR_EXPR && (TREE_CODE (TREE_OPERAND (node, 0)) == STRING_CST || TREE_CODE (TREE_OPERAND (node, 0)) == FUNCTION_DECL)) - ; /* Do not output '&' for strings and function pointers. */ + /* Do not output '&' for strings and function pointers when not + dumping GIMPLE FE syntax. */ + ; else pp_string (pp, op_symbol (node)); |