[Bug middle-end/90694] incorrect representation of ADDR_EXPR involving a pointer to array
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri May 31 17:39:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90694
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2019-05-31
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The following patch adds the missing parentheses:
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 6645a646617..c1effcddd65 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -1676,9 +1676,14 @@ dump_generic_node (pretty_printer *pp, tree node, int
spc, dump_flags_t flags,
{
if (TREE_CODE (TREE_OPERAND (node, 0)) != ADDR_EXPR)
{
+ /* Enclose pointers to arrays in parentheses. */
+ tree op0 = TREE_OPERAND (node, 0);
+ if (POINTER_TYPE_P (TREE_TYPE (op0)))
+ pp_left_paren (pp);
pp_star (pp);
- dump_generic_node (pp, TREE_OPERAND (node, 0),
- spc, flags, false);
+ dump_generic_node (pp, op0, spc, flags, false);
+ if (POINTER_TYPE_P (TREE_TYPE (op0)))
+ pp_right_paren (pp);
}
else
dump_generic_node (pp,
More information about the Gcc-bugs
mailing list