OSDN Git Service

PR middle-end/36726
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jul 2008 15:26:35 +0000 (15:26 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 7 Jul 2008 15:26:35 +0000 (15:26 +0000)
* f95-lang.c (poplevel): Don't ever add subblocks to
global_binding_level.

* gfortran.dg/gomp/pr36726.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137572 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr36726.f90 [new file with mode: 0644]

index 7b641f0..0369a0f 100644 (file)
@@ -1,3 +1,9 @@
+2008-07-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/36726
+       * f95-lang.c (poplevel): Don't ever add subblocks to
+       global_binding_level.
+
 2008-07-02  Janus Weil  <janus@gcc.gnu.org>
            Tobias Burnus  <burnus@net-b.de>
            Paul Thomas  <pault@gcc.gnu.org>
index 794cc41..9dfb423 100644 (file)
@@ -435,6 +435,10 @@ poplevel (int keep, int reverse, int functionbody)
       DECL_INITIAL (current_function_decl) = block_node;
       BLOCK_VARS (block_node) = 0;
     }
+  else if (current_binding_level == global_binding_level)
+    /* When using gfc_start_block/gfc_finish_block from middle-end hooks,
+       don't add newly created BLOCKs as sublocks of global_binding_level.  */
+    ;
   else if (block_node)
     {
       current_binding_level->blocks
index 841f216..e8d7a59 100644 (file)
@@ -1,3 +1,8 @@
+2008-07-07  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/36726
+       * gfortran.dg/gomp/pr36726.f90: New test.
+
 2008-07-06  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * gcc.target/mips/gcc-have-sync-compare-and-swap-1.c: Expect the
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr36726.f90 b/gcc/testsuite/gfortran.dg/gomp/pr36726.f90
new file mode 100644 (file)
index 0000000..99e170a
--- /dev/null
@@ -0,0 +1,20 @@
+! PR middle-end/36726
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+
+subroutine foo
+  integer, allocatable :: vs(:)
+  !$omp parallel private (vs)
+  allocate (vs(10))
+  vs = 2
+  deallocate (vs)
+  !$omp end parallel
+end subroutine foo
+subroutine bar
+  integer, allocatable :: vs(:)
+  !$omp parallel private (vs)
+  allocate (vs(10))
+  vs = 2
+  deallocate (vs)
+  !$omp end parallel
+end subroutine bar