Err, see comment of [1/4] ;)

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

2018-08-28  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/87117
        * tree-ssa-operands.c (add_stmt_operand): STRING_CST may
        get virtual operands.
        (get_expr_operands): Handle STRING_CST like other decls.

        * gcc.dg/lvalue-5.c: New testcase.

Index: gcc/tree-ssa-operands.c
===================================================================
--- gcc/tree-ssa-operands.c     (revision 263906)
+++ gcc/tree-ssa-operands.c     (working copy)
@@ -515,7 +515,7 @@ add_stmt_operand (struct function *fn, t
 {
   tree var = *var_p;
 
-  gcc_assert (SSA_VAR_P (*var_p));
+  gcc_assert (SSA_VAR_P (*var_p) || TREE_CODE (*var_p) == STRING_CST);
 
   if (is_gimple_reg (var))
     {
@@ -740,6 +740,7 @@ get_expr_operands (struct function *fn,
     case VAR_DECL:
     case PARM_DECL:
     case RESULT_DECL:
+    case STRING_CST:
       if (!(flags & opf_address_taken))
        add_stmt_operand (fn, expr_p, stmt, flags);
       return;
Index: gcc/testsuite/gcc.dg/lvalue-5.c
===================================================================
--- gcc/testsuite/gcc.dg/lvalue-5.c     (revision 263906)
+++ gcc/testsuite/gcc.dg/lvalue-5.c     (working copy)
@@ -1,7 +1,7 @@
 /* Test assignment to elements of a string literal is a warning, not
    an error.  PR 27676.  */
 /* { dg-do compile } */
-/* { dg-options "-pedantic-errors" } */
+/* { dg-options "-O -pedantic-errors" } */
 
 void
 f (void)

Reply via email to