From 285b1f01acaf962e7a668aed7bab4d609a19fc3b Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Thu, 29 Oct 2015 17:06:58 +0000 Subject: [PATCH] [multiple changes] 2015-10-29 Steven G. Kargl PR fortran/67885 * trans-decl.c (generate_local_decl): Mark PARAMETER entities in BLOCK construct. 2015-10-26 Steven G. Kargl PR fortran/67885 * gfortran.dg/pr67885.f90: New test. From-SVN: r229540 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-decl.c | 10 ++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr67885.f90 | 12 ++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr67885.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a58d1f14dcd..5aed4bdde88 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-10-29 Steven G. Kargl + + PR fortran/67885 + * trans-decl.c (generate_local_decl): Mark PARAMETER entities in + BLOCK construct. + 2015-10-29 Andrew MacLeod * array.c: Reorder #include's and remove duplicates. diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index ded5c1fb3d7..098a327e91a 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -5215,6 +5215,16 @@ generate_local_decl (gfc_symbol * sym) "Unused parameter %qs which has been explicitly " "imported at %L", sym->name, &sym->declared_at); } + + if (sym->ns + && sym->ns->parent + && sym->ns->parent->code + && sym->ns->parent->code->op == EXEC_BLOCK) + { + if (sym->attr.referenced) + gfc_get_symbol_decl (sym); + sym->mark = 1; + } } else if (sym->attr.flavor == FL_PROCEDURE) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 223554ac31a..ee3ac60efef 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-10-29 Steven G. Kargl + + PR fortran/67885 + * gfortran.dg/pr67885.f90: New test. + 2015-10-29 Jeff Law PR tree-optimization/67892 diff --git a/gcc/testsuite/gfortran.dg/pr67885.f90 b/gcc/testsuite/gfortran.dg/pr67885.f90 new file mode 100644 index 00000000000..9b9adce4903 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr67885.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! PR fortran/67885 +! Original code contributed by Gerhard Steinmetz +! gerhard dot steinmetz dot fortran at t-online dot de +program p + block + integer, parameter :: a(2) = [1, 2] + integer :: x(2) + x = a + if (x(1) /= 1) call abort + end block +end -- 2.30.2