[gomp] fix type mapping and nested function problems
Jakub Jelinek
jakub@redhat.com
Tue Nov 1 10:16:00 GMT 2005
On Mon, Oct 31, 2005 at 05:21:50PM -0800, Richard Henderson wrote:
> Hum. I'd have thought that just the gimplify.c hunk here would have
> done the job, but it turns out that some of the parameters havn't
> been gimplified. Fixing that with the function.c hunks reveals that
> the Fortran front end is using variables in the type definitions, and
> these variables aren't defined at the point the parameters are
> processed.
>
> My guess is that Fortran should avoid creating its own variables
> in type parameters, and instead rely on SAVE_EXPRs.
I'm afraid that would be extremely difficult. There can be almost
arbitrary Fortran expressions in the sizes and unfortunately the whole
trans-expr.c (and other trans-*.c it uses) is written in a way that
can generate (potentially many) temporary variables, so not something
really suitable for SAVE_EXPR. Rewriting that would be really hard.
I'll look at what exactly in the type is not gimplified and if the
Fortran FE couldn't just make sure it just forces everything into
temporary vars (then it would be gimplified soon after the vars
it is using are initialized).
> --- gimplify.c (revision 106309)
> +++ gimplify.c (working copy)
> @@ -4256,7 +4256,6 @@ omp_add_variable (struct gimplify_omp_ct
>
> /* Add all of the variable and type parameters (which should have
> been gimplified to a formal temporary) as FIRSTPRIVATE. */
> - nflags = flags & GOVD_SHARED ? 0 : GOVD_SEEN;
> omp_firstprivatize_variable (ctx, DECL_SIZE_UNIT (decl));
> omp_firstprivatize_variable (ctx, DECL_SIZE (decl));
> omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
> @@ -4274,6 +4273,20 @@ omp_add_variable (struct gimplify_omp_ct
> else
> omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
> }
> + else if (lang_hooks.decls.omp_privatize_by_reference (decl))
> + {
> + gcc_assert ((flags & GOVD_LOCAL) == 0);
> + omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
> +
> + /* Similar to the direct variable sized case above, we'll need the
> + size of references being privatized. */
> + if ((flags & GOVD_SHARED) == 0)
> + {
> + t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
> + if (!TREE_CONSTANT (t))
> + omp_notice_variable (ctx, t, true);
> + }
> + }
>
> splay_tree_insert (ctx->variables, (splay_tree_key)decl, flags);
> }
Jakub
More information about the Fortran
mailing list