[Bug fortran/59488] [OpenMP] named constant in parallel construct leads to "not specified in enclosing parallel" error.

burnus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 12 19:58:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59488

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |openmp
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |jakub at gcc dot gnu.org
            Summary|l[OpenMP] named constant in |[OpenMP] named constant in
                   |parallel construct lead to  |parallel construct leads to
                   |"not specified in enclosing |"not specified in enclosing
                   |parallel" error.            |parallel" error.

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
>From the original report: "works fine with OpenMP Intel, Sun, Absoft, and
PathScale".


Remark:Internally,
   integer, parameter :: nlcdtypes(nnlcd) = (/ 11, 12 /)
has a dual nature: It is known to the compiler (at least the FE) as compile
time constant and, thus, can be compile-time folded [esp. when used as scalar].
On the other hand, it is generated as static variable (marked as
TREE_READONLY). [In case of module parameters the static variable is only in
the translation unit of the module].


Maybe something like the following could be the right approach?

diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 1ca847a..286f1e8 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -5632,4 +5632,8 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree
decl, bool in_code)
     goto do_outer;

+      /* Array-valued Fortran named constant can reach here.  */
+      if (TREE_READONLY (lang_hooks.decls.omp_report_decl (decl)))
+    goto do_outer;
+
       /* ??? Some compiler-generated variables (like SAVE_EXPRs) could be
      remapped firstprivate instead of shared.  To some extent this is



More information about the Gcc-bugs mailing list