diff mbox

Fortran OpenMP UDR fixes, nested handling fixes etc.

Message ID 20140623103953.GR31640@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek June 23, 2014, 10:39 a.m. UTC
On Sat, Jun 21, 2014 at 10:28:41AM +0200, Tobias Burnus wrote:
> Jakub Jelinek wrote:
> >Bootstrap/regtest pending, does this look ok?
> 
> Except for the module/resolved issues discussed elsewhere, it look good to
> me.

So, either we need something like the following patch (incremental), or
another possibility for the problem is not do the value.function.name
related change in module.c in the UDR patch, and instead fix up the UDR
combiner/initializer expressions when they are loaded from module
(change "" name to NULL only in the UDR combiner/initializer expressions,
where they shouldn't be resolved yet).  Or make sure value.function.name
is set to non-NULL when resolving all intrinsic function calls, rather than
just for a subset of them.

With this patch it seems to pass bootstrap/regtest.

2014-06-21  Jakub Jelinek  <jakub@redhat.com>

	* resolve.c (resolve_function): If value.function.isym is non-NULL,
	consider it already resolved.
	* module.c (fix_mio_expr): Likewise.
	* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Don't
	initialize value.function.isym.


	Jakub

Comments

Tobias Burnus June 24, 2014, 6:08 a.m. UTC | #1
Jakub Jelinek wrote:
> So, either we need something like the following patch (incremental), or
> another possibility for the problem is not do the value.function.name
> related change in module.c in the UDR patch, and instead fix up the UDR
> combiner/initializer expressions when they are loaded from module
> (change "" name to NULL only in the UDR combiner/initializer expressions,
> where they shouldn't be resolved yet).  Or make sure value.function.name
> is set to non-NULL when resolving all intrinsic function calls, rather than
> just for a subset of them.
>
> With this patch it seems to pass bootstrap/regtest.

I think your patch looks sufficiently sleek that I would go for it.

Tobias


> 2014-06-21  Jakub Jelinek  <jakub@redhat.com>
>
> 	* resolve.c (resolve_function): If value.function.isym is non-NULL,
> 	consider it already resolved.
> 	* module.c (fix_mio_expr): Likewise.
> 	* trans-openmp.c (gfc_trans_omp_array_reduction_or_udr): Don't
> 	initialize value.function.isym.
>
> --- gcc/fortran/resolve.c.jj	2014-06-20 23:31:49.000000000 +0200
> +++ gcc/fortran/resolve.c	2014-06-21 20:07:39.708099045 +0200
> @@ -2887,7 +2887,8 @@ resolve_function (gfc_expr *expr)
>   
>     /* See if function is already resolved.  */
>   
> -  if (expr->value.function.name != NULL)
> +  if (expr->value.function.name != NULL
> +      || expr->value.function.isym != NULL)
>       {
>         if (expr->ts.type == BT_UNKNOWN)
>   	expr->ts = sym->ts;
> --- gcc/fortran/module.c.jj	2014-06-20 23:31:49.000000000 +0200
> +++ gcc/fortran/module.c	2014-06-23 08:53:50.488662314 +0200
> @@ -3173,7 +3173,8 @@ fix_mio_expr (gfc_expr *e)
>   	  && !e->symtree->n.sym->attr.dummy)
>   	e->symtree = ns_st;
>       }
> -  else if (e->expr_type == EXPR_FUNCTION && e->value.function.name)
> +  else if (e->expr_type == EXPR_FUNCTION
> +	   && (e->value.function.name || e->value.function.isym))
>       {
>         gfc_symbol *sym;
>   
> --- gcc/fortran/trans-openmp.c.jj	2014-06-20 23:31:49.000000000 +0200
> +++ gcc/fortran/trans-openmp.c	2014-06-23 11:53:02.932495166 +0200
> @@ -1417,7 +1417,6 @@ gfc_trans_omp_array_reduction_or_udr (tr
>         e4->expr_type = EXPR_FUNCTION;
>         e4->where = where;
>         e4->symtree = symtree4;
> -      e4->value.function.isym = gfc_find_function (iname);
>         e4->value.function.actual = gfc_get_actual_arglist ();
>         e4->value.function.actual->expr = e3;
>         e4->value.function.actual->next = gfc_get_actual_arglist ();
diff mbox

Patch

--- gcc/fortran/resolve.c.jj	2014-06-20 23:31:49.000000000 +0200
+++ gcc/fortran/resolve.c	2014-06-21 20:07:39.708099045 +0200
@@ -2887,7 +2887,8 @@  resolve_function (gfc_expr *expr)
 
   /* See if function is already resolved.  */
 
-  if (expr->value.function.name != NULL)
+  if (expr->value.function.name != NULL
+      || expr->value.function.isym != NULL)
     {
       if (expr->ts.type == BT_UNKNOWN)
 	expr->ts = sym->ts;
--- gcc/fortran/module.c.jj	2014-06-20 23:31:49.000000000 +0200
+++ gcc/fortran/module.c	2014-06-23 08:53:50.488662314 +0200
@@ -3173,7 +3173,8 @@  fix_mio_expr (gfc_expr *e)
 	  && !e->symtree->n.sym->attr.dummy)
 	e->symtree = ns_st;
     }
-  else if (e->expr_type == EXPR_FUNCTION && e->value.function.name)
+  else if (e->expr_type == EXPR_FUNCTION
+	   && (e->value.function.name || e->value.function.isym))
     {
       gfc_symbol *sym;
 
--- gcc/fortran/trans-openmp.c.jj	2014-06-20 23:31:49.000000000 +0200
+++ gcc/fortran/trans-openmp.c	2014-06-23 11:53:02.932495166 +0200
@@ -1417,7 +1417,6 @@  gfc_trans_omp_array_reduction_or_udr (tr
       e4->expr_type = EXPR_FUNCTION;
       e4->where = where;
       e4->symtree = symtree4;
-      e4->value.function.isym = gfc_find_function (iname);
       e4->value.function.actual = gfc_get_actual_arglist ();
       e4->value.function.actual->expr = e3;
       e4->value.function.actual->next = gfc_get_actual_arglist ();