re PR middle-end/36726 (ICE in move_stmt_r, at tree-cfg.c:5699 with -fopenmp)
authorJakub Jelinek <jakub@redhat.com>
Mon, 7 Jul 2008 15:26:35 +0000 (17:26 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 7 Jul 2008 15:26:35 +0000 (17:26 +0200)
PR middle-end/36726
* f95-lang.c (poplevel): Don't ever add subblocks to
global_binding_level.

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

From-SVN: r137572

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

index 7b641f077ba64a6f3bac198d2b3b8be2a32cdc03..0369a0f34836e5f274dfb6a695f95d7bc0d6e2fb 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 794cc41a2d0708626495e210bbb8ed8d2a542264..9dfb42332103bade55ce1e4063740830284014ec 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 841f216c136e9cccbb0b818d1e5bd991b75c347f..e8d7a599a0c69882aa2e2936c950f57acccbd553 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