[multiple changes]
authorSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 29 Oct 2015 17:06:58 +0000 (17:06 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Thu, 29 Oct 2015 17:06:58 +0000 (17:06 +0000)
2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/67885
* trans-decl.c (generate_local_decl): Mark PARAMETER entities in
BLOCK construct.

2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/67885
* gfortran.dg/pr67885.f90: New test.

From-SVN: r229540

gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr67885.f90 [new file with mode: 0644]

index a58d1f14dcd29882beaec3da4d9375abd03de9d4..5aed4bdde881aca20926c42f892d602d0d6ae54d 100644 (file)
@@ -1,3 +1,9 @@
+2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/67885
+       * trans-decl.c (generate_local_decl): Mark PARAMETER entities in
+       BLOCK construct.
+
 2015-10-29  Andrew MacLeod  <amacleod@redhat.com>
 
        * array.c: Reorder #include's and remove duplicates.
index ded5c1fb3d7803b21aea89a4d20b2c5c9d94c497..098a327e91a2ed9f879a1a50a775e6a61072f059 100644 (file)
@@ -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)
     {
index 223554ac31ad2080abf8857577a7abdd78f7412e..ee3ac60efef997d62f07d3fa79c09fb1cc472bcd 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/67885
+       * gfortran.dg/pr67885.f90: New test.
+
 2015-10-29  Jeff Law  <law@redhat.com>
 
         PR tree-optimization/67892
diff --git a/gcc/testsuite/gfortran.dg/pr67885.f90 b/gcc/testsuite/gfortran.dg/pr67885.f90
new file mode 100644 (file)
index 0000000..9b9adce
--- /dev/null
@@ -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