This follows last years change of allowing virtual operands for STRING_CSTs. Here we run into stores into CONST_DECLs. For IL hygiene these are regular memory references (that they trigger undefined behavior at runtime is another issue).
Bootstrap & regtest running on x86_64-unknown-linux-gnu. Richard. 2019-03-01 Richard Biener <rguent...@suse.de> PR middle-end/89541 * tree-ssa-operands.c (add_stmt_operand): CONST_DECL may get virtual operands. (get_expr_operands): Handle CONST_DECL like other decls. * gfortran.dg/pr89451.f90: New testcase. Index: gcc/tree-ssa-operands.c =================================================================== --- gcc/tree-ssa-operands.c (revision 269301) +++ gcc/tree-ssa-operands.c (working copy) @@ -515,7 +515,9 @@ add_stmt_operand (struct function *fn, t { tree var = *var_p; - gcc_assert (SSA_VAR_P (*var_p) || TREE_CODE (*var_p) == STRING_CST); + gcc_assert (SSA_VAR_P (*var_p) + || TREE_CODE (*var_p) == STRING_CST + || TREE_CODE (*var_p) == CONST_DECL); if (is_gimple_reg (var)) { @@ -741,6 +743,7 @@ get_expr_operands (struct function *fn, case PARM_DECL: case RESULT_DECL: case STRING_CST: + case CONST_DECL: if (!(flags & opf_address_taken)) add_stmt_operand (fn, expr_p, stmt, flags); return; @@ -859,7 +862,6 @@ get_expr_operands (struct function *fn, case FUNCTION_DECL: case LABEL_DECL: - case CONST_DECL: case CASE_LABEL_EXPR: /* Expressions that make no memory references. */ return; Index: gcc/testsuite/gfortran.dg/pr89451.f90 =================================================================== --- gcc/testsuite/gfortran.dg/pr89451.f90 (nonexistent) +++ gcc/testsuite/gfortran.dg/pr89451.f90 (working copy) @@ -0,0 +1,11 @@ +! { dg-do compile } +! { dg-options "-O2" } +program lh + call za(0) + call za(0) +contains + subroutine za(wl) + integer wl + wl = 1 + end subroutine za +end program lh