This fixes PR51010 by handling SSA names in the C/C++ pretty printers.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu, ok if that
succeeds?

Thanks,
Richard.

2011-11-08  Richard Guenther  <rguent...@suse.de>

        PR middle-end/51010
        c-family/
        * c-pretty-print.c (pp_c_expression): Handle SSA_NAMEs.

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

        * c-c++-common/uninit-pr51010.c: New testcase.

Index: gcc/c-family/c-pretty-print.c
===================================================================
*** gcc/c-family/c-pretty-print.c       (revision 181154)
--- gcc/c-family/c-pretty-print.c       (working copy)
*************** pp_c_expression (c_pretty_printer *pp, t
*** 2129,2134 ****
--- 2129,2141 ----
        pp_primary_expression (pp, e);
        break;
  
+     case SSA_NAME:
+       if (!DECL_ARTIFICIAL (SSA_NAME_VAR (e)))
+       pp_c_expression (pp, SSA_NAME_VAR (e));
+       else
+       pp_c_ws_string (pp, M_("<unknown>"));
+       break;
+ 
      case POSTINCREMENT_EXPR:
      case POSTDECREMENT_EXPR:
      case ARRAY_REF:
Index: gcc/cp/error.c
===================================================================
*** gcc/cp/error.c      (revision 181154)
--- gcc/cp/error.c      (working copy)
*************** dump_expr (tree t, int flags)
*** 1792,1797 ****
--- 1792,1804 ----
                     | TFF_NO_FUNCTION_ARGUMENTS));
        break;
  
+     case SSA_NAME:
+       if (!DECL_ARTIFICIAL (SSA_NAME_VAR (t)))
+       dump_expr (SSA_NAME_VAR (t), flags);
+       else
+       pp_cxx_ws_string (cxx_pp, M_("<unknown>"));
+       break;
+ 
      case INTEGER_CST:
      case REAL_CST:
      case STRING_CST:
Index: gcc/testsuite/c-c++-common/uninit-pr51010.c
===================================================================
*** gcc/testsuite/c-c++-common/uninit-pr51010.c (revision 0)
--- gcc/testsuite/c-c++-common/uninit-pr51010.c (revision 0)
***************
*** 0 ****
--- 1,13 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O -Wuninitialized" } */
+ 
+ int f (int j)
+ {
+   int a [10];
+   return a [j]; /* { dg-warning "a\\\[j\\\]. is used uninitialized" } */
+ }
+ int g (int j)
+ {
+   int a [10];
+   return a [j+1]; /* { dg-warning "a\\\[<unknown>\\\]. is used uninitialized" 
} */
+ }

Reply via email to