2010-12-03 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Dec 2010 16:10:36 +0000 (16:10 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 3 Dec 2010 16:10:36 +0000 (16:10 +0000)
PR c/46745
* c-pretty-print.c (pp_c_postfix_expression): Handle MEM_REF.
(pp_c_unary_expression): Likewise.
(pp_c_expression): Likewise.

cp/
* error.c (dump_expr): Handle MEM_REF.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167433 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-family/ChangeLog
gcc/c-family/c-pretty-print.c
gcc/cp/ChangeLog
gcc/cp/error.c

index 84eef7d..2ea3960 100644 (file)
@@ -1,3 +1,10 @@
+2010-12-03  Richard Guenther  <rguenther@suse.de>
+
+       PR c/46745
+       * c-pretty-print.c (pp_c_postfix_expression): Handle MEM_REF.
+       (pp_c_unary_expression): Likewise.
+       (pp_c_expression): Likewise.
+
 2010-11-30  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * c-common.h (objc_finish_function): New.
index d72ff30..843e7a4 100644 (file)
@@ -1531,6 +1531,10 @@ pp_c_postfix_expression (c_pretty_printer *pp, tree e)
       }
       break;
 
+    case MEM_REF:
+      pp_c_expression (pp, e);
+      break;
+
     case COMPLEX_CST:
     case VECTOR_CST:
       pp_c_compound_literal (pp, e);
@@ -1661,6 +1665,32 @@ pp_c_unary_expression (c_pretty_printer *pp, tree e)
       pp_c_cast_expression (pp, TREE_OPERAND (e, 0));
       break;
 
+    case MEM_REF:
+      if (TREE_CODE (TREE_OPERAND (e, 0)) == ADDR_EXPR
+         && integer_zerop (TREE_OPERAND (e, 1)))
+       pp_c_expression (pp, TREE_OPERAND (TREE_OPERAND (e, 0), 0));
+      else
+       {
+         pp_c_star (pp);
+         if (!integer_zerop (TREE_OPERAND (e, 1)))
+           {
+             pp_c_left_paren (pp);
+             if (!integer_onep (TYPE_SIZE_UNIT
+                                (TREE_TYPE (TREE_TYPE (TREE_OPERAND (e, 0))))))
+               pp_c_type_cast (pp, ptr_type_node);
+           }
+         pp_c_cast_expression (pp, TREE_OPERAND (e, 0));
+         if (!integer_zerop (TREE_OPERAND (e, 1)))
+           {
+             pp_plus (pp);
+             pp_c_integer_constant (pp,
+                                    fold_convert (ssizetype,
+                                                  TREE_OPERAND (e, 1)));
+             pp_c_right_paren (pp);
+           }
+       }
+      break;
+
     case REALPART_EXPR:
     case IMAGPART_EXPR:
       pp_c_ws_string (pp, code == REALPART_EXPR ? "__real__" : "__imag__");
@@ -2065,6 +2095,7 @@ pp_c_expression (c_pretty_printer *pp, tree e)
     case CONJ_EXPR:
     case ADDR_EXPR:
     case INDIRECT_REF:
+    case MEM_REF:
     case NEGATE_EXPR:
     case BIT_NOT_EXPR:
     case TRUTH_NOT_EXPR:
index bfbdfc2..c24204e 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-03  Richard Guenther  <rguenther@suse.de>
+
+       PR c/46745
+       * error.c (dump_expr): Handle MEM_REF.
+
 2010-12-03  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
 
        * cp-tree.h (struct aggr_init_expr_arg_iterator_d): Remove GTY
index 2676966..8dd196e 100644 (file)
@@ -1928,6 +1928,34 @@ dump_expr (tree t, int flags)
        }
       break;
 
+    case MEM_REF:
+      if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
+         && integer_zerop (TREE_OPERAND (t, 1)))
+       dump_expr (TREE_OPERAND (TREE_OPERAND (t, 0), 0), flags);
+      else
+       {
+         pp_cxx_star (cxx_pp);
+         if (!integer_zerop (TREE_OPERAND (t, 1)))
+           {
+             pp_cxx_left_paren (cxx_pp);
+             if (!integer_onep (TYPE_SIZE_UNIT
+                                (TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0))))))
+               {
+                 pp_cxx_left_paren (cxx_pp);
+                 dump_type (ptr_type_node, flags);
+                 pp_cxx_right_paren (cxx_pp);
+               }
+           }
+         dump_expr (TREE_OPERAND (t, 0), flags);
+         if (!integer_zerop (TREE_OPERAND (t, 1)))
+           {
+             pp_cxx_ws_string (cxx_pp, "+");
+             dump_expr (fold_convert (ssizetype, TREE_OPERAND (t, 1)), flags);
+             pp_cxx_right_paren (cxx_pp);
+           }
+       }
+      break;
+
     case NEGATE_EXPR:
     case BIT_NOT_EXPR:
     case TRUTH_NOT_EXPR: