re PR fortran/29629 (ICE on OpenMP-enabled program (gfc_conv_variable, at fortran...
authorJakub Jelinek <jakub@redhat.com>
Sun, 29 Oct 2006 10:27:39 +0000 (11:27 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 29 Oct 2006 10:27:39 +0000 (11:27 +0100)
PR fortran/29629
* trans-openmp.c (gfc_trans_omp_array_reduction): Set attr.flavor
of init_val_sym and outer_sym to FL_VARIABLE.

* testsuite/libgomp.fortran/pr29629.f90: New test.

From-SVN: r118134

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/pr29629.f90 [new file with mode: 0644]

index 6c24c4751305156c6d591b2b92ef8603629b2890..31c6c6f471363d16b3f586a47d8c9bf46df10d18 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/29629
+       * trans-openmp.c (gfc_trans_omp_array_reduction): Set attr.flavor
+       of init_val_sym and outer_sym to FL_VARIABLE.
+
 2006-10-29  Kazu Hirata  <kazu@codesourcery.com>
 
        * intrinsic.texi: Fix a typo.
index 32020cc433a6197773b73b95036d561d0fa5d153..fa8be1d72ecfd2ab09d66e51aaa6d9f56f8c922a 100644 (file)
@@ -300,6 +300,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
   init_val_sym.ts = sym->ts;
   init_val_sym.attr.referenced = 1;
   init_val_sym.declared_at = where;
+  init_val_sym.attr.flavor = FL_VARIABLE;
   backend_decl = omp_reduction_init (c, gfc_sym_type (&init_val_sym));
   init_val_sym.backend_decl = backend_decl;
 
@@ -308,6 +309,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where)
   outer_sym.as = gfc_copy_array_spec (sym->as);
   outer_sym.attr.dummy = 0;
   outer_sym.attr.result = 0;
+  outer_sym.attr.flavor = FL_VARIABLE;
   outer_sym.backend_decl = create_tmp_var_raw (TREE_TYPE (decl), NULL);
 
   /* Create fake symtrees for it.  */
index d5788240f801cb9d57ee5632612570889f5d006f..139b7fc5c1bbaf559a37bef1d34f0498058090d0 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/29629
+       * testsuite/libgomp.fortran/pr29629.f90: New test.
+
 2006-10-24  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        PR libgomp/29494
diff --git a/libgomp/testsuite/libgomp.fortran/pr29629.f90 b/libgomp/testsuite/libgomp.fortran/pr29629.f90
new file mode 100644 (file)
index 0000000..9ccddff
--- /dev/null
@@ -0,0 +1,20 @@
+! PR fortran/29629
+! { dg-do run }
+
+program pr29629
+  integer :: n
+  n = 10000
+  if (any (func(n).ne.10000)) call abort
+  contains
+    function func(n)
+      integer, intent(in) :: n
+      integer, dimension(n) :: func
+      integer :: k
+      func = 0
+!$omp parallel do private(k), reduction(+:func), num_threads(4)
+      do k = 1, n
+        func = func + 1
+      end do
+!$omp end parallel do
+    end function
+end program