From 4f028369d00f8cc3a7dc26d4401a3fa238960a54 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 20 May 2016 20:49:24 +0200 Subject: [PATCH] re PR fortran/71204 (ICE with -O0 in expand_expr_real_1, at expr.c:9651) PR fortran/71204 * frontend-passes.c (realloc_string_callback): Clear inserted_block and changed_statement before calling create_var. * gfortran.dg/pr71204.f90: New test. From-SVN: r236525 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/frontend-passes.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr71204.f90 | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr71204.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 704c1f169f2..d32c7d5100a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-05-20 Jakub Jelinek + + PR fortran/71204 + * frontend-passes.c (realloc_string_callback): Clear inserted_block + and changed_statement before calling create_var. + 2016-05-15 Harald Anlauf PR fortran/69603 diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 9d724dec0cd..37c42bb5e34 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -174,8 +174,10 @@ realloc_string_callback (gfc_code **c, int *walk_subtrees ATTRIBUTE_UNUSED, if (!gfc_check_dependency (expr1, expr2, true)) return 0; - + current_code = c; + inserted_block = NULL; + changed_statement = NULL; n = create_var (expr2, "trim"); co->expr2 = n; return 0; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 919c1241f3a..d5122e82cc1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-20 Jakub Jelinek + + PR fortran/71204 + * gfortran.dg/pr71204.f90: New test. + 2016-05-20 Cesar Philippidis * gcc.target/nvptx/sincos.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr71204.f90 b/gcc/testsuite/gfortran.dg/pr71204.f90 new file mode 100644 index 00000000000..1d1ee5c34a1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr71204.f90 @@ -0,0 +1,17 @@ +! PR fortran/71204 +! { dg-do compile } +! { dg-options "-O0" } + +module pr71204 + character(10), allocatable :: z(:) +end module + +subroutine s1 + use pr71204 + z(2) = z(1) +end + +subroutine s2 + use pr71204 + z(2) = z(1) +end -- 2.30.2