diff mbox series

[fortran] Handle missing optional MASK for intrinsics

Message ID e8bf3a6b-bd38-bc1d-df2f-8da2127c36f3@netcologne.de
State New
Headers show
Series [fortran] Handle missing optional MASK for intrinsics | expand

Commit Message

Thomas Koenig Dec. 30, 2018, 5:10 p.m. UTC
Hello world,

here is my New Year's Eve Eve patch. It handles passing absent optional
argument to intrinsics.

The library side is pretty straightforward: If the argument is absent,
pass a NULL pointer to the library routines and let them do the
right thing.

With the inlined versions, I had some more trouble.  Putting in
IF (.NOT. PRESENT(MASK)) into the condition was straightforward
engough (and should be moved outside the loops by optimization).

What caused me some problems was that, in the scalarizer, the bounds
for the generated loops were taken from the MASK argument,
which, in the case of an absent MASK, were of course uninitialized.

For the one-dimensional cases, I got around that by switching the
way these arguments are handed off to the scalarizer (see patch).

For the case of a multi-dimensional cases, I tried some open-heart
surgery on the scalarizer data structures, but all I got in return
were ICEs. So, I decided to pass this on to the library routines,
with a FIXME in the code.

So, OK for trunk?

Regards

	Thomas

2018-12-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/82995
         * trans-expr.c (gfc_conv_procedure_call):  Pass NULL pointer
         for missing optional dummy arguments for library routines.
         * trans-intinsic.c (gfc_conv_intrinsic_arith): Detect and handle
         optional mask.
         (gfc_conv_intrinsic_minmaxloc): Likewise.
         (gfc_conv_intrinsic_findloc): Likewise.
         (gfc_conv_intrinsic_minmaxval): Likewise.
         (gfc_inline_intrinsic_function_p): Do not inline for rank > 1 if
         an optional mask is present.

2018-12-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/82995
         * m4/ifindloc0.m4: Handle case of absend optional argument, passed
         as a NULL pointer.
         * m4/ifindloc1.m4: Likewise.
         * m4/ifindloc2.m4: Likewise.
         * m4/iforeach-s.m4: Likewise.
         * m4/iforeach-s2.m4: Likewise.
         * m4/iforeach.m4: Likewise.
         * m4/ifunction-s.m4: Likewise.
         * m4/ifunction-s2.m4: Likewise.
         * m4/ifunction.m4: Likewise.
         * generated/findloc0_c16.c: Regenerated.
         * generated/findloc0_c4.c: Regenerated.
         * generated/findloc0_c8.c: Regenerated.
         * generated/findloc0_i1.c: Regenerated.
         * generated/findloc0_i16.c: Regenerated.
         * generated/findloc0_i2.c: Regenerated.
         * generated/findloc0_i4.c: Regenerated.
         * generated/findloc0_i8.c: Regenerated.
         * generated/findloc0_r16.c: Regenerated.
         * generated/findloc0_r4.c: Regenerated.
         * generated/findloc0_r8.c: Regenerated.
         * generated/findloc0_s1.c: Regenerated.
         * generated/findloc0_s4.c: Regenerated.
         * generated/findloc1_c16.c: Regenerated.
         * generated/findloc1_c4.c: Regenerated.
         * generated/findloc1_c8.c: Regenerated.
         * generated/findloc1_i1.c: Regenerated.
         * generated/findloc1_i16.c: Regenerated.
         * generated/findloc1_i2.c: Regenerated.
         * generated/findloc1_i4.c: Regenerated.
         * generated/findloc1_i8.c: Regenerated.
         * generated/findloc1_r16.c: Regenerated.
         * generated/findloc1_r4.c: Regenerated.
         * generated/findloc1_r8.c: Regenerated.
         * generated/findloc1_s1.c: Regenerated.
         * generated/findloc1_s4.c: Regenerated.
         * generated/findloc2_s1.c: Regenerated.
         * generated/findloc2_s4.c: Regenerated.
         * generated/iall_i1.c: Regenerated.
         * generated/iall_i16.c: Regenerated.
         * generated/iall_i2.c: Regenerated.
         * generated/iall_i4.c: Regenerated.
         * generated/iall_i8.c: Regenerated.
         * generated/iany_i1.c: Regenerated.
         * generated/iany_i16.c: Regenerated.
         * generated/iany_i2.c: Regenerated.
         * generated/iany_i4.c: Regenerated.
         * generated/iany_i8.c: Regenerated.
         * generated/iparity_i1.c: Regenerated.
         * generated/iparity_i16.c: Regenerated.
         * generated/iparity_i2.c: Regenerated.
         * generated/iparity_i4.c: Regenerated.
         * generated/iparity_i8.c: Regenerated.
         * generated/maxloc0_16_i1.c: Regenerated.
         * generated/maxloc0_16_i16.c: Regenerated.
         * generated/maxloc0_16_i2.c: Regenerated.
         * generated/maxloc0_16_i4.c: Regenerated.
         * generated/maxloc0_16_i8.c: Regenerated.
         * generated/maxloc0_16_r10.c: Regenerated.
         * generated/maxloc0_16_r16.c: Regenerated.
         * generated/maxloc0_16_r4.c: Regenerated.
         * generated/maxloc0_16_r8.c: Regenerated.
         * generated/maxloc0_16_s1.c: Regenerated.
         * generated/maxloc0_16_s4.c: Regenerated.
         * generated/maxloc0_4_i1.c: Regenerated.
         * generated/maxloc0_4_i16.c: Regenerated.
         * generated/maxloc0_4_i2.c: Regenerated.
         * generated/maxloc0_4_i4.c: Regenerated.
         * generated/maxloc0_4_i8.c: Regenerated.
         * generated/maxloc0_4_r10.c: Regenerated.
         * generated/maxloc0_4_r16.c: Regenerated.
         * generated/maxloc0_4_r4.c: Regenerated.
         * generated/maxloc0_4_r8.c: Regenerated.
         * generated/maxloc0_4_s1.c: Regenerated.
         * generated/maxloc0_4_s4.c: Regenerated.
         * generated/maxloc0_8_i1.c: Regenerated.
         * generated/maxloc0_8_i16.c: Regenerated.
         * generated/maxloc0_8_i2.c: Regenerated.
         * generated/maxloc0_8_i4.c: Regenerated.
         * generated/maxloc0_8_i8.c: Regenerated.
         * generated/maxloc0_8_r10.c: Regenerated.
         * generated/maxloc0_8_r16.c: Regenerated.
         * generated/maxloc0_8_r4.c: Regenerated.
         * generated/maxloc0_8_r8.c: Regenerated.
         * generated/maxloc0_8_s1.c: Regenerated.
         * generated/maxloc0_8_s4.c: Regenerated.
         * generated/maxloc1_16_i1.c: Regenerated.
         * generated/maxloc1_16_i16.c: Regenerated.
         * generated/maxloc1_16_i2.c: Regenerated.
         * generated/maxloc1_16_i4.c: Regenerated.
         * generated/maxloc1_16_i8.c: Regenerated.
         * generated/maxloc1_16_r10.c: Regenerated.
         * generated/maxloc1_16_r16.c: Regenerated.
         * generated/maxloc1_16_r4.c: Regenerated.
         * generated/maxloc1_16_r8.c: Regenerated.
         * generated/maxloc1_16_s1.c: Regenerated.
         * generated/maxloc1_16_s4.c: Regenerated.
         * generated/maxloc1_4_i1.c: Regenerated.
         * generated/maxloc1_4_i16.c: Regenerated.
         * generated/maxloc1_4_i2.c: Regenerated.
         * generated/maxloc1_4_i4.c: Regenerated.
         * generated/maxloc1_4_i8.c: Regenerated.
         * generated/maxloc1_4_r10.c: Regenerated.
         * generated/maxloc1_4_r16.c: Regenerated.
         * generated/maxloc1_4_r4.c: Regenerated.
         * generated/maxloc1_4_r8.c: Regenerated.
         * generated/maxloc1_4_s1.c: Regenerated.
         * generated/maxloc1_4_s4.c: Regenerated.
         * generated/maxloc1_8_i1.c: Regenerated.
         * generated/maxloc1_8_i16.c: Regenerated.
         * generated/maxloc1_8_i2.c: Regenerated.
         * generated/maxloc1_8_i4.c: Regenerated.
         * generated/maxloc1_8_i8.c: Regenerated.
         * generated/maxloc1_8_r10.c: Regenerated.
         * generated/maxloc1_8_r16.c: Regenerated.
         * generated/maxloc1_8_r4.c: Regenerated.
         * generated/maxloc1_8_r8.c: Regenerated.
         * generated/maxloc1_8_s1.c: Regenerated.
         * generated/maxloc1_8_s4.c: Regenerated.
         * generated/maxval0_s1.c: Regenerated.
         * generated/maxval0_s4.c: Regenerated.
         * generated/maxval1_s1.c: Regenerated.
         * generated/maxval1_s4.c: Regenerated.
         * generated/maxval_i1.c: Regenerated.
         * generated/maxval_i16.c: Regenerated.
         * generated/maxval_i2.c: Regenerated.
         * generated/maxval_i4.c: Regenerated.
         * generated/maxval_i8.c: Regenerated.
         * generated/maxval_r10.c: Regenerated.
         * generated/maxval_r16.c: Regenerated.
         * generated/maxval_r4.c: Regenerated.
         * generated/maxval_r8.c: Regenerated.
         * generated/minloc0_16_i1.c: Regenerated.
         * generated/minloc0_16_i16.c: Regenerated.
         * generated/minloc0_16_i2.c: Regenerated.
         * generated/minloc0_16_i4.c: Regenerated.
         * generated/minloc0_16_i8.c: Regenerated.
         * generated/minloc0_16_r10.c: Regenerated.
         * generated/minloc0_16_r16.c: Regenerated.
         * generated/minloc0_16_r4.c: Regenerated.
         * generated/minloc0_16_r8.c: Regenerated.
         * generated/minloc0_16_s1.c: Regenerated.
         * generated/minloc0_16_s4.c: Regenerated.
         * generated/minloc0_4_i1.c: Regenerated.
         * generated/minloc0_4_i16.c: Regenerated.
         * generated/minloc0_4_i2.c: Regenerated.
         * generated/minloc0_4_i4.c: Regenerated.
         * generated/minloc0_4_i8.c: Regenerated.
         * generated/minloc0_4_r10.c: Regenerated.
         * generated/minloc0_4_r16.c: Regenerated.
         * generated/minloc0_4_r4.c: Regenerated.
         * generated/minloc0_4_r8.c: Regenerated.
         * generated/minloc0_4_s1.c: Regenerated.
         * generated/minloc0_4_s4.c: Regenerated.
         * generated/minloc0_8_i1.c: Regenerated.
         * generated/minloc0_8_i16.c: Regenerated.
         * generated/minloc0_8_i2.c: Regenerated.
         * generated/minloc0_8_i4.c: Regenerated.
         * generated/minloc0_8_i8.c: Regenerated.
         * generated/minloc0_8_r10.c: Regenerated.
         * generated/minloc0_8_r16.c: Regenerated.
         * generated/minloc0_8_r4.c: Regenerated.
         * generated/minloc0_8_r8.c: Regenerated.
         * generated/minloc0_8_s1.c: Regenerated.
         * generated/minloc0_8_s4.c: Regenerated.
         * generated/minloc1_16_i1.c: Regenerated.
         * generated/minloc1_16_i16.c: Regenerated.
         * generated/minloc1_16_i2.c: Regenerated.
         * generated/minloc1_16_i4.c: Regenerated.
         * generated/minloc1_16_i8.c: Regenerated.
         * generated/minloc1_16_r10.c: Regenerated.
         * generated/minloc1_16_r16.c: Regenerated.
         * generated/minloc1_16_r4.c: Regenerated.
         * generated/minloc1_16_r8.c: Regenerated.
         * generated/minloc1_16_s1.c: Regenerated.
         * generated/minloc1_16_s4.c: Regenerated.
         * generated/minloc1_4_i1.c: Regenerated.
         * generated/minloc1_4_i16.c: Regenerated.
         * generated/minloc1_4_i2.c: Regenerated.
         * generated/minloc1_4_i4.c: Regenerated.
         * generated/minloc1_4_i8.c: Regenerated.
         * generated/minloc1_4_r10.c: Regenerated.
         * generated/minloc1_4_r16.c: Regenerated.
         * generated/minloc1_4_r4.c: Regenerated.
         * generated/minloc1_4_r8.c: Regenerated.
         * generated/minloc1_4_s1.c: Regenerated.
         * generated/minloc1_4_s4.c: Regenerated.
         * generated/minloc1_8_i1.c: Regenerated.
         * generated/minloc1_8_i16.c: Regenerated.
         * generated/minloc1_8_i2.c: Regenerated.
         * generated/minloc1_8_i4.c: Regenerated.
         * generated/minloc1_8_i8.c: Regenerated.
         * generated/minloc1_8_r10.c: Regenerated.
         * generated/minloc1_8_r16.c: Regenerated.
         * generated/minloc1_8_r4.c: Regenerated.
         * generated/minloc1_8_r8.c: Regenerated.
         * generated/minloc1_8_s1.c: Regenerated.
         * generated/minloc1_8_s4.c: Regenerated.
         * generated/minval0_s1.c: Regenerated.
         * generated/minval0_s4.c: Regenerated.
         * generated/minval1_s1.c: Regenerated.
         * generated/minval1_s4.c: Regenerated.
         * generated/minval_i1.c: Regenerated.
         * generated/minval_i16.c: Regenerated.
         * generated/minval_i2.c: Regenerated.
         * generated/minval_i4.c: Regenerated.
         * generated/minval_i8.c: Regenerated.
         * generated/minval_r10.c: Regenerated.
         * generated/minval_r16.c: Regenerated.
         * generated/minval_r4.c: Regenerated.
         * generated/minval_r8.c: Regenerated.
         * generated/product_c10.c: Regenerated.
         * generated/product_c16.c: Regenerated.
         * generated/product_c4.c: Regenerated.
         * generated/product_c8.c: Regenerated.
         * generated/product_i1.c: Regenerated.
         * generated/product_i16.c: Regenerated.
         * generated/product_i2.c: Regenerated.
         * generated/product_i4.c: Regenerated.
         * generated/product_i8.c: Regenerated.
         * generated/product_r10.c: Regenerated.
         * generated/product_r16.c: Regenerated.
         * generated/product_r4.c: Regenerated.
         * generated/product_r8.c: Regenerated.
         * generated/sum_c10.c: Regenerated.
         * generated/sum_c16.c: Regenerated.
         * generated/sum_c4.c: Regenerated.
         * generated/sum_c8.c: Regenerated.
         * generated/sum_i1.c: Regenerated.
         * generated/sum_i16.c: Regenerated.
         * generated/sum_i2.c: Regenerated.
         * generated/sum_i4.c: Regenerated.
         * generated/sum_i8.c: Regenerated.
         * generated/sum_r10.c: Regenerated.
         * generated/sum_r16.c: Regenerated.
         * generated/sum_r4.c: Regenerated.
         * generated/sum_r8.c: Regenerated.

2018-12-30  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/82995
         * gfortran.dg/optional_absent_4.f90: New test.
         * gfortran.dg/optional_absent_5.f90: New test.

Comments

Steve Kargl Dec. 30, 2018, 5:37 p.m. UTC | #1
On Sun, Dec 30, 2018 at 06:10:14PM +0100, Thomas Koenig wrote:

> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c	(Revision 267347)
> +++ gcc/fortran/trans-expr.c	(Arbeitskopie)
> @@ -5760,17 +5760,21 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
>  	     array-descriptor actual to array-descriptor dummy, see
>  	     PR 41911 for why a check has to be inserted.
>  	     fsym == NULL is checked as intrinsics required the descriptor
> -	     but do not always set fsym.  */
> +	     but do not always set fsym.  
> +	     Also, it is necessary to pass a NULL pointer to library routines
> +	     which usually ignoer optional arguments, so they can handle

s/ignoer/ignore

> +	     these themselves.  */
>  	  if (e->expr_type == EXPR_VARIABLE
>  	      && e->symtree->n.sym->attr.optional
> -	      && ((e->rank != 0 && elemental_proc)
> -		  || e->representation.length || e->ts.type == BT_CHARACTER
> -		  || (e->rank != 0
> -		      && (fsym == NULL
> -			  || (fsym-> as
> -			      && (fsym->as->type == AS_ASSUMED_SHAPE
> -				  || fsym->as->type == AS_ASSUMED_RANK
> -			      	  || fsym->as->type == AS_DEFERRED))))))
> +	      && (((e->rank != 0 && elemental_proc)
> +		   || e->representation.length || e->ts.type == BT_CHARACTER
> +		   || (e->rank != 0
> +		       && (fsym == NULL
> +			   || (fsym-> as

Remove space in 'fsym-> as'

> +			       && (fsym->as->type == AS_ASSUMED_SHAPE
> +				   || fsym->as->type == AS_ASSUMED_RANK
> +				   || fsym->as->type == AS_DEFERRED)))))
> +		  || se->ignore_optional))
>  	    gfc_conv_missing_dummy (&parmse, e, fsym ? fsym->ts : e->ts,
>  				    e->representation.length);
>  	}

(snip)

> +	{
> +	  tree present;
> +	  tree type;
> +
> +	  type = TREE_TYPE (maskse.expr);
> +	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
> +	  present = convert (type, present);
> +	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
> +				     present);
> +	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
> +				    type, present, maskse.expr);
> +	}
> +      else
> +	ifmask = maskse.expr;
> +

This block of code appears multiple time in the patch.
I wonder if you should split it out into its own function.

static tree
generate_mask (gfc_expr *mask)   /* Choose whatever name you like.
{

}

You could then just to

ifmask = generate_mask (maskse.expr);


Other than that, the patch looks ok to me.
Steve Kargl Dec. 30, 2018, 5:45 p.m. UTC | #2
On Sun, Dec 30, 2018 at 09:37:20AM -0800, Steve Kargl wrote:
> On Sun, Dec 30, 2018 at 06:10:14PM +0100, Thomas Koenig wrote:
> 
> > +	{
> > +	  tree present;
> > +	  tree type;
> > +
> > +	  type = TREE_TYPE (maskse.expr);
> > +	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
> > +	  present = convert (type, present);
> > +	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
> > +				     present);
> > +	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
> > +				    type, present, maskse.expr);
> > +	}
> > +      else
> > +	ifmask = maskse.expr;
> > +
> 
> This block of code appears multiple time in the patch.
> I wonder if you should split it out into its own function.
> 
> static tree
> generate_mask (gfc_expr *mask)   /* Choose whatever name you like.

I suppose that should be s/gfc_expr/tree.
diff mbox series

Patch

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 267347)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -5760,17 +5760,21 @@  gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
 	     array-descriptor actual to array-descriptor dummy, see
 	     PR 41911 for why a check has to be inserted.
 	     fsym == NULL is checked as intrinsics required the descriptor
-	     but do not always set fsym.  */
+	     but do not always set fsym.  
+	     Also, it is necessary to pass a NULL pointer to library routines
+	     which usually ignoer optional arguments, so they can handle
+	     these themselves.  */
 	  if (e->expr_type == EXPR_VARIABLE
 	      && e->symtree->n.sym->attr.optional
-	      && ((e->rank != 0 && elemental_proc)
-		  || e->representation.length || e->ts.type == BT_CHARACTER
-		  || (e->rank != 0
-		      && (fsym == NULL
-			  || (fsym-> as
-			      && (fsym->as->type == AS_ASSUMED_SHAPE
-				  || fsym->as->type == AS_ASSUMED_RANK
-			      	  || fsym->as->type == AS_DEFERRED))))))
+	      && (((e->rank != 0 && elemental_proc)
+		   || e->representation.length || e->ts.type == BT_CHARACTER
+		   || (e->rank != 0
+		       && (fsym == NULL
+			   || (fsym-> as
+			       && (fsym->as->type == AS_ASSUMED_SHAPE
+				   || fsym->as->type == AS_ASSUMED_RANK
+				   || fsym->as->type == AS_DEFERRED)))))
+		  || se->ignore_optional))
 	    gfc_conv_missing_dummy (&parmse, e, fsym ? fsym->ts : e->ts,
 				    e->representation.length);
 	}
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(Revision 267335)
+++ gcc/fortran/trans-intrinsic.c	(Arbeitskopie)
@@ -4380,6 +4380,7 @@  gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr *
   gfc_se *parent_se;
   gfc_expr *arrayexpr;
   gfc_expr *maskexpr;
+  bool optional_mask;
 
   if (expr->rank > 0)
     {
@@ -4419,13 +4420,19 @@  gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr *
   arrayexpr = arg_array->expr;
 
   if (op == NE_EXPR || norm2)
-    /* PARITY and NORM2.  */
-    maskexpr = NULL;
+    {
+      /* PARITY and NORM2.  */
+      maskexpr = NULL;
+      optional_mask = false;
+    }
   else
     {
       arg_mask  = arg_array->next->next;
       gcc_assert (arg_mask != NULL);
       maskexpr = arg_mask->expr;
+      optional_mask = maskexpr && maskexpr->expr_type == EXPR_VARIABLE
+	&& maskexpr->symtree->n.sym->attr.dummy
+	&& maskexpr->symtree->n.sym->attr.optional;
     }
 
   if (expr->rank == 0)
@@ -4444,17 +4451,22 @@  gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr *
 
       /* Initialize the scalarizer.  */
       gfc_init_loopinfo (&loop);
-      gfc_add_ss_to_loop (&loop, arrayss);
+
+      /* We add the mask first because the number of iterations is
+	 taken from the last ss, and this breaks if an absent
+	 optional argument is used for mask.  */
+
       if (maskexpr && maskexpr->rank > 0)
 	gfc_add_ss_to_loop (&loop, maskss);
+      gfc_add_ss_to_loop (&loop, arrayss);
 
       /* Initialize the loop.  */
       gfc_conv_ss_startstride (&loop);
       gfc_conv_loop_setup (&loop, &expr->where);
 
-      gfc_mark_ss_chain_used (arrayss, 1);
       if (maskexpr && maskexpr->rank > 0)
 	gfc_mark_ss_chain_used (maskss, 1);
+      gfc_mark_ss_chain_used (arrayss, 1);
 
       ploop = &loop;
     }
@@ -4563,10 +4575,29 @@  gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr *
 
   if (maskexpr && maskexpr->rank > 0)
     {
-      /* We enclose the above in if (mask) {...} .  */
+      /* We enclose the above in if (mask) {...} .  If the mask is an
+	 optional argument, generate
+	 IF (.NOT. PRESENT(MASK) .OR. MASK(I)).  */
+      tree ifmask;
+      tmp = gfc_finish_block (&block);
 
-      tmp = gfc_finish_block (&block);
-      tmp = build3_v (COND_EXPR, maskse.expr, tmp,
+      if (optional_mask)
+	{
+	  tree present;
+	  tree type;
+
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
+      tmp = build3_v (COND_EXPR, ifmask, tmp,
 		      build_empty_stmt (input_location));
     }
   else
@@ -4591,10 +4622,26 @@  gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr *
 	}
       else
 	{
+	  tree ifmask;
+
 	  gcc_assert (expr->rank == 0);
 	  gfc_init_se (&maskse, NULL);
 	  gfc_conv_expr_val (&maskse, maskexpr);
-	  tmp = build3_v (COND_EXPR, maskse.expr, tmp,
+	  if (optional_mask)
+	    {
+	      tree present, type;
+	      type = TREE_TYPE (maskse.expr);
+	      present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	      present = convert (type, present);
+	      present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+					 present);
+	      ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+					type, present, maskse.expr);
+	    }
+	  else
+	    ifmask = maskse.expr;
+
+	  tmp = build3_v (COND_EXPR, ifmask, tmp,
 			  build_empty_stmt (input_location));
 	}
 
@@ -4833,6 +4880,7 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
   gfc_se backse;
   tree pos;
   int n;
+  bool optional_mask;
 
   actual = expr->value.function.actual;
 
@@ -4887,6 +4935,9 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
   actual = actual->next->next;
   gcc_assert (actual);
   maskexpr = actual->expr;
+  optional_mask = maskexpr && maskexpr->expr_type == EXPR_VARIABLE
+    && maskexpr->symtree->n.sym->attr.dummy
+    && maskexpr->symtree->n.sym->attr.optional;
   backexpr = actual->next->next->expr;
   nonempty = NULL;
   if (maskexpr && maskexpr->rank != 0)
@@ -4939,10 +4990,16 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
 
   /* Initialize the scalarizer.  */
   gfc_init_loopinfo (&loop);
-  gfc_add_ss_to_loop (&loop, arrayss);
+
+  /* We add the mask first because the number of iterations is taken
+     from the last ss, and this breaks if an absent optional argument
+     is used for mask.  */
+
   if (maskss)
     gfc_add_ss_to_loop (&loop, maskss);
 
+  gfc_add_ss_to_loop (&loop, arrayss);
+
   /* Initialize the loop.  */
   gfc_conv_ss_startstride (&loop);
 
@@ -5103,10 +5160,30 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
 
   if (maskss)
     {
-      /* We enclose the above in if (mask) {...}.  */
+      /* We enclose the above in if (mask) {...}.  If the mask is an
+	 optional argument, generate IF (.NOT. PRESENT(MASK)
+	 .OR. MASK(I)). */
+
+      tree ifmask;
+      if (optional_mask)
+	{
+	  tree present;
+	  tree type;
+
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
       tmp = gfc_finish_block (&block);
 
-      tmp = build3_v (COND_EXPR, maskse.expr, tmp,
+      tmp = build3_v (COND_EXPR, ifmask, tmp,
 		      build_empty_stmt (input_location));
     }
   else
@@ -5197,10 +5274,31 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
 
       if (maskss)
 	{
-	  /* We enclose the above in if (mask) {...}.  */
+	  /* We enclose the above in if (mask) {...}.  If the mask is
+	 an optional argument, generate IF (.NOT. PRESENT(MASK)
+	 .OR. MASK(I)).*/
+
+	  tree ifmask;
+
+	  if (optional_mask)
+	    {
+	      tree present;
+	      tree type;
+
+	      type = TREE_TYPE (maskse.expr);
+	      present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	      present = convert (type, present);
+	      present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+					 present);
+	      ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+					type, present, maskse.expr);
+	    }
+	  else
+	    ifmask = maskse.expr;
+
 	  tmp = gfc_finish_block (&block);
 
-	  tmp = build3_v (COND_EXPR, maskse.expr, tmp,
+	  tmp = build3_v (COND_EXPR, ifmask, tmp,
 			  build_empty_stmt (input_location));
 	}
       else
@@ -5219,6 +5317,8 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
   /* For a scalar mask, enclose the loop in an if statement.  */
   if (maskexpr && maskss == NULL)
     {
+      tree ifmask;
+
       gfc_init_se (&maskse, NULL);
       gfc_conv_expr_val (&maskse, maskexpr);
       gfc_init_block (&block);
@@ -5233,7 +5333,21 @@  gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_exp
       gfc_add_modify (&elseblock, pos, gfc_index_zero_node);
       elsetmp = gfc_finish_block (&elseblock);
 
-      tmp = build3_v (COND_EXPR, maskse.expr, tmp, elsetmp);
+      if (optional_mask)
+	{
+	  tree present, type;
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
+      tmp = build3_v (COND_EXPR, ifmask, tmp, elsetmp);
       gfc_add_expr_to_block (&block, tmp);
       gfc_add_block_to_block (&se->pre, &block);
     }
@@ -5276,6 +5390,7 @@  gfc_conv_intrinsic_findloc (gfc_se *se, gfc_expr *
   gfc_expr *maskexpr;
   tree offset;
   int i;
+  bool optional_mask;
 
   array_arg = expr->value.function.actual;
   value_arg = array_arg->next;
@@ -5326,6 +5441,9 @@  gfc_conv_intrinsic_findloc (gfc_se *se, gfc_expr *
   offset = gfc_create_var (gfc_array_index_type, "offset");
 
   maskexpr = mask_arg->expr;
+  optional_mask = maskexpr && maskexpr->expr_type == EXPR_VARIABLE
+    && maskexpr->symtree->n.sym->attr.dummy
+    && maskexpr->symtree->n.sym->attr.optional;
 
   /*  Generate two loops, one for BACK=.true. and one for BACK=.false.  */
 
@@ -5347,9 +5465,14 @@  gfc_conv_intrinsic_findloc (gfc_se *se, gfc_expr *
       gfc_init_loopinfo (&loop);
       exit_label = gfc_build_label_decl (NULL_TREE);
       TREE_USED (exit_label) = 1;
-      gfc_add_ss_to_loop (&loop, arrayss);
+
+      /* We add the mask first because the number of iterations is
+	 taken from the last ss, and this breaks if an absent
+	 optional argument is used for mask.  */
+
       if (maskss)
 	gfc_add_ss_to_loop (&loop, maskss);
+      gfc_add_ss_to_loop (&loop, arrayss);
 
       /* Initialize the loop.  */
       gfc_conv_ss_startstride (&loop);
@@ -5412,9 +5535,32 @@  gfc_conv_intrinsic_findloc (gfc_se *se, gfc_expr *
 
       tmp = build3_v (COND_EXPR, tmp, found, build_empty_stmt (input_location));
       if (maskss)
-	tmp = build3_v (COND_EXPR, maskse.expr, tmp,
-			build_empty_stmt (input_location));
+	{
+	  /* We enclose the above in if (mask) {...}.  If the mask is
+	     an optional argument, generate IF (.NOT. PRESENT(MASK)
+	     .OR. MASK(I)). */
 
+	  tree ifmask;
+	  if (optional_mask)
+	    {
+	      tree present;
+	      tree type;
+
+	      type = TREE_TYPE (maskse.expr);
+	      present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	      present = convert (type, present);
+	      present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+					 present);
+	      ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+					type, present, maskse.expr);
+	    }
+	  else
+	    ifmask = maskse.expr;
+
+	  tmp = build3_v (COND_EXPR, ifmask, tmp,
+			  build_empty_stmt (input_location));
+	}
+
       gfc_add_expr_to_block (&body, tmp);
       gfc_add_block_to_block (&body, &arrayse.post);
 
@@ -5444,12 +5590,29 @@  gfc_conv_intrinsic_findloc (gfc_se *se, gfc_expr *
   /* For a scalar mask, enclose the loop in an if statement.  */
   if (maskexpr && maskss == NULL)
     {
+      tree ifmask;
       tree if_stmt;
+
       gfc_init_se (&maskse, NULL);
       gfc_conv_expr_val (&maskse, maskexpr);
       gfc_init_block (&block);
       gfc_add_expr_to_block (&block, maskse.expr);
-      if_stmt = build3_v (COND_EXPR, maskse.expr, tmp,
+
+      if (optional_mask)
+	{
+	  tree present, type;
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
+      if_stmt = build3_v (COND_EXPR, ifmask, tmp,
 			  build_empty_stmt (input_location));
       gfc_add_expr_to_block (&block, if_stmt);
       tmp = gfc_finish_block (&block);
@@ -5576,6 +5739,7 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
   gfc_expr *arrayexpr;
   gfc_expr *maskexpr;
   int n;
+  bool optional_mask;
 
   if (se->ss)
     {
@@ -5665,6 +5829,9 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
   actual = actual->next->next;
   gcc_assert (actual);
   maskexpr = actual->expr;
+  optional_mask = maskexpr && maskexpr->expr_type == EXPR_VARIABLE
+    && maskexpr->symtree->n.sym->attr.dummy
+    && maskexpr->symtree->n.sym->attr.optional;
   nonempty = NULL;
   if (maskexpr && maskexpr->rank != 0)
     {
@@ -5687,9 +5854,14 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
 
   /* Initialize the scalarizer.  */
   gfc_init_loopinfo (&loop);
-  gfc_add_ss_to_loop (&loop, arrayss);
+
+  /* We add the mask first because the number of iterations is taken
+     from the last ss, and this breaks if an absent optional argument
+     is used for mask.  */
+
   if (maskss)
     gfc_add_ss_to_loop (&loop, maskss);
+  gfc_add_ss_to_loop (&loop, arrayss);
 
   /* Initialize the loop.  */
   gfc_conv_ss_startstride (&loop);
@@ -5832,9 +6004,31 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
 
   tmp = gfc_finish_block (&block);
   if (maskss)
-    /* We enclose the above in if (mask) {...}.  */
-    tmp = build3_v (COND_EXPR, maskse.expr, tmp,
-		    build_empty_stmt (input_location));
+    {
+      /* We enclose the above in if (mask) {...}.  If the mask is an
+	 optional argument, generate IF (.NOT. PRESENT(MASK)
+	 .OR. MASK(I)).  */
+      tree ifmask;
+
+      if (optional_mask)
+	{
+	  tree present;
+	  tree type;
+
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
+      tmp = build3_v (COND_EXPR, ifmask, tmp,
+		      build_empty_stmt (input_location));
+    }
   gfc_add_expr_to_block (&body, tmp);
 
   if (lab)
@@ -5891,8 +6085,28 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
       tmp = gfc_finish_block (&block);
       if (maskss)
 	/* We enclose the above in if (mask) {...}.  */
-	tmp = build3_v (COND_EXPR, maskse.expr, tmp,
-			build_empty_stmt (input_location));
+	{
+	  tree ifmask;
+	  if (optional_mask)
+	    {
+	      tree present;
+	      tree type;
+
+	      type = TREE_TYPE (maskse.expr);
+	      present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	      present = convert (type, present);
+	      present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+					 present);
+	      ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+					type, present, maskse.expr);
+	    }
+	  else
+	    ifmask = maskse.expr;
+
+	  tmp = build3_v (COND_EXPR, ifmask, tmp,
+			  build_empty_stmt (input_location));
+	}
+
       gfc_add_expr_to_block (&body, tmp);
       /* Avoid initializing loopvar[0] again, it should be left where
 	 it finished by the first loop.  */
@@ -5920,6 +6134,7 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
   if (maskexpr && maskss == NULL)
     {
       tree else_stmt;
+      tree ifmask;
 
       gfc_init_se (&maskse, NULL);
       gfc_conv_expr_val (&maskse, maskexpr);
@@ -5932,7 +6147,22 @@  gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_exp
 	else_stmt = build2_v (MODIFY_EXPR, limit, huge_cst);
       else
 	else_stmt = build_empty_stmt (input_location);
-      tmp = build3_v (COND_EXPR, maskse.expr, tmp, else_stmt);
+
+      if (optional_mask)
+	{
+	  tree present, type;
+	  type = TREE_TYPE (maskse.expr);
+	  present = gfc_conv_expr_present (maskexpr->symtree->n.sym);
+	  present = convert (type, present);
+	  present = fold_build1_loc (input_location, TRUTH_NOT_EXPR, type,
+				     present);
+	  ifmask = fold_build2_loc (input_location, TRUTH_ORIF_EXPR,
+				    type, present, maskse.expr);
+	}
+      else
+	ifmask = maskse.expr;
+
+      tmp = build3_v (COND_EXPR, ifmask, tmp, else_stmt);
       gfc_add_expr_to_block (&block, tmp);
       gfc_add_block_to_block (&se->pre, &block);
     }
@@ -10177,7 +10407,8 @@  gfc_walk_intrinsic_libfunc (gfc_ss * ss, gfc_expr
 bool
 gfc_inline_intrinsic_function_p (gfc_expr *expr)
 {
-  gfc_actual_arglist *args;
+  gfc_actual_arglist *args, *dim_arg, *mask_arg;
+  gfc_expr *maskexpr;
 
   if (!expr->value.function.isym)
     return false;
@@ -10191,10 +10422,25 @@  gfc_inline_intrinsic_function_p (gfc_expr *expr)
 	return false;
 
       args = expr->value.function.actual;
+      dim_arg = args->next;
+
       /* We need to be able to subset the SUM argument at compile-time.  */
-      if (args->next->expr && args->next->expr->expr_type != EXPR_CONSTANT)
+      if (dim_arg->expr && dim_arg->expr->expr_type != EXPR_CONSTANT)
 	return false;
 
+      /* FIXME: If MASK is optional for a more than two-dimensional
+	 argument, the scalarizer gets confused if the mask is
+	 absent.  See PR 82995.  For now, fall back to the library
+	 function.  */
+
+      mask_arg = dim_arg->next;
+      maskexpr = mask_arg->expr;
+
+      if (expr->rank > 0 && maskexpr && maskexpr->expr_type == EXPR_VARIABLE
+	  && maskexpr->symtree->n.sym->attr.dummy
+	  && maskexpr->symtree->n.sym->attr.optional)
+	return false;
+	  
       return true;
 
     case GFC_ISYM_TRANSPOSE:
Index: libgfortran/generated/findloc0_c16.c
===================================================================
--- libgfortran/generated/findloc0_c16.c	(Revision 267335)
+++ libgfortran/generated/findloc0_c16.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_c16 (gfc_array_index_type * const restri
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_c16 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_c4.c
===================================================================
--- libgfortran/generated/findloc0_c4.c	(Revision 267335)
+++ libgfortran/generated/findloc0_c4.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_c4 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_c4 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_c8.c
===================================================================
--- libgfortran/generated/findloc0_c8.c	(Revision 267335)
+++ libgfortran/generated/findloc0_c8.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_c8 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_c8 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_i1.c
===================================================================
--- libgfortran/generated/findloc0_i1.c	(Revision 267335)
+++ libgfortran/generated/findloc0_i1.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_i1 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_i1 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_i16.c
===================================================================
--- libgfortran/generated/findloc0_i16.c	(Revision 267335)
+++ libgfortran/generated/findloc0_i16.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_i16 (gfc_array_index_type * const restri
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_i16 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_i2.c
===================================================================
--- libgfortran/generated/findloc0_i2.c	(Revision 267335)
+++ libgfortran/generated/findloc0_i2.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_i2 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_i2 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_i4.c
===================================================================
--- libgfortran/generated/findloc0_i4.c	(Revision 267335)
+++ libgfortran/generated/findloc0_i4.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_i4 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_i4 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_i8.c
===================================================================
--- libgfortran/generated/findloc0_i8.c	(Revision 267335)
+++ libgfortran/generated/findloc0_i8.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_i8 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_i8 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_r16.c
===================================================================
--- libgfortran/generated/findloc0_r16.c	(Revision 267335)
+++ libgfortran/generated/findloc0_r16.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_r16 (gfc_array_index_type * const restri
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_r16 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_r4.c
===================================================================
--- libgfortran/generated/findloc0_r4.c	(Revision 267335)
+++ libgfortran/generated/findloc0_r4.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_r4 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_r4 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_r8.c
===================================================================
--- libgfortran/generated/findloc0_r8.c	(Revision 267335)
+++ libgfortran/generated/findloc0_r8.c	(Arbeitskopie)
@@ -342,7 +342,7 @@  sfindloc0_r8 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_r8 (retarray, array, value, back);
       return;
Index: libgfortran/generated/findloc0_s1.c
===================================================================
--- libgfortran/generated/findloc0_s1.c	(Revision 267335)
+++ libgfortran/generated/findloc0_s1.c	(Arbeitskopie)
@@ -347,7 +347,7 @@  sfindloc0_s1 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_s1 (retarray, array, value, back, len_array, len_value);
       return;
Index: libgfortran/generated/findloc0_s4.c
===================================================================
--- libgfortran/generated/findloc0_s4.c	(Revision 267335)
+++ libgfortran/generated/findloc0_s4.c	(Arbeitskopie)
@@ -347,7 +347,7 @@  sfindloc0_s4 (gfc_array_index_type * const restric
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_s4 (retarray, array, value, back, len_array, len_value);
       return;
Index: libgfortran/generated/findloc1_c16.c
===================================================================
--- libgfortran/generated/findloc1_c16.c	(Revision 267335)
+++ libgfortran/generated/findloc1_c16.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_c16 (gfc_array_index_type * const restri
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_c16 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_c4.c
===================================================================
--- libgfortran/generated/findloc1_c4.c	(Revision 267335)
+++ libgfortran/generated/findloc1_c4.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_c4 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_c4 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_c8.c
===================================================================
--- libgfortran/generated/findloc1_c8.c	(Revision 267335)
+++ libgfortran/generated/findloc1_c8.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_c8 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_c8 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_i1.c
===================================================================
--- libgfortran/generated/findloc1_i1.c	(Revision 267335)
+++ libgfortran/generated/findloc1_i1.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_i1 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_i1 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_i16.c
===================================================================
--- libgfortran/generated/findloc1_i16.c	(Revision 267335)
+++ libgfortran/generated/findloc1_i16.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_i16 (gfc_array_index_type * const restri
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_i16 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_i2.c
===================================================================
--- libgfortran/generated/findloc1_i2.c	(Revision 267335)
+++ libgfortran/generated/findloc1_i2.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_i2 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_i2 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_i4.c
===================================================================
--- libgfortran/generated/findloc1_i4.c	(Revision 267335)
+++ libgfortran/generated/findloc1_i4.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_i4 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_i4 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_i8.c
===================================================================
--- libgfortran/generated/findloc1_i8.c	(Revision 267335)
+++ libgfortran/generated/findloc1_i8.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_i8 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_i8 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_r16.c
===================================================================
--- libgfortran/generated/findloc1_r16.c	(Revision 267335)
+++ libgfortran/generated/findloc1_r16.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_r16 (gfc_array_index_type * const restri
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_r16 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_r4.c
===================================================================
--- libgfortran/generated/findloc1_r4.c	(Revision 267335)
+++ libgfortran/generated/findloc1_r4.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_r4 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_r4 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_r8.c
===================================================================
--- libgfortran/generated/findloc1_r8.c	(Revision 267335)
+++ libgfortran/generated/findloc1_r8.c	(Arbeitskopie)
@@ -407,7 +407,7 @@  sfindloc1_r8 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_r8 (retarray, array, value, pdim, back);
       return;
Index: libgfortran/generated/findloc1_s1.c
===================================================================
--- libgfortran/generated/findloc1_s1.c	(Revision 267335)
+++ libgfortran/generated/findloc1_s1.c	(Arbeitskopie)
@@ -409,7 +409,7 @@  sfindloc1_s1 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_s1 (retarray, array, value, pdim, back, len_array, len_value);
       return;
Index: libgfortran/generated/findloc1_s4.c
===================================================================
--- libgfortran/generated/findloc1_s4.c	(Revision 267335)
+++ libgfortran/generated/findloc1_s4.c	(Arbeitskopie)
@@ -409,7 +409,7 @@  sfindloc1_s4 (gfc_array_index_type * const restric
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_s4 (retarray, array, value, pdim, back, len_array, len_value);
       return;
Index: libgfortran/generated/findloc2_s1.c
===================================================================
--- libgfortran/generated/findloc2_s1.c	(Revision 267335)
+++ libgfortran/generated/findloc2_s1.c	(Arbeitskopie)
@@ -145,7 +145,7 @@  sfindloc2_s1 (gfc_array_s1 * const restrict array,
 			   GFC_LOGICAL_4 back, gfc_charlen_type len_array,
 			   gfc_charlen_type len_value)
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       return findloc2_s1 (array, value, back, len_array, len_value);
     }
Index: libgfortran/generated/findloc2_s4.c
===================================================================
--- libgfortran/generated/findloc2_s4.c	(Revision 267335)
+++ libgfortran/generated/findloc2_s4.c	(Arbeitskopie)
@@ -145,7 +145,7 @@  sfindloc2_s4 (gfc_array_s4 * const restrict array,
 			   GFC_LOGICAL_4 back, gfc_charlen_type len_array,
 			   gfc_charlen_type len_value)
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       return findloc2_s4 (array, value, back, len_array, len_value);
     }
Index: libgfortran/generated/iall_i1.c
===================================================================
--- libgfortran/generated/iall_i1.c	(Revision 267335)
+++ libgfortran/generated/iall_i1.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miall_i1 (gfc_array_i1 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iall_i1 (retarray, array, pdim, back);
+#else
+      iall_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siall_i1 (gfc_array_i1 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iall_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/iall_i16.c
===================================================================
--- libgfortran/generated/iall_i16.c	(Revision 267335)
+++ libgfortran/generated/iall_i16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miall_i16 (gfc_array_i16 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iall_i16 (retarray, array, pdim, back);
+#else
+      iall_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siall_i16 (gfc_array_i16 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iall_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/iall_i2.c
===================================================================
--- libgfortran/generated/iall_i2.c	(Revision 267335)
+++ libgfortran/generated/iall_i2.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miall_i2 (gfc_array_i2 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iall_i2 (retarray, array, pdim, back);
+#else
+      iall_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siall_i2 (gfc_array_i2 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iall_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/iall_i4.c
===================================================================
--- libgfortran/generated/iall_i4.c	(Revision 267335)
+++ libgfortran/generated/iall_i4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miall_i4 (gfc_array_i4 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iall_i4 (retarray, array, pdim, back);
+#else
+      iall_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siall_i4 (gfc_array_i4 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iall_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/iall_i8.c
===================================================================
--- libgfortran/generated/iall_i8.c	(Revision 267335)
+++ libgfortran/generated/iall_i8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miall_i8 (gfc_array_i8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iall_i8 (retarray, array, pdim, back);
+#else
+      iall_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siall_i8 (gfc_array_i8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iall_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/iany_i1.c
===================================================================
--- libgfortran/generated/iany_i1.c	(Revision 267335)
+++ libgfortran/generated/iany_i1.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miany_i1 (gfc_array_i1 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iany_i1 (retarray, array, pdim, back);
+#else
+      iany_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siany_i1 (gfc_array_i1 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iany_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/iany_i16.c
===================================================================
--- libgfortran/generated/iany_i16.c	(Revision 267335)
+++ libgfortran/generated/iany_i16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miany_i16 (gfc_array_i16 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iany_i16 (retarray, array, pdim, back);
+#else
+      iany_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siany_i16 (gfc_array_i16 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iany_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/iany_i2.c
===================================================================
--- libgfortran/generated/iany_i2.c	(Revision 267335)
+++ libgfortran/generated/iany_i2.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miany_i2 (gfc_array_i2 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iany_i2 (retarray, array, pdim, back);
+#else
+      iany_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siany_i2 (gfc_array_i2 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iany_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/iany_i4.c
===================================================================
--- libgfortran/generated/iany_i4.c	(Revision 267335)
+++ libgfortran/generated/iany_i4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miany_i4 (gfc_array_i4 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iany_i4 (retarray, array, pdim, back);
+#else
+      iany_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siany_i4 (gfc_array_i4 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iany_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/iany_i8.c
===================================================================
--- libgfortran/generated/iany_i8.c	(Revision 267335)
+++ libgfortran/generated/iany_i8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miany_i8 (gfc_array_i8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iany_i8 (retarray, array, pdim, back);
+#else
+      iany_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siany_i8 (gfc_array_i8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iany_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/iparity_i1.c
===================================================================
--- libgfortran/generated/iparity_i1.c	(Revision 267335)
+++ libgfortran/generated/iparity_i1.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miparity_i1 (gfc_array_i1 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iparity_i1 (retarray, array, pdim, back);
+#else
+      iparity_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siparity_i1 (gfc_array_i1 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iparity_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/iparity_i16.c
===================================================================
--- libgfortran/generated/iparity_i16.c	(Revision 267335)
+++ libgfortran/generated/iparity_i16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miparity_i16 (gfc_array_i16 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iparity_i16 (retarray, array, pdim, back);
+#else
+      iparity_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siparity_i16 (gfc_array_i16 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iparity_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/iparity_i2.c
===================================================================
--- libgfortran/generated/iparity_i2.c	(Revision 267335)
+++ libgfortran/generated/iparity_i2.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miparity_i2 (gfc_array_i2 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iparity_i2 (retarray, array, pdim, back);
+#else
+      iparity_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siparity_i2 (gfc_array_i2 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iparity_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/iparity_i4.c
===================================================================
--- libgfortran/generated/iparity_i4.c	(Revision 267335)
+++ libgfortran/generated/iparity_i4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miparity_i4 (gfc_array_i4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iparity_i4 (retarray, array, pdim, back);
+#else
+      iparity_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siparity_i4 (gfc_array_i4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iparity_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/iparity_i8.c
===================================================================
--- libgfortran/generated/iparity_i8.c	(Revision 267335)
+++ libgfortran/generated/iparity_i8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  miparity_i8 (gfc_array_i8 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      iparity_i8 (retarray, array, pdim, back);
+#else
+      iparity_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  siparity_i8 (gfc_array_i8 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       iparity_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc0_16_i1.c
===================================================================
--- libgfortran/generated/maxloc0_16_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_i1 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_i1 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_i16.c
===================================================================
--- libgfortran/generated/maxloc0_16_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_i16 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_i16 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_i2.c
===================================================================
--- libgfortran/generated/maxloc0_16_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_i2 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_i2 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_i4.c
===================================================================
--- libgfortran/generated/maxloc0_16_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_i4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_i4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_i8.c
===================================================================
--- libgfortran/generated/maxloc0_16_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_i8 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_i8 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_r10.c
===================================================================
--- libgfortran/generated/maxloc0_16_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_r10 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_r10 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_r16.c
===================================================================
--- libgfortran/generated/maxloc0_16_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_r16 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_r16 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_r4.c
===================================================================
--- libgfortran/generated/maxloc0_16_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_r4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_r4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_r8.c
===================================================================
--- libgfortran/generated/maxloc0_16_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_16_r8 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_16_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_16_r8 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_16_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_16_s1.c
===================================================================
--- libgfortran/generated/maxloc0_16_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_16_s1 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_16_s1 (retarray, array, back, len);
+#else
+      maxloc0_16_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_16_s1 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_16_s1 (retarray, array, back, len);
Index: libgfortran/generated/maxloc0_16_s4.c
===================================================================
--- libgfortran/generated/maxloc0_16_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_16_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_16_s4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_16_s4 (retarray, array, back, len);
+#else
+      maxloc0_16_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_16_s4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_16_s4 (retarray, array, back, len);
Index: libgfortran/generated/maxloc0_4_i1.c
===================================================================
--- libgfortran/generated/maxloc0_4_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_i1 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_i1 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_i16.c
===================================================================
--- libgfortran/generated/maxloc0_4_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_i16 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_i16 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_i2.c
===================================================================
--- libgfortran/generated/maxloc0_4_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_i2 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_i2 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_i4.c
===================================================================
--- libgfortran/generated/maxloc0_4_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_i4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_i4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_i8.c
===================================================================
--- libgfortran/generated/maxloc0_4_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_i8 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_i8 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_r10.c
===================================================================
--- libgfortran/generated/maxloc0_4_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_r10 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_r10 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_r16.c
===================================================================
--- libgfortran/generated/maxloc0_4_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_r16 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_r16 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_r4.c
===================================================================
--- libgfortran/generated/maxloc0_4_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_r4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_r4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_r8.c
===================================================================
--- libgfortran/generated/maxloc0_4_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_4_r8 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_4_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_4_r8 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_4_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_4_s1.c
===================================================================
--- libgfortran/generated/maxloc0_4_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_4_s1 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_4_s1 (retarray, array, back, len);
+#else
+      maxloc0_4_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_4_s1 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_4_s1 (retarray, array, back, len);
Index: libgfortran/generated/maxloc0_4_s4.c
===================================================================
--- libgfortran/generated/maxloc0_4_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_4_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_4_s4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_4_s4 (retarray, array, back, len);
+#else
+      maxloc0_4_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_4_s4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_4_s4 (retarray, array, back, len);
Index: libgfortran/generated/maxloc0_8_i1.c
===================================================================
--- libgfortran/generated/maxloc0_8_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_i1 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_i1 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_i16.c
===================================================================
--- libgfortran/generated/maxloc0_8_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_i16 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_i16 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_i2.c
===================================================================
--- libgfortran/generated/maxloc0_8_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_i2 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_i2 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_i4.c
===================================================================
--- libgfortran/generated/maxloc0_8_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_i4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_i4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_i8.c
===================================================================
--- libgfortran/generated/maxloc0_8_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_i8 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_i8 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_r10.c
===================================================================
--- libgfortran/generated/maxloc0_8_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_r10 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_r10 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_r16.c
===================================================================
--- libgfortran/generated/maxloc0_8_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_r16 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_r16 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_r4.c
===================================================================
--- libgfortran/generated/maxloc0_8_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_r4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_r4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_r8.c
===================================================================
--- libgfortran/generated/maxloc0_8_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mmaxloc0_8_r8 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      maxloc0_8_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -369,7 +376,7 @@  smaxloc0_8_r8 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxloc0_8_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/maxloc0_8_s1.c
===================================================================
--- libgfortran/generated/maxloc0_8_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_8_s1 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_8_s1 (retarray, array, back, len);
+#else
+      maxloc0_8_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_8_s1 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_8_s1 (retarray, array, back, len);
Index: libgfortran/generated/maxloc0_8_s4.c
===================================================================
--- libgfortran/generated/maxloc0_8_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc0_8_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mmaxloc0_8_s4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      maxloc0_8_s4 (retarray, array, back, len);
+#else
+      maxloc0_8_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  smaxloc0_8_s4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       maxloc0_8_s4 (retarray, array, back, len);
Index: libgfortran/generated/maxloc1_16_i1.c
===================================================================
--- libgfortran/generated/maxloc1_16_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_i1.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_i1 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_i1 (retarray, array, pdim, back);
+#else
+      maxloc1_16_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_i1 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_i16.c
===================================================================
--- libgfortran/generated/maxloc1_16_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_i16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_i16 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_i16 (retarray, array, pdim, back);
+#else
+      maxloc1_16_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_i16 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_i2.c
===================================================================
--- libgfortran/generated/maxloc1_16_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_i2.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_i2 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_i2 (retarray, array, pdim, back);
+#else
+      maxloc1_16_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_i2 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_i4.c
===================================================================
--- libgfortran/generated/maxloc1_16_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_i4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_i4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_i4 (retarray, array, pdim, back);
+#else
+      maxloc1_16_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_i4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_i8.c
===================================================================
--- libgfortran/generated/maxloc1_16_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_i8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_i8 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_i8 (retarray, array, pdim, back);
+#else
+      maxloc1_16_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_i8 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_r10.c
===================================================================
--- libgfortran/generated/maxloc1_16_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_r10.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_r10 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_r10 (retarray, array, pdim, back);
+#else
+      maxloc1_16_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_r10 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_r16.c
===================================================================
--- libgfortran/generated/maxloc1_16_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_r16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_r16 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_r16 (retarray, array, pdim, back);
+#else
+      maxloc1_16_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_r16 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_r4.c
===================================================================
--- libgfortran/generated/maxloc1_16_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_r4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_r4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_r4 (retarray, array, pdim, back);
+#else
+      maxloc1_16_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_r4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_r8.c
===================================================================
--- libgfortran/generated/maxloc1_16_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_r8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_16_r8 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_r8 (retarray, array, pdim, back);
+#else
+      maxloc1_16_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_16_r8 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_16_s1.c
===================================================================
--- libgfortran/generated/maxloc1_16_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_16_s1 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_s1 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_16_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_16_s1 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxloc1_16_s4.c
===================================================================
--- libgfortran/generated/maxloc1_16_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_16_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_16_s4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_16_s4 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_16_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_16_s4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_16_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxloc1_4_i1.c
===================================================================
--- libgfortran/generated/maxloc1_4_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_i1.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_i1 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_i1 (retarray, array, pdim, back);
+#else
+      maxloc1_4_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_i1 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_i16.c
===================================================================
--- libgfortran/generated/maxloc1_4_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_i16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_i16 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_i16 (retarray, array, pdim, back);
+#else
+      maxloc1_4_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_i16 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_i2.c
===================================================================
--- libgfortran/generated/maxloc1_4_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_i2.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_i2 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_i2 (retarray, array, pdim, back);
+#else
+      maxloc1_4_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_i2 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_i4.c
===================================================================
--- libgfortran/generated/maxloc1_4_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_i4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_i4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_i4 (retarray, array, pdim, back);
+#else
+      maxloc1_4_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_i4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_i8.c
===================================================================
--- libgfortran/generated/maxloc1_4_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_i8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_i8 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_i8 (retarray, array, pdim, back);
+#else
+      maxloc1_4_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_i8 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_r10.c
===================================================================
--- libgfortran/generated/maxloc1_4_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_r10.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_r10 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_r10 (retarray, array, pdim, back);
+#else
+      maxloc1_4_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_r10 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_r16.c
===================================================================
--- libgfortran/generated/maxloc1_4_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_r16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_r16 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_r16 (retarray, array, pdim, back);
+#else
+      maxloc1_4_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_r16 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_r4.c
===================================================================
--- libgfortran/generated/maxloc1_4_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_r4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_r4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_r4 (retarray, array, pdim, back);
+#else
+      maxloc1_4_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_r4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_r8.c
===================================================================
--- libgfortran/generated/maxloc1_4_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_r8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_4_r8 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_r8 (retarray, array, pdim, back);
+#else
+      maxloc1_4_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_4_r8 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_4_s1.c
===================================================================
--- libgfortran/generated/maxloc1_4_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_4_s1 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_s1 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_4_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_4_s1 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxloc1_4_s4.c
===================================================================
--- libgfortran/generated/maxloc1_4_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_4_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_4_s4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_4_s4 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_4_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_4_s4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_4_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxloc1_8_i1.c
===================================================================
--- libgfortran/generated/maxloc1_8_i1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_i1.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_i1 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_i1 (retarray, array, pdim, back);
+#else
+      maxloc1_8_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_i1 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_i16.c
===================================================================
--- libgfortran/generated/maxloc1_8_i16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_i16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_i16 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_i16 (retarray, array, pdim, back);
+#else
+      maxloc1_8_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_i16 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_i2.c
===================================================================
--- libgfortran/generated/maxloc1_8_i2.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_i2.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_i2 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_i2 (retarray, array, pdim, back);
+#else
+      maxloc1_8_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_i2 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_i4.c
===================================================================
--- libgfortran/generated/maxloc1_8_i4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_i4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_i4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_i4 (retarray, array, pdim, back);
+#else
+      maxloc1_8_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_i4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_i8.c
===================================================================
--- libgfortran/generated/maxloc1_8_i8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_i8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_i8 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_i8 (retarray, array, pdim, back);
+#else
+      maxloc1_8_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_i8 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_r10.c
===================================================================
--- libgfortran/generated/maxloc1_8_r10.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_r10.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_r10 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_r10 (retarray, array, pdim, back);
+#else
+      maxloc1_8_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_r10 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_r16.c
===================================================================
--- libgfortran/generated/maxloc1_8_r16.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_r16.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_r16 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_r16 (retarray, array, pdim, back);
+#else
+      maxloc1_8_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_r16 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_r4.c
===================================================================
--- libgfortran/generated/maxloc1_8_r4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_r4.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_r4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_r4 (retarray, array, pdim, back);
+#else
+      maxloc1_8_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_r4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_r8.c
===================================================================
--- libgfortran/generated/maxloc1_8_r8.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_r8.c	(Arbeitskopie)
@@ -248,6 +248,16 @@  mmaxloc1_8_r8 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_r8 (retarray, array, pdim, back);
+#else
+      maxloc1_8_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -470,7 +480,7 @@  smaxloc1_8_r8 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxloc1_8_s1.c
===================================================================
--- libgfortran/generated/maxloc1_8_s1.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_8_s1 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_s1 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_8_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_8_s1 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxloc1_8_s4.c
===================================================================
--- libgfortran/generated/maxloc1_8_s4.c	(Revision 267335)
+++ libgfortran/generated/maxloc1_8_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mmaxloc1_8_s4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxloc1_8_s4 (retarray, array, pdim, back, string_len);
+#else
+      maxloc1_8_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  smaxloc1_8_s4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxloc1_8_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/maxval0_s1.c
===================================================================
--- libgfortran/generated/maxval0_s1.c	(Revision 267335)
+++ libgfortran/generated/maxval0_s1.c	(Arbeitskopie)
@@ -150,6 +150,12 @@  mmaxval0_s1 (GFC_UINTEGER_1 * const restrict ret,
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      maxval0_s1 (ret, xlen, array, len);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -247,7 +253,7 @@  smaxval0_s1 (GFC_UINTEGER_1 * restrict ret,
 	GFC_LOGICAL_4 *mask, gfc_charlen_type len)
 	
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxval0_s1 (ret, xlen, array, len);
       return;
Index: libgfortran/generated/maxval0_s4.c
===================================================================
--- libgfortran/generated/maxval0_s4.c	(Revision 267335)
+++ libgfortran/generated/maxval0_s4.c	(Arbeitskopie)
@@ -150,6 +150,12 @@  mmaxval0_s4 (GFC_UINTEGER_4 * const restrict ret,
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      maxval0_s4 (ret, xlen, array, len);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -247,7 +253,7 @@  smaxval0_s4 (GFC_UINTEGER_4 * restrict ret,
 	GFC_LOGICAL_4 *mask, gfc_charlen_type len)
 	
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxval0_s4 (ret, xlen, array, len);
       return;
Index: libgfortran/generated/maxval1_s1.c
===================================================================
--- libgfortran/generated/maxval1_s1.c	(Revision 267335)
+++ libgfortran/generated/maxval1_s1.c	(Arbeitskopie)
@@ -239,6 +239,12 @@  mmaxval1_s1 (gfc_array_s1 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      maxval1_s1 (retarray, xlen, array, pdim, string_len);
+      return;
+    }
+
   assert (xlen == string_len);
 
   dim = (*pdim) - 1;
@@ -436,7 +442,7 @@  smaxval1_s1 (gfc_array_s1 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxval1_s1 (retarray, xlen, array, pdim, string_len);
       return;
Index: libgfortran/generated/maxval1_s4.c
===================================================================
--- libgfortran/generated/maxval1_s4.c	(Revision 267335)
+++ libgfortran/generated/maxval1_s4.c	(Arbeitskopie)
@@ -239,6 +239,12 @@  mmaxval1_s4 (gfc_array_s4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      maxval1_s4 (retarray, xlen, array, pdim, string_len);
+      return;
+    }
+
   assert (xlen == string_len);
 
   dim = (*pdim) - 1;
@@ -436,7 +442,7 @@  smaxval1_s4 (gfc_array_s4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       maxval1_s4 (retarray, xlen, array, pdim, string_len);
       return;
Index: libgfortran/generated/maxval_i1.c
===================================================================
--- libgfortran/generated/maxval_i1.c	(Revision 267335)
+++ libgfortran/generated/maxval_i1.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_i1 (gfc_array_i1 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_i1 (retarray, array, pdim, back);
+#else
+      maxval_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_i1 (gfc_array_i1 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_i16.c
===================================================================
--- libgfortran/generated/maxval_i16.c	(Revision 267335)
+++ libgfortran/generated/maxval_i16.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_i16 (gfc_array_i16 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_i16 (retarray, array, pdim, back);
+#else
+      maxval_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_i16 (gfc_array_i16 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_i2.c
===================================================================
--- libgfortran/generated/maxval_i2.c	(Revision 267335)
+++ libgfortran/generated/maxval_i2.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_i2 (gfc_array_i2 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_i2 (retarray, array, pdim, back);
+#else
+      maxval_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_i2 (gfc_array_i2 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_i4.c
===================================================================
--- libgfortran/generated/maxval_i4.c	(Revision 267335)
+++ libgfortran/generated/maxval_i4.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_i4 (gfc_array_i4 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_i4 (retarray, array, pdim, back);
+#else
+      maxval_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_i4 (gfc_array_i4 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_i8.c
===================================================================
--- libgfortran/generated/maxval_i8.c	(Revision 267335)
+++ libgfortran/generated/maxval_i8.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_i8 (gfc_array_i8 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_i8 (retarray, array, pdim, back);
+#else
+      maxval_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_i8 (gfc_array_i8 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_r10.c
===================================================================
--- libgfortran/generated/maxval_r10.c	(Revision 267335)
+++ libgfortran/generated/maxval_r10.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_r10 (gfc_array_r10 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_r10 (retarray, array, pdim, back);
+#else
+      maxval_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_r10 (gfc_array_r10 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_r16.c
===================================================================
--- libgfortran/generated/maxval_r16.c	(Revision 267335)
+++ libgfortran/generated/maxval_r16.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_r16 (gfc_array_r16 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_r16 (retarray, array, pdim, back);
+#else
+      maxval_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_r16 (gfc_array_r16 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_r4.c
===================================================================
--- libgfortran/generated/maxval_r4.c	(Revision 267335)
+++ libgfortran/generated/maxval_r4.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_r4 (gfc_array_r4 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_r4 (retarray, array, pdim, back);
+#else
+      maxval_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_r4 (gfc_array_r4 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/maxval_r8.c
===================================================================
--- libgfortran/generated/maxval_r8.c	(Revision 267335)
+++ libgfortran/generated/maxval_r8.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mmaxval_r8 (gfc_array_r8 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      maxval_r8 (retarray, array, pdim, back);
+#else
+      maxval_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  smaxval_r8 (gfc_array_r8 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       maxval_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc0_16_i1.c
===================================================================
--- libgfortran/generated/minloc0_16_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_i1 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_i1 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_i16.c
===================================================================
--- libgfortran/generated/minloc0_16_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_i16 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_i16 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_i2.c
===================================================================
--- libgfortran/generated/minloc0_16_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_i2 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_i2 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_i4.c
===================================================================
--- libgfortran/generated/minloc0_16_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_i4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_i4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_i8.c
===================================================================
--- libgfortran/generated/minloc0_16_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_i8 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_i8 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_r10.c
===================================================================
--- libgfortran/generated/minloc0_16_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_r10 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_r10 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_r16.c
===================================================================
--- libgfortran/generated/minloc0_16_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_r16 (gfc_array_i16 * const restrict re
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_r16 (gfc_array_i16 * const restrict re
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_r4.c
===================================================================
--- libgfortran/generated/minloc0_16_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_r4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_r4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_r8.c
===================================================================
--- libgfortran/generated/minloc0_16_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_16_r8 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_16_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_16_r8 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_16_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_16_s1.c
===================================================================
--- libgfortran/generated/minloc0_16_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_16_s1 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_16_s1 (retarray, array, back, len);
+#else
+      minloc0_16_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_16_s1 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_16_s1 (retarray, array, back, len);
Index: libgfortran/generated/minloc0_16_s4.c
===================================================================
--- libgfortran/generated/minloc0_16_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_16_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_16_s4 (gfc_array_i16 * const restrict ret
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_16_s4 (retarray, array, back, len);
+#else
+      minloc0_16_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_16_s4 (gfc_array_i16 * const restrict ret
   index_type n;
   GFC_INTEGER_16 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_16_s4 (retarray, array, back, len);
Index: libgfortran/generated/minloc0_4_i1.c
===================================================================
--- libgfortran/generated/minloc0_4_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_i1 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_i1 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_i16.c
===================================================================
--- libgfortran/generated/minloc0_4_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_i16 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_i16 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_i2.c
===================================================================
--- libgfortran/generated/minloc0_4_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_i2 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_i2 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_i4.c
===================================================================
--- libgfortran/generated/minloc0_4_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_i4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_i4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_i8.c
===================================================================
--- libgfortran/generated/minloc0_4_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_i8 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_i8 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_r10.c
===================================================================
--- libgfortran/generated/minloc0_4_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_r10 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_r10 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_r16.c
===================================================================
--- libgfortran/generated/minloc0_4_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_r16 (gfc_array_i4 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_r16 (gfc_array_i4 * const restrict reta
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_r4.c
===================================================================
--- libgfortran/generated/minloc0_4_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_r4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_r4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_r8.c
===================================================================
--- libgfortran/generated/minloc0_4_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_4_r8 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_4_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_4_r8 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_4_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_4_s1.c
===================================================================
--- libgfortran/generated/minloc0_4_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_4_s1 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_4_s1 (retarray, array, back, len);
+#else
+      minloc0_4_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_4_s1 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_4_s1 (retarray, array, back, len);
Index: libgfortran/generated/minloc0_4_s4.c
===================================================================
--- libgfortran/generated/minloc0_4_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_4_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_4_s4 (gfc_array_i4 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_4_s4 (retarray, array, back, len);
+#else
+      minloc0_4_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_4_s4 (gfc_array_i4 * const restrict retar
   index_type n;
   GFC_INTEGER_4 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_4_s4 (retarray, array, back, len);
Index: libgfortran/generated/minloc0_8_i1.c
===================================================================
--- libgfortran/generated/minloc0_8_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_i1.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_i1 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_i1 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_i1 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_i1 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_i16.c
===================================================================
--- libgfortran/generated/minloc0_8_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_i16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_i16 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_i16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_i16 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_i16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_i2.c
===================================================================
--- libgfortran/generated/minloc0_8_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_i2.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_i2 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_i2 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_i2 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_i2 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_i4.c
===================================================================
--- libgfortran/generated/minloc0_8_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_i4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_i4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_i4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_i4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_i4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_i8.c
===================================================================
--- libgfortran/generated/minloc0_8_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_i8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_i8 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_i8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_i8 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_i8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_r10.c
===================================================================
--- libgfortran/generated/minloc0_8_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_r10.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_r10 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_r10 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_r10 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_r10 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_r16.c
===================================================================
--- libgfortran/generated/minloc0_8_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_r16.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_r16 (gfc_array_i8 * const restrict reta
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_r16 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_r16 (gfc_array_i8 * const restrict reta
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_r16 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_r4.c
===================================================================
--- libgfortran/generated/minloc0_8_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_r4.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_r4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_r4 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_r4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_r4 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_r8.c
===================================================================
--- libgfortran/generated/minloc0_8_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_r8.c	(Arbeitskopie)
@@ -198,6 +198,13 @@  mminloc0_8_r8 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      minloc0_8_r8 (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -368,7 +375,7 @@  sminloc0_8_r8 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minloc0_8_r8 (retarray, array, back);
       return;
Index: libgfortran/generated/minloc0_8_s1.c
===================================================================
--- libgfortran/generated/minloc0_8_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_s1.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_8_s1 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_8_s1 (retarray, array, back, len);
+#else
+      minloc0_8_s1 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_8_s1 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_8_s1 (retarray, array, back, len);
Index: libgfortran/generated/minloc0_8_s4.c
===================================================================
--- libgfortran/generated/minloc0_8_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc0_8_s4.c	(Arbeitskopie)
@@ -174,6 +174,16 @@  mminloc0_8_s4 (gfc_array_i8 * const restrict retar
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      minloc0_8_s4 (retarray, array, back, len);
+#else
+      minloc0_8_s4 (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -304,7 +314,7 @@  sminloc0_8_s4 (gfc_array_i8 * const restrict retar
   index_type n;
   GFC_INTEGER_8 *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       minloc0_8_s4 (retarray, array, back, len);
Index: libgfortran/generated/minloc1_16_i1.c
===================================================================
--- libgfortran/generated/minloc1_16_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_i1.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_i1 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_i1 (retarray, array, pdim, back);
+#else
+      minloc1_16_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_i1 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_i16.c
===================================================================
--- libgfortran/generated/minloc1_16_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_i16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_i16 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_i16 (retarray, array, pdim, back);
+#else
+      minloc1_16_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_i16 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_i2.c
===================================================================
--- libgfortran/generated/minloc1_16_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_i2.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_i2 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_i2 (retarray, array, pdim, back);
+#else
+      minloc1_16_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_i2 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_i4.c
===================================================================
--- libgfortran/generated/minloc1_16_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_i4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_i4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_i4 (retarray, array, pdim, back);
+#else
+      minloc1_16_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_i4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_i8.c
===================================================================
--- libgfortran/generated/minloc1_16_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_i8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_i8 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_i8 (retarray, array, pdim, back);
+#else
+      minloc1_16_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_i8 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_r10.c
===================================================================
--- libgfortran/generated/minloc1_16_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_r10.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_r10 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_r10 (retarray, array, pdim, back);
+#else
+      minloc1_16_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_r10 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_r16.c
===================================================================
--- libgfortran/generated/minloc1_16_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_r16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_r16 (gfc_array_i16 * const restrict re
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_r16 (retarray, array, pdim, back);
+#else
+      minloc1_16_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_r16 (gfc_array_i16 * const restrict re
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_r4.c
===================================================================
--- libgfortran/generated/minloc1_16_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_r4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_r4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_r4 (retarray, array, pdim, back);
+#else
+      minloc1_16_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_r4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_r8.c
===================================================================
--- libgfortran/generated/minloc1_16_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_r8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_16_r8 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_r8 (retarray, array, pdim, back);
+#else
+      minloc1_16_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_16_r8 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_16_s1.c
===================================================================
--- libgfortran/generated/minloc1_16_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_16_s1 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_s1 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_16_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_16_s1 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minloc1_16_s4.c
===================================================================
--- libgfortran/generated/minloc1_16_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_16_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_16_s4 (gfc_array_i16 * const restrict ret
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_16_s4 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_16_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_16_s4 (gfc_array_i16 * const restrict ret
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_16_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minloc1_4_i1.c
===================================================================
--- libgfortran/generated/minloc1_4_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_i1.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_i1 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_i1 (retarray, array, pdim, back);
+#else
+      minloc1_4_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_i1 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_i16.c
===================================================================
--- libgfortran/generated/minloc1_4_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_i16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_i16 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_i16 (retarray, array, pdim, back);
+#else
+      minloc1_4_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_i16 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_i2.c
===================================================================
--- libgfortran/generated/minloc1_4_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_i2.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_i2 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_i2 (retarray, array, pdim, back);
+#else
+      minloc1_4_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_i2 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_i4.c
===================================================================
--- libgfortran/generated/minloc1_4_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_i4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_i4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_i4 (retarray, array, pdim, back);
+#else
+      minloc1_4_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_i4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_i8.c
===================================================================
--- libgfortran/generated/minloc1_4_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_i8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_i8 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_i8 (retarray, array, pdim, back);
+#else
+      minloc1_4_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_i8 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_r10.c
===================================================================
--- libgfortran/generated/minloc1_4_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_r10.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_r10 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_r10 (retarray, array, pdim, back);
+#else
+      minloc1_4_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_r10 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_r16.c
===================================================================
--- libgfortran/generated/minloc1_4_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_r16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_r16 (gfc_array_i4 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_r16 (retarray, array, pdim, back);
+#else
+      minloc1_4_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_r16 (gfc_array_i4 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_r4.c
===================================================================
--- libgfortran/generated/minloc1_4_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_r4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_r4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_r4 (retarray, array, pdim, back);
+#else
+      minloc1_4_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_r4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_r8.c
===================================================================
--- libgfortran/generated/minloc1_4_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_r8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_4_r8 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_r8 (retarray, array, pdim, back);
+#else
+      minloc1_4_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_4_r8 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_4_s1.c
===================================================================
--- libgfortran/generated/minloc1_4_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_4_s1 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_s1 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_4_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_4_s1 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minloc1_4_s4.c
===================================================================
--- libgfortran/generated/minloc1_4_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_4_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_4_s4 (gfc_array_i4 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_4_s4 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_4_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_4_s4 (gfc_array_i4 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_4_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minloc1_8_i1.c
===================================================================
--- libgfortran/generated/minloc1_8_i1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_i1.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_i1 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i1 (retarray, array, pdim, back);
+#else
+      minloc1_8_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_i1 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_i16.c
===================================================================
--- libgfortran/generated/minloc1_8_i16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_i16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_i16 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i16 (retarray, array, pdim, back);
+#else
+      minloc1_8_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_i16 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_i2.c
===================================================================
--- libgfortran/generated/minloc1_8_i2.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_i2.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_i2 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i2 (retarray, array, pdim, back);
+#else
+      minloc1_8_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_i2 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_i4.c
===================================================================
--- libgfortran/generated/minloc1_8_i4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_i4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_i4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i4 (retarray, array, pdim, back);
+#else
+      minloc1_8_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_i4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_i8.c
===================================================================
--- libgfortran/generated/minloc1_8_i8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_i8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_i8 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_i8 (retarray, array, pdim, back);
+#else
+      minloc1_8_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_i8 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_r10.c
===================================================================
--- libgfortran/generated/minloc1_8_r10.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_r10.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_r10 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_r10 (retarray, array, pdim, back);
+#else
+      minloc1_8_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_r10 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_r16.c
===================================================================
--- libgfortran/generated/minloc1_8_r16.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_r16.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_r16 (gfc_array_i8 * const restrict reta
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_r16 (retarray, array, pdim, back);
+#else
+      minloc1_8_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_r16 (gfc_array_i8 * const restrict reta
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_r4.c
===================================================================
--- libgfortran/generated/minloc1_8_r4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_r4.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_r4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_r4 (retarray, array, pdim, back);
+#else
+      minloc1_8_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_r4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_r8.c
===================================================================
--- libgfortran/generated/minloc1_8_r8.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_r8.c	(Arbeitskopie)
@@ -258,6 +258,16 @@  mminloc1_8_r8 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_r8 (retarray, array, pdim, back);
+#else
+      minloc1_8_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -480,7 +490,7 @@  sminloc1_8_r8 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/minloc1_8_s1.c
===================================================================
--- libgfortran/generated/minloc1_8_s1.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_s1.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_8_s1 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_s1 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_8_s1 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_8_s1 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_s1 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minloc1_8_s4.c
===================================================================
--- libgfortran/generated/minloc1_8_s4.c	(Revision 267335)
+++ libgfortran/generated/minloc1_8_s4.c	(Arbeitskopie)
@@ -241,6 +241,16 @@  mminloc1_8_s4 (gfc_array_i8 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minloc1_8_s4 (retarray, array, pdim, back, string_len);
+#else
+      minloc1_8_s4 (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -436,7 +446,7 @@  sminloc1_8_s4 (gfc_array_i8 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minloc1_8_s4 (retarray, array, pdim, back, string_len);
Index: libgfortran/generated/minval0_s1.c
===================================================================
--- libgfortran/generated/minval0_s1.c	(Revision 267335)
+++ libgfortran/generated/minval0_s1.c	(Arbeitskopie)
@@ -150,6 +150,12 @@  mminval0_s1 (GFC_UINTEGER_1 * const restrict ret,
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      minval0_s1 (ret, xlen, array, len);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -247,7 +253,7 @@  sminval0_s1 (GFC_UINTEGER_1 * restrict ret,
 	GFC_LOGICAL_4 *mask, gfc_charlen_type len)
 	
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minval0_s1 (ret, xlen, array, len);
       return;
Index: libgfortran/generated/minval0_s4.c
===================================================================
--- libgfortran/generated/minval0_s4.c	(Revision 267335)
+++ libgfortran/generated/minval0_s4.c	(Arbeitskopie)
@@ -150,6 +150,12 @@  mminval0_s4 (GFC_UINTEGER_4 * const restrict ret,
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      minval0_s4 (ret, xlen, array, len);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -247,7 +253,7 @@  sminval0_s4 (GFC_UINTEGER_4 * restrict ret,
 	GFC_LOGICAL_4 *mask, gfc_charlen_type len)
 	
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minval0_s4 (ret, xlen, array, len);
       return;
Index: libgfortran/generated/minval1_s1.c
===================================================================
--- libgfortran/generated/minval1_s1.c	(Revision 267335)
+++ libgfortran/generated/minval1_s1.c	(Arbeitskopie)
@@ -239,6 +239,12 @@  mminval1_s1 (gfc_array_s1 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      minval1_s1 (retarray, xlen, array, pdim, string_len);
+      return;
+    }
+
   assert (xlen == string_len);
 
   dim = (*pdim) - 1;
@@ -436,7 +442,7 @@  sminval1_s1 (gfc_array_s1 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minval1_s1 (retarray, xlen, array, pdim, string_len);
       return;
Index: libgfortran/generated/minval1_s4.c
===================================================================
--- libgfortran/generated/minval1_s4.c	(Revision 267335)
+++ libgfortran/generated/minval1_s4.c	(Arbeitskopie)
@@ -239,6 +239,12 @@  mminval1_s4 (gfc_array_s4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      minval1_s4 (retarray, xlen, array, pdim, string_len);
+      return;
+    }
+
   assert (xlen == string_len);
 
   dim = (*pdim) - 1;
@@ -436,7 +442,7 @@  sminval1_s4 (gfc_array_s4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       minval1_s4 (retarray, xlen, array, pdim, string_len);
       return;
Index: libgfortran/generated/minval_i1.c
===================================================================
--- libgfortran/generated/minval_i1.c	(Revision 267335)
+++ libgfortran/generated/minval_i1.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_i1 (gfc_array_i1 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_i1 (retarray, array, pdim, back);
+#else
+      minval_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_i1 (gfc_array_i1 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_i16.c
===================================================================
--- libgfortran/generated/minval_i16.c	(Revision 267335)
+++ libgfortran/generated/minval_i16.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_i16 (gfc_array_i16 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_i16 (retarray, array, pdim, back);
+#else
+      minval_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_i16 (gfc_array_i16 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_i2.c
===================================================================
--- libgfortran/generated/minval_i2.c	(Revision 267335)
+++ libgfortran/generated/minval_i2.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_i2 (gfc_array_i2 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_i2 (retarray, array, pdim, back);
+#else
+      minval_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_i2 (gfc_array_i2 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_i4.c
===================================================================
--- libgfortran/generated/minval_i4.c	(Revision 267335)
+++ libgfortran/generated/minval_i4.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_i4 (gfc_array_i4 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_i4 (retarray, array, pdim, back);
+#else
+      minval_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_i4 (gfc_array_i4 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_i8.c
===================================================================
--- libgfortran/generated/minval_i8.c	(Revision 267335)
+++ libgfortran/generated/minval_i8.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_i8 (gfc_array_i8 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_i8 (retarray, array, pdim, back);
+#else
+      minval_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_i8 (gfc_array_i8 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_r10.c
===================================================================
--- libgfortran/generated/minval_r10.c	(Revision 267335)
+++ libgfortran/generated/minval_r10.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_r10 (gfc_array_r10 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_r10 (retarray, array, pdim, back);
+#else
+      minval_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_r10 (gfc_array_r10 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_r16.c
===================================================================
--- libgfortran/generated/minval_r16.c	(Revision 267335)
+++ libgfortran/generated/minval_r16.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_r16 (gfc_array_r16 * const restrict retarr
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_r16 (retarray, array, pdim, back);
+#else
+      minval_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_r16 (gfc_array_r16 * const restrict retarr
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_r4.c
===================================================================
--- libgfortran/generated/minval_r4.c	(Revision 267335)
+++ libgfortran/generated/minval_r4.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_r4 (gfc_array_r4 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_r4 (retarray, array, pdim, back);
+#else
+      minval_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_r4 (gfc_array_r4 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/minval_r8.c
===================================================================
--- libgfortran/generated/minval_r8.c	(Revision 267335)
+++ libgfortran/generated/minval_r8.c	(Arbeitskopie)
@@ -234,6 +234,16 @@  mminval_r8 (gfc_array_r8 * const restrict retarray
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      minval_r8 (retarray, array, pdim, back);
+#else
+      minval_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -441,7 +451,7 @@  sminval_r8 (gfc_array_r8 * const restrict retarray
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       minval_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/product_c10.c
===================================================================
--- libgfortran/generated/product_c10.c	(Revision 267335)
+++ libgfortran/generated/product_c10.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_c10 (gfc_array_c10 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_c10 (retarray, array, pdim, back);
+#else
+      product_c10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_c10 (gfc_array_c10 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_c10 (retarray, array, pdim, back);
Index: libgfortran/generated/product_c16.c
===================================================================
--- libgfortran/generated/product_c16.c	(Revision 267335)
+++ libgfortran/generated/product_c16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_c16 (gfc_array_c16 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_c16 (retarray, array, pdim, back);
+#else
+      product_c16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_c16 (gfc_array_c16 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_c16 (retarray, array, pdim, back);
Index: libgfortran/generated/product_c4.c
===================================================================
--- libgfortran/generated/product_c4.c	(Revision 267335)
+++ libgfortran/generated/product_c4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_c4 (gfc_array_c4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_c4 (retarray, array, pdim, back);
+#else
+      product_c4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_c4 (gfc_array_c4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_c4 (retarray, array, pdim, back);
Index: libgfortran/generated/product_c8.c
===================================================================
--- libgfortran/generated/product_c8.c	(Revision 267335)
+++ libgfortran/generated/product_c8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_c8 (gfc_array_c8 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_c8 (retarray, array, pdim, back);
+#else
+      product_c8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_c8 (gfc_array_c8 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_c8 (retarray, array, pdim, back);
Index: libgfortran/generated/product_i1.c
===================================================================
--- libgfortran/generated/product_i1.c	(Revision 267335)
+++ libgfortran/generated/product_i1.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_i1 (gfc_array_i1 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_i1 (retarray, array, pdim, back);
+#else
+      product_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_i1 (gfc_array_i1 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/product_i16.c
===================================================================
--- libgfortran/generated/product_i16.c	(Revision 267335)
+++ libgfortran/generated/product_i16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_i16 (gfc_array_i16 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_i16 (retarray, array, pdim, back);
+#else
+      product_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_i16 (gfc_array_i16 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/product_i2.c
===================================================================
--- libgfortran/generated/product_i2.c	(Revision 267335)
+++ libgfortran/generated/product_i2.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_i2 (gfc_array_i2 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_i2 (retarray, array, pdim, back);
+#else
+      product_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_i2 (gfc_array_i2 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/product_i4.c
===================================================================
--- libgfortran/generated/product_i4.c	(Revision 267335)
+++ libgfortran/generated/product_i4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_i4 (gfc_array_i4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_i4 (retarray, array, pdim, back);
+#else
+      product_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_i4 (gfc_array_i4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/product_i8.c
===================================================================
--- libgfortran/generated/product_i8.c	(Revision 267335)
+++ libgfortran/generated/product_i8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_i8 (gfc_array_i8 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_i8 (retarray, array, pdim, back);
+#else
+      product_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_i8 (gfc_array_i8 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/product_r10.c
===================================================================
--- libgfortran/generated/product_r10.c	(Revision 267335)
+++ libgfortran/generated/product_r10.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_r10 (gfc_array_r10 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_r10 (retarray, array, pdim, back);
+#else
+      product_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_r10 (gfc_array_r10 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/product_r16.c
===================================================================
--- libgfortran/generated/product_r16.c	(Revision 267335)
+++ libgfortran/generated/product_r16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_r16 (gfc_array_r16 * const restrict retar
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_r16 (retarray, array, pdim, back);
+#else
+      product_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_r16 (gfc_array_r16 * const restrict retar
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/product_r4.c
===================================================================
--- libgfortran/generated/product_r4.c	(Revision 267335)
+++ libgfortran/generated/product_r4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_r4 (gfc_array_r4 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_r4 (retarray, array, pdim, back);
+#else
+      product_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_r4 (gfc_array_r4 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/product_r8.c
===================================================================
--- libgfortran/generated/product_r8.c	(Revision 267335)
+++ libgfortran/generated/product_r8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  mproduct_r8 (gfc_array_r8 * const restrict retarra
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      product_r8 (retarray, array, pdim, back);
+#else
+      product_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  sproduct_r8 (gfc_array_r8 * const restrict retarra
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       product_r8 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_c10.c
===================================================================
--- libgfortran/generated/sum_c10.c	(Revision 267335)
+++ libgfortran/generated/sum_c10.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_c10 (gfc_array_c10 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_c10 (retarray, array, pdim, back);
+#else
+      sum_c10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_c10 (gfc_array_c10 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_c10 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_c16.c
===================================================================
--- libgfortran/generated/sum_c16.c	(Revision 267335)
+++ libgfortran/generated/sum_c16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_c16 (gfc_array_c16 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_c16 (retarray, array, pdim, back);
+#else
+      sum_c16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_c16 (gfc_array_c16 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_c16 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_c4.c
===================================================================
--- libgfortran/generated/sum_c4.c	(Revision 267335)
+++ libgfortran/generated/sum_c4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_c4 (gfc_array_c4 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_c4 (retarray, array, pdim, back);
+#else
+      sum_c4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_c4 (gfc_array_c4 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_c4 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_c8.c
===================================================================
--- libgfortran/generated/sum_c8.c	(Revision 267335)
+++ libgfortran/generated/sum_c8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_c8 (gfc_array_c8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_c8 (retarray, array, pdim, back);
+#else
+      sum_c8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_c8 (gfc_array_c8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_c8 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_i1.c
===================================================================
--- libgfortran/generated/sum_i1.c	(Revision 267335)
+++ libgfortran/generated/sum_i1.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_i1 (gfc_array_i1 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_i1 (retarray, array, pdim, back);
+#else
+      sum_i1 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_i1 (gfc_array_i1 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_i1 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_i16.c
===================================================================
--- libgfortran/generated/sum_i16.c	(Revision 267335)
+++ libgfortran/generated/sum_i16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_i16 (gfc_array_i16 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_i16 (retarray, array, pdim, back);
+#else
+      sum_i16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_i16 (gfc_array_i16 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_i16 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_i2.c
===================================================================
--- libgfortran/generated/sum_i2.c	(Revision 267335)
+++ libgfortran/generated/sum_i2.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_i2 (gfc_array_i2 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_i2 (retarray, array, pdim, back);
+#else
+      sum_i2 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_i2 (gfc_array_i2 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_i2 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_i4.c
===================================================================
--- libgfortran/generated/sum_i4.c	(Revision 267335)
+++ libgfortran/generated/sum_i4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_i4 (gfc_array_i4 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_i4 (retarray, array, pdim, back);
+#else
+      sum_i4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_i4 (gfc_array_i4 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_i4 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_i8.c
===================================================================
--- libgfortran/generated/sum_i8.c	(Revision 267335)
+++ libgfortran/generated/sum_i8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_i8 (gfc_array_i8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_i8 (retarray, array, pdim, back);
+#else
+      sum_i8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_i8 (gfc_array_i8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_i8 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_r10.c
===================================================================
--- libgfortran/generated/sum_r10.c	(Revision 267335)
+++ libgfortran/generated/sum_r10.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_r10 (gfc_array_r10 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_r10 (retarray, array, pdim, back);
+#else
+      sum_r10 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_r10 (gfc_array_r10 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_r10 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_r16.c
===================================================================
--- libgfortran/generated/sum_r16.c	(Revision 267335)
+++ libgfortran/generated/sum_r16.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_r16 (gfc_array_r16 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_r16 (retarray, array, pdim, back);
+#else
+      sum_r16 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_r16 (gfc_array_r16 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_r16 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_r4.c
===================================================================
--- libgfortran/generated/sum_r4.c	(Revision 267335)
+++ libgfortran/generated/sum_r4.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_r4 (gfc_array_r4 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_r4 (retarray, array, pdim, back);
+#else
+      sum_r4 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_r4 (gfc_array_r4 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_r4 (retarray, array, pdim, back);
Index: libgfortran/generated/sum_r8.c
===================================================================
--- libgfortran/generated/sum_r8.c	(Revision 267335)
+++ libgfortran/generated/sum_r8.c	(Arbeitskopie)
@@ -220,6 +220,16 @@  msum_r8 (gfc_array_r8 * const restrict retarray,
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      sum_r8 (retarray, array, pdim, back);
+#else
+      sum_r8 (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -399,7 +409,7 @@  ssum_r8 (gfc_array_r8 * const restrict retarray,
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       sum_r8 (retarray, array, pdim, back);
Index: libgfortran/m4/ifindloc0.m4
===================================================================
--- libgfortran/m4/ifindloc0.m4	(Revision 267335)
+++ libgfortran/m4/ifindloc0.m4	(Arbeitskopie)
@@ -317,7 +317,7 @@  see the files COPYING3 and COPYING.RUNTIME respect
   index_type * restrict dest;
   index_type n;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc0_'atype_code` (retarray, array, value, back'len_arg`);
       return;
Index: libgfortran/m4/ifindloc1.m4
===================================================================
--- libgfortran/m4/ifindloc1.m4	(Revision 267335)
+++ libgfortran/m4/ifindloc1.m4	(Arbeitskopie)
@@ -379,7 +379,7 @@  see the files COPYING3 and COPYING.RUNTIME respect
   index_type dim;
   bool continue_loop;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       findloc1_'atype_code`'` (retarray, array, value, pdim, back'len_arg`'`);
       return;
Index: libgfortran/m4/ifindloc2.m4
===================================================================
--- libgfortran/m4/ifindloc2.m4	(Revision 267335)
+++ libgfortran/m4/ifindloc2.m4	(Arbeitskopie)
@@ -117,7 +117,7 @@  see the files COPYING3 and COPYING.RUNTIME respect
 }
 'header3`'`
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       return findloc2_'atype_code` (array, value, back, len_array, len_value);
     }
Index: libgfortran/m4/iforeach-s.m4
===================================================================
--- libgfortran/m4/iforeach-s.m4	(Revision 267335)
+++ libgfortran/m4/iforeach-s.m4	(Arbeitskopie)
@@ -135,6 +135,16 @@  m'name`'rtype_qual`_'atype_code` ('rtype` * const
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG    
+      name`'rtype_qual`_'atype_code (retarray, array, back, len);
+#else
+      name`'rtype_qual`_'atype_code (retarray, array, len);
+#endif
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -261,7 +271,7 @@  void
   index_type n;
   'rtype_name *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG    
       name`'rtype_qual`_'atype_code (retarray, array, back, len);
Index: libgfortran/m4/iforeach-s2.m4
===================================================================
--- libgfortran/m4/iforeach-s2.m4	(Revision 267335)
+++ libgfortran/m4/iforeach-s2.m4	(Arbeitskopie)
@@ -116,6 +116,12 @@  void
   index_type n;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      name`'rtype_qual`_'atype_code (ret, xlen, array, len);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -213,7 +219,7 @@  void
 	GFC_LOGICAL_4 *mask, gfc_charlen_type len)
 	
 {
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       name`'rtype_qual`_'atype_code (ret, xlen, array, len);
       return;
Index: libgfortran/m4/iforeach.m4
===================================================================
--- libgfortran/m4/iforeach.m4	(Revision 267335)
+++ libgfortran/m4/iforeach.m4	(Arbeitskopie)
@@ -123,6 +123,13 @@  void
   index_type n;
   int mask_kind;
 
+
+  if (mask == NULL)
+    {
+      name`'rtype_qual`_'atype_code (retarray, array, back);
+      return;
+    }
+
   rank = GFC_DESCRIPTOR_RANK (array);
   if (rank <= 0)
     runtime_error ("Rank of array needs to be > 0");
@@ -247,7 +254,7 @@  void
   index_type n;
   rtype_name *dest;
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       name`'rtype_qual`_'atype_code (retarray, array, back);
       return;
Index: libgfortran/m4/ifunction-s.m4
===================================================================
--- libgfortran/m4/ifunction-s.m4	(Revision 267335)
+++ libgfortran/m4/ifunction-s.m4	(Arbeitskopie)
@@ -222,6 +222,16 @@  m'name`'rtype_qual`_'atype_code` ('rtype` * const
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      name`'rtype_qual`_'atype_code (retarray, array, pdim, back, string_len);
+#else
+      name`'rtype_qual`_'atype_code (retarray, array, pdim, string_len);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -400,7 +410,7 @@  s'name`'rtype_qual`_'atype_code` ('rtype` * const
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       name`'rtype_qual`_'atype_code (retarray, array, pdim, back, string_len);
Index: libgfortran/m4/ifunction-s2.m4
===================================================================
--- libgfortran/m4/ifunction-s2.m4	(Revision 267335)
+++ libgfortran/m4/ifunction-s2.m4	(Arbeitskopie)
@@ -225,6 +225,12 @@  void
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+      name`'rtype_qual`_'atype_code (retarray, xlen, array, pdim, string_len);
+      return;
+    }
+
   assert (xlen == string_len);
 
   dim = (*pdim) - 1;
@@ -408,7 +414,7 @@  void
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
       name`'rtype_qual`_'atype_code (retarray, xlen, array, pdim, string_len);
       return;
Index: libgfortran/m4/ifunction.m4
===================================================================
--- libgfortran/m4/ifunction.m4	(Revision 267335)
+++ libgfortran/m4/ifunction.m4	(Arbeitskopie)
@@ -210,6 +210,16 @@  m'name`'rtype_qual`_'atype_code` ('rtype` * const
   index_type mdelta;
   int mask_kind;
 
+  if (mask == NULL)
+    {
+#ifdef HAVE_BACK_ARG
+      name`'rtype_qual`_'atype_code (retarray, array, pdim, back);
+#else
+      name`'rtype_qual`_'atype_code (retarray, array, pdim);
+#endif
+      return;
+    }
+
   dim = (*pdim) - 1;
   rank = GFC_DESCRIPTOR_RANK (array) - 1;
 
@@ -388,7 +398,7 @@  void
   index_type dim;
 
 
-  if (*mask)
+  if (mask == NULL || *mask)
     {
 #ifdef HAVE_BACK_ARG
       name`'rtype_qual`_'atype_code (retarray, array, pdim, back);