diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2014-05-12 16:17:09 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2014-05-12 16:17:09 +0000 |
commit | e3f9e7576252e829396af6bee854f1e5a6305da9 (patch) | |
tree | 701f44e1967d692188338d5ad05a0d538280050d /gcc/fortran/frontend-passes.c | |
parent | bc51de9cf8fa724cb2acb81ea6d6504ac2ebbd8d (diff) | |
download | gcc-e3f9e7576252e829396af6bee854f1e5a6305da9.tar.gz |
re PR fortran/60834 ([OOP] ICE with ASSOCIATE construct (gimplify_var_or_parm_decl, at gimplify.c:1721))
2014-05-12 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60834
* frontend-passes.c (in_assoc_list): New variable.
(optimize_namespace): Initialize in_assoc_list
(combine_array_constructor): Don't try to combine
assoc lists.
(gfc_code_walker): Keep track of in_assoc_list.
2014-05-12 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/60834
* gfortran.dg/associate_16.f90: New test.
From-SVN: r210329
Diffstat (limited to 'gcc/fortran/frontend-passes.c')
-rw-r--r-- | gcc/fortran/frontend-passes.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 8bac7bf3516..564231690c8 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -88,6 +88,10 @@ static int doloop_size, doloop_level; struct my_struct *evec; +/* Keep track of association lists. */ + +static bool in_assoc_list; + /* Entry point - run all passes for a namespace. */ void @@ -820,6 +824,7 @@ optimize_namespace (gfc_namespace *ns) current_ns = ns; forall_level = 0; iterator_level = 0; + in_assoc_list = false; in_omp_workshare = false; gfc_code_walker (&ns->code, convert_do_while, dummy_expr_callback, NULL); @@ -1054,6 +1059,11 @@ combine_array_constructor (gfc_expr *e) if (e->rank != 1) return false; + /* Don't try to combine association lists, this makes no sense + and leads to an ICE. */ + if (in_assoc_list) + return false; + op1 = e->value.op.op1; op2 = e->value.op.op2; @@ -1940,8 +1950,17 @@ gfc_code_walker (gfc_code **c, walk_code_fn_t codefn, walk_expr_fn_t exprfn, case EXEC_BLOCK: WALK_SUBCODE (co->ext.block.ns->code); - for (alist = co->ext.block.assoc; alist; alist = alist->next) - WALK_SUBEXPR (alist->target); + if (co->ext.block.assoc) + { + bool saved_in_assoc_list = in_assoc_list; + + in_assoc_list = true; + for (alist = co->ext.block.assoc; alist; alist = alist->next) + WALK_SUBEXPR (alist->target); + + in_assoc_list = saved_in_assoc_list; + } + break; case EXEC_DO: |