diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 145d10be62f0c6e664e26ba501b42060437cdb2a..0a8c4438a9b1ac30dd21b4eae9325a15e97c1953 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,40 @@
+2005-10-03  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	PR fortran/20120
+	* f95-lang.c (DO_DEFINE_MATH_BUILTIN): Add support for long
+	double builtin function.
+	(gfc_init_builtin_functions): Add mfunc_longdouble,
+	mfunc_clongdouble and func_clongdouble_longdouble trees. Build
+	them for round, trunc, cabs, copysign and pow functions.
+	* iresolve.c (gfc_resolve_reshape, gfc_resolve_transpose): Add
+	case for kind 10 and 16.
+	* trans-decl.c: Add trees for cpowl10, cpowl16, ishftc16,
+	exponent10 and exponent16.
+	(gfc_build_intrinsic_function_decls): Build nodes for int16,
+	real10, real16, complex10 and complex16 types. Build all possible
+	combinations for function _gfortran_pow_?n_?n. Build function
+	calls cpowl10, cpowl16, ishftc16, exponent10 and exponent16.
+	* trans-expr.c (gfc_conv_power_op): Add case for integer(16),
+	real(10) and real(16).
+	* trans-intrinsic.c: Add suppport for long double builtin
+	functions in BUILT_IN_FUNCTION, LIBM_FUNCTION and LIBF_FUNCTION
+	macros.
+	(gfc_conv_intrinsic_aint): Add case for integer(16), real(10) and
+	real(16) kinds.
+	(gfc_build_intrinsic_lib_fndecls): Add support for real10_decl
+	and real16_decl in library functions.
+	(gfc_get_intrinsic_lib_fndecl): Add cases for real and complex
+	kinds 10 and 16.
+	(gfc_conv_intrinsic_exponent): Add cases for real(10) and real(16)
+	kinds.
+	(gfc_conv_intrinsic_sign): Likewise.
+	(gfc_conv_intrinsic_ishftc): Add case for integer(16) kind.
+	* trans-types.c (gfc_get_int_type, gfc_get_real_type,
+	gfc_get_complex_type, gfc_get_logical_type): Doesn't error out in
+	the case of kinds not available.
+	* trans.h: Declare trees for cpowl10, cpowl16, ishftc16,
+	exponent10 and exponent16.
+
 2005-10-01  Paul Thomas  <pault@gcc.gnu.org>
 
 	PR fortran/16404
diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c
index 6e607e9fa8ebdca03789bdb67039e9d44391ddd8..b28980b33617364b689d1c26bf6ecd00d81fc809 100644
--- a/gcc/fortran/f95-lang.c
+++ b/gcc/fortran/f95-lang.c
@@ -718,6 +718,8 @@ gfc_define_builtin (const char * name,
 
 
 #define DO_DEFINE_MATH_BUILTIN(code, name, argtype, tbase) \
+    gfc_define_builtin ("__builtin_" name "l", tbase##longdouble[argtype], \
+                       BUILT_IN_ ## code ## L, name "l", true); \
     gfc_define_builtin ("__builtin_" name, tbase##double[argtype], \
 			BUILT_IN_ ## code, name, true); \
     gfc_define_builtin ("__builtin_" name "f", tbase##float[argtype], \
@@ -726,11 +728,9 @@ gfc_define_builtin (const char * name,
 #define DEFINE_MATH_BUILTIN(code, name, argtype) \
     DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_)
 
-/* The middle-end is missing builtins for some complex math functions, so
-   we don't use them yet.  */
 #define DEFINE_MATH_BUILTIN_C(code, name, argtype) \
-    DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_)
-/*    DO_DEFINE_MATH_BUILTIN (C##code, "c" name, argtype, mfunc_c)*/
+    DO_DEFINE_MATH_BUILTIN (code, name, argtype, mfunc_) \
+    DO_DEFINE_MATH_BUILTIN (C##code, "c" name, argtype, mfunc_c)
 
 
 /* Create function types for builtin functions.  */
@@ -760,17 +760,22 @@ gfc_init_builtin_functions (void)
 {
   tree mfunc_float[3];
   tree mfunc_double[3];
+  tree mfunc_longdouble[3];
   tree mfunc_cfloat[3];
   tree mfunc_cdouble[3];
+  tree mfunc_clongdouble[3];
   tree func_cfloat_float;
   tree func_cdouble_double;
+  tree func_clongdouble_longdouble;
   tree ftype;
   tree tmp;
 
   build_builtin_fntypes (mfunc_float, float_type_node);
   build_builtin_fntypes (mfunc_double, double_type_node);
+  build_builtin_fntypes (mfunc_longdouble, long_double_type_node);
   build_builtin_fntypes (mfunc_cfloat, complex_float_type_node);
   build_builtin_fntypes (mfunc_cdouble, complex_double_type_node);
+  build_builtin_fntypes (mfunc_clongdouble, complex_long_double_type_node);
 
   tmp = tree_cons (NULL_TREE, complex_float_type_node, void_list_node);
   func_cfloat_float = build_function_type (float_type_node, tmp);
@@ -778,30 +783,45 @@ gfc_init_builtin_functions (void)
   tmp = tree_cons (NULL_TREE, complex_double_type_node, void_list_node);
   func_cdouble_double = build_function_type (double_type_node, tmp);
 
+  tmp = tree_cons (NULL_TREE, complex_long_double_type_node, void_list_node);
+  func_clongdouble_longdouble =
+    build_function_type (long_double_type_node, tmp);
+
 #include "mathbuiltins.def"
 
   /* We define these separately as the fortran versions have different
      semantics (they return an integer type) */
+  gfc_define_builtin ("__builtin_roundl", mfunc_longdouble[0], 
+		      BUILT_IN_ROUNDL, "roundl", true);
   gfc_define_builtin ("__builtin_round", mfunc_double[0], 
 		      BUILT_IN_ROUND, "round", true);
   gfc_define_builtin ("__builtin_roundf", mfunc_float[0], 
 		      BUILT_IN_ROUNDF, "roundf", true);
+
+  gfc_define_builtin ("__builtin_truncl", mfunc_longdouble[0],
+		      BUILT_IN_TRUNCL, "truncl", true);
   gfc_define_builtin ("__builtin_trunc", mfunc_double[0],
                       BUILT_IN_TRUNC, "trunc", true);
   gfc_define_builtin ("__builtin_truncf", mfunc_float[0],
                       BUILT_IN_TRUNCF, "truncf", true);
 
+  gfc_define_builtin ("__builtin_cabsl", func_clongdouble_longdouble, 
+		      BUILT_IN_CABSL, "cabsl", true);
   gfc_define_builtin ("__builtin_cabs", func_cdouble_double, 
 		      BUILT_IN_CABS, "cabs", true);
   gfc_define_builtin ("__builtin_cabsf", func_cfloat_float, 
 		      BUILT_IN_CABSF, "cabsf", true);
  
+  gfc_define_builtin ("__builtin_copysignl", mfunc_longdouble[1], 
+		      BUILT_IN_COPYSIGNL, "copysignl", true);
   gfc_define_builtin ("__builtin_copysign", mfunc_double[1], 
 		      BUILT_IN_COPYSIGN, "copysign", true);
   gfc_define_builtin ("__builtin_copysignf", mfunc_float[1], 
 		      BUILT_IN_COPYSIGNF, "copysignf", true);
 
   /* These are used to implement the ** operator.  */
+  gfc_define_builtin ("__builtin_powl", mfunc_longdouble[1], 
+		      BUILT_IN_POWL, "powl", true);
   gfc_define_builtin ("__builtin_pow", mfunc_double[1], 
 		      BUILT_IN_POW, "pow", true);
   gfc_define_builtin ("__builtin_powf", mfunc_float[1], 
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index dda6acbf5df26abe70bc1cdada53ad91e13c8d4d..195f05ed990e3635bb1c4284ad91549594bcb18d 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1217,7 +1217,8 @@ gfc_resolve_reshape (gfc_expr * f, gfc_expr * source, gfc_expr * shape,
     {
     case 4:
     case 8:
-    /* case 16: */
+    case 10:
+    case 16:
       if (source->ts.type == BT_COMPLEX)
 	f->value.function.name =
 	  gfc_get_string (PREFIX("reshape_%c%d"),
@@ -1538,6 +1539,8 @@ gfc_resolve_transpose (gfc_expr * f, gfc_expr * matrix)
     {
     case 4:
     case 8:
+    case 10:
+    case 16:
       switch (matrix->ts.type)
         {
         case BT_COMPLEX:
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 73e02f0cc4a4c354d32889e0f75015411ce6ef3a..3f656ddc01fc8055840c35565ed747a7fe933fd8 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -94,13 +94,18 @@ tree gfor_fndecl_associated;
 /* Math functions.  Many other math functions are handled in
    trans-intrinsic.c.  */
 
-gfc_powdecl_list gfor_fndecl_math_powi[3][2];
+gfc_powdecl_list gfor_fndecl_math_powi[4][3];
 tree gfor_fndecl_math_cpowf;
 tree gfor_fndecl_math_cpow;
+tree gfor_fndecl_math_cpowl10;
+tree gfor_fndecl_math_cpowl16;
 tree gfor_fndecl_math_ishftc4;
 tree gfor_fndecl_math_ishftc8;
+tree gfor_fndecl_math_ishftc16;
 tree gfor_fndecl_math_exponent4;
 tree gfor_fndecl_math_exponent8;
+tree gfor_fndecl_math_exponent10;
+tree gfor_fndecl_math_exponent16;
 
 
 /* String functions.  */
@@ -1691,11 +1696,16 @@ gfc_build_intrinsic_function_decls (void)
 {
   tree gfc_int4_type_node = gfc_get_int_type (4);
   tree gfc_int8_type_node = gfc_get_int_type (8);
+  tree gfc_int16_type_node = gfc_get_int_type (16);
   tree gfc_logical4_type_node = gfc_get_logical_type (4);
   tree gfc_real4_type_node = gfc_get_real_type (4);
   tree gfc_real8_type_node = gfc_get_real_type (8);
+  tree gfc_real10_type_node = gfc_get_real_type (10);
+  tree gfc_real16_type_node = gfc_get_real_type (16);
   tree gfc_complex4_type_node = gfc_get_complex_type (4);
   tree gfc_complex8_type_node = gfc_get_complex_type (8);
+  tree gfc_complex10_type_node = gfc_get_complex_type (10);
+  tree gfc_complex16_type_node = gfc_get_complex_type (16);
 
   /* String functions.  */
   gfor_fndecl_copy_string =
@@ -1793,37 +1803,56 @@ gfc_build_intrinsic_function_decls (void)
 
   /* Power functions.  */
   {
-    tree type;
-    tree itype;
-    int kind;
-    int ikind;
-    static int kinds[2] = {4, 8};
-    char name[PREFIX_LEN + 10]; /* _gfortran_pow_?n_?n */
-
-    for (ikind=0; ikind < 2; ikind++)
+    tree ctype, rtype, itype, jtype;
+    int rkind, ikind, jkind;
+#define NIKINDS 3
+#define NRKINDS 4
+    static int ikinds[NIKINDS] = {4, 8, 16};
+    static int rkinds[NRKINDS] = {4, 8, 10, 16};
+    char name[PREFIX_LEN + 12]; /* _gfortran_pow_?n_?n */
+
+    for (ikind=0; ikind < NIKINDS; ikind++)
       {
-	itype = gfc_get_int_type (kinds[ikind]);
-	for (kind = 0; kind < 2; kind ++)
+	itype = gfc_get_int_type (ikinds[ikind]);
+
+	for (jkind=0; jkind < NIKINDS; jkind++)
+	  {
+	    jtype = gfc_get_int_type (ikinds[jkind]);
+	    if (itype && jtype)
+	      {
+		sprintf(name, PREFIX("pow_i%d_i%d"), ikinds[ikind],
+			ikinds[jkind]);
+		gfor_fndecl_math_powi[jkind][ikind].integer =
+		  gfc_build_library_function_decl (get_identifier (name),
+		    jtype, 2, jtype, itype);
+	      }
+	  }
+
+	for (rkind = 0; rkind < NRKINDS; rkind ++)
 	  {
-	    type = gfc_get_int_type (kinds[kind]);
-	    sprintf(name, PREFIX("pow_i%d_i%d"), kinds[kind], kinds[ikind]);
-	    gfor_fndecl_math_powi[kind][ikind].integer =
-	      gfc_build_library_function_decl (get_identifier (name),
-		  type, 2, type, itype);
-
-	    type = gfc_get_real_type (kinds[kind]);
-	    sprintf(name, PREFIX("pow_r%d_i%d"), kinds[kind], kinds[ikind]);
-	    gfor_fndecl_math_powi[kind][ikind].real =
-	      gfc_build_library_function_decl (get_identifier (name),
-		  type, 2, type, itype);
-
-	    type = gfc_get_complex_type (kinds[kind]);
-	    sprintf(name, PREFIX("pow_c%d_i%d"), kinds[kind], kinds[ikind]);
-	    gfor_fndecl_math_powi[kind][ikind].cmplx =
-	      gfc_build_library_function_decl (get_identifier (name),
-		  type, 2, type, itype);
+	    rtype = gfc_get_real_type (rkinds[rkind]);
+	    if (rtype && itype)
+	      {
+		sprintf(name, PREFIX("pow_r%d_i%d"), rkinds[rkind],
+			ikinds[ikind]);
+		gfor_fndecl_math_powi[rkind][ikind].real =
+		  gfc_build_library_function_decl (get_identifier (name),
+		    rtype, 2, rtype, itype);
+	      }
+
+	    ctype = gfc_get_complex_type (rkinds[rkind]);
+	    if (ctype && itype)
+	      {
+		sprintf(name, PREFIX("pow_c%d_i%d"), rkinds[rkind],
+			ikinds[ikind]);
+		gfor_fndecl_math_powi[rkind][ikind].cmplx =
+		  gfc_build_library_function_decl (get_identifier (name),
+		    ctype, 2,ctype, itype);
+	      }
 	  }
       }
+#undef NIKINDS
+#undef NRKINDS
   }
 
   gfor_fndecl_math_cpowf =
@@ -1834,6 +1863,17 @@ gfc_build_intrinsic_function_decls (void)
     gfc_build_library_function_decl (get_identifier ("cpow"),
 				     gfc_complex8_type_node,
 				     1, gfc_complex8_type_node);
+  if (gfc_complex10_type_node)
+    gfor_fndecl_math_cpowl10 =
+      gfc_build_library_function_decl (get_identifier ("cpowl"),
+				       gfc_complex10_type_node, 1,
+				       gfc_complex10_type_node);
+  if (gfc_complex16_type_node)
+    gfor_fndecl_math_cpowl16 =
+      gfc_build_library_function_decl (get_identifier ("cpowl"),
+				       gfc_complex16_type_node, 1,
+				       gfc_complex16_type_node);
+
   gfor_fndecl_math_ishftc4 =
     gfc_build_library_function_decl (get_identifier (PREFIX("ishftc4")),
 				     gfc_int4_type_node,
@@ -1843,7 +1883,15 @@ gfc_build_intrinsic_function_decls (void)
     gfc_build_library_function_decl (get_identifier (PREFIX("ishftc8")),
 				     gfc_int8_type_node,
 				     3, gfc_int8_type_node,
-				     gfc_int8_type_node, gfc_int8_type_node);
+				     gfc_int4_type_node, gfc_int4_type_node);
+  if (gfc_int16_type_node)
+    gfor_fndecl_math_ishftc16 =
+      gfc_build_library_function_decl (get_identifier (PREFIX("ishftc16")),
+				       gfc_int16_type_node, 3,
+				       gfc_int16_type_node,
+				       gfc_int4_type_node,
+				       gfc_int4_type_node);
+
   gfor_fndecl_math_exponent4 =
     gfc_build_library_function_decl (get_identifier (PREFIX("exponent_r4")),
 				     gfc_int4_type_node,
@@ -1852,6 +1900,16 @@ gfc_build_intrinsic_function_decls (void)
     gfc_build_library_function_decl (get_identifier (PREFIX("exponent_r8")),
 				     gfc_int4_type_node,
 				     1, gfc_real8_type_node);
+  if (gfc_real10_type_node)
+    gfor_fndecl_math_exponent10 =
+      gfc_build_library_function_decl (get_identifier (PREFIX("exponent_r10")),
+				       gfc_int4_type_node, 1,
+				       gfc_real10_type_node);
+  if (gfc_real16_type_node)
+    gfor_fndecl_math_exponent16 =
+      gfc_build_library_function_decl (get_identifier (PREFIX("exponent_r16")),
+				       gfc_int4_type_node, 1,
+				       gfc_real16_type_node);
 
   /* Other functions.  */
   gfor_fndecl_size0 =
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index 913f7e659191fd952cb4e5c38fc70b1b4aebc4e8..7c6b4097bae83d2f5e908864e2979a27d65a32dd 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -691,6 +691,10 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
 	  ikind = 1;
 	  break;
 
+	case 16:
+	  ikind = 2;
+	  break;
+
 	default:
 	  gcc_unreachable ();
 	}
@@ -712,6 +716,14 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
 	  kind = 1;
 	  break;
 
+	case 10:
+	  kind = 2;
+	  break;
+
+	case 16:
+	  kind = 3;
+	  break;
+
 	default:
 	  gcc_unreachable ();
 	}
@@ -719,6 +731,8 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
       switch (expr->value.op.op1->ts.type)
 	{
 	case BT_INTEGER:
+	  if (kind == 3) /* Case 16 was not handled properly above.  */
+	    kind = 2;
 	  fndecl = gfor_fndecl_math_powi[kind][ikind].integer;
 	  break;
 
@@ -744,6 +758,10 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
 	case 8:
 	  fndecl = built_in_decls[BUILT_IN_POW];
 	  break;
+	case 10:
+	case 16:
+	  fndecl = built_in_decls[BUILT_IN_POWL];
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
@@ -758,6 +776,12 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr)
 	case 8:
 	  fndecl = gfor_fndecl_math_cpow;
 	  break;
+	case 10:
+	  fndecl = gfor_fndecl_math_cpowl10;
+	  break;
+	case 16:
+	  fndecl = gfor_fndecl_math_cpowl16;
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c
index d498717d795f1e3e76b678194a6302d31d44f73f..1d958e18ad74650c502bafc4f49670e54f80408c 100644
--- a/gcc/fortran/trans-intrinsic.c
+++ b/gcc/fortran/trans-intrinsic.c
@@ -52,14 +52,18 @@ typedef struct gfc_intrinsic_map_t	GTY(())
 
   /* Enum value from the "language-independent", aka C-centric, part
      of gcc, or END_BUILTINS of no such value set.  */
-  /* ??? There are now complex variants in builtins.def, though we
-     don't currently do anything with them.  */
-  enum built_in_function code4;
-  enum built_in_function code8;
+  enum built_in_function code_r4;
+  enum built_in_function code_r8;
+  enum built_in_function code_r10;
+  enum built_in_function code_r16;
+  enum built_in_function code_c4;
+  enum built_in_function code_c8;
+  enum built_in_function code_c10;
+  enum built_in_function code_c16;
 
   /* True if the naming pattern is to prepend "c" for complex and
      append "f" for kind=4.  False if the naming pattern is to
-     prepend "_gfortran_" and append "[rc][48]".  */
+     prepend "_gfortran_" and append "[rc](4|8|10|16)".  */
   bool libm_name;
 
   /* True if a complex version of the function exists.  */
@@ -74,32 +78,42 @@ typedef struct gfc_intrinsic_map_t	GTY(())
   /* Cache decls created for the various operand types.  */
   tree real4_decl;
   tree real8_decl;
+  tree real10_decl;
+  tree real16_decl;
   tree complex4_decl;
   tree complex8_decl;
+  tree complex10_decl;
+  tree complex16_decl;
 }
 gfc_intrinsic_map_t;
 
 /* ??? The NARGS==1 hack here is based on the fact that (c99 at least)
    defines complex variants of all of the entries in mathbuiltins.def
    except for atan2.  */
-#define BUILT_IN_FUNCTION(ID, NAME, HAVE_COMPLEX) \
-  { GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, true, \
-    HAVE_COMPLEX, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
-
-#define DEFINE_MATH_BUILTIN(id, name, argtype) \
-  BUILT_IN_FUNCTION (id, name, false)
-
-/* TODO: Use builtin function for complex intrinsics.  */
-#define DEFINE_MATH_BUILTIN_C(id, name, argtype) \
-  BUILT_IN_FUNCTION (id, name, true)
+#define DEFINE_MATH_BUILTIN(ID, NAME, ARGTYPE) \
+  { GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
+    BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, 0, 0, 0, 0, true, \
+    false, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
+    NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
+
+#define DEFINE_MATH_BUILTIN_C(ID, NAME, ARGTYPE) \
+  { GFC_ISYM_ ## ID, BUILT_IN_ ## ID ## F, BUILT_IN_ ## ID, \
+    BUILT_IN_ ## ID ## L, BUILT_IN_ ## ID ## L, BUILT_IN_C ## ID ## F, \
+    BUILT_IN_C ## ID, BUILT_IN_C ## ID ## L, BUILT_IN_C ## ID ## L, true, \
+    true, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, \
+    NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE},
 
 #define LIBM_FUNCTION(ID, NAME, HAVE_COMPLEX) \
-  { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, true, HAVE_COMPLEX, true, \
-    NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE }
+  { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+    END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+    true, HAVE_COMPLEX, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, \
+    NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE }
 
 #define LIBF_FUNCTION(ID, NAME, HAVE_COMPLEX) \
-  { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, false, HAVE_COMPLEX, true, \
-    NAME, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE }
+  { GFC_ISYM_ ## ID, END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+    END_BUILTINS, END_BUILTINS, END_BUILTINS, END_BUILTINS, \
+    false, HAVE_COMPLEX, true, NAME, NULL_TREE, NULL_TREE, NULL_TREE, \
+    NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE }
 
 static GTY(()) gfc_intrinsic_map_t gfc_intrinsic_map[] =
 {
@@ -122,7 +136,6 @@ static GTY(()) gfc_intrinsic_map_t gfc_intrinsic_map[] =
 };
 #undef DEFINE_MATH_BUILTIN
 #undef DEFINE_MATH_BUILTIN_C
-#undef BUILT_IN_FUNCTION
 #undef LIBM_FUNCTION
 #undef LIBF_FUNCTION
 
@@ -336,6 +349,11 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum tree_code op)
 	case 8:
 	  n = BUILT_IN_ROUND;
 	  break;
+
+	case 10:
+	case 16:
+	  n = BUILT_IN_ROUNDL;
+	  break;
 	}
       break;
 
@@ -349,6 +367,11 @@ gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, enum tree_code op)
 	case 8:
 	  n = BUILT_IN_TRUNC;
 	  break;
+
+	case 10:
+	case 16:
+	  n = BUILT_IN_TRUNCL;
+	  break;
 	}
       break;
 
@@ -469,10 +492,22 @@ gfc_build_intrinsic_lib_fndecls (void)
   /* Add GCC builtin functions.  */
   for (m = gfc_intrinsic_map; m->id != GFC_ISYM_NONE; m++)
     {
-      if (m->code4 != END_BUILTINS)
-        m->real4_decl = built_in_decls[m->code4];
-      if (m->code8 != END_BUILTINS)
-	m->real8_decl = built_in_decls[m->code8];
+      if (m->code_r4 != END_BUILTINS)
+	m->real4_decl = built_in_decls[m->code_r4];
+      if (m->code_r8 != END_BUILTINS)
+	m->real8_decl = built_in_decls[m->code_r8];
+      if (m->code_r10 != END_BUILTINS)
+	m->real10_decl = built_in_decls[m->code_r10];
+      if (m->code_r16 != END_BUILTINS)
+	m->real16_decl = built_in_decls[m->code_r16];
+      if (m->code_c4 != END_BUILTINS)
+	m->complex4_decl = built_in_decls[m->code_c4];
+      if (m->code_c8 != END_BUILTINS)
+	m->complex8_decl = built_in_decls[m->code_c8];
+      if (m->code_c10 != END_BUILTINS)
+	m->complex10_decl = built_in_decls[m->code_c10];
+      if (m->code_c16 != END_BUILTINS)
+	m->complex16_decl = built_in_decls[m->code_c16];
     }
 }
 
@@ -501,6 +536,12 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
 	case 8:
 	  pdecl = &m->real8_decl;
 	  break;
+	case 10:
+	  pdecl = &m->real10_decl;
+	  break;
+	case 16:
+	  pdecl = &m->real16_decl;
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
@@ -517,6 +558,12 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
 	case 8:
 	  pdecl = &m->complex8_decl;
 	  break;
+	case 10:
+	  pdecl = &m->complex10_decl;
+	  break;
+	case 16:
+	  pdecl = &m->complex16_decl;
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
@@ -529,7 +576,8 @@ gfc_get_intrinsic_lib_fndecl (gfc_intrinsic_map_t * m, gfc_expr * expr)
 
   if (m->libm_name)
     {
-      gcc_assert (ts->kind == 4 || ts->kind == 8);
+      gcc_assert (ts->kind == 4 || ts->kind == 8 || ts->kind == 10
+                 || ts->kind == 16);
       snprintf (name, sizeof (name), "%s%s%s",
 		ts->type == BT_COMPLEX ? "c" : "",
 		m->name,
@@ -615,6 +663,12 @@ gfc_conv_intrinsic_exponent (gfc_se * se, gfc_expr * expr)
     case 8:
       fndecl = gfor_fndecl_math_exponent8;
       break;
+    case 10:
+      fndecl = gfor_fndecl_math_exponent10;
+      break;
+    case 16:
+      fndecl = gfor_fndecl_math_exponent16;
+      break;
     default:
       gcc_unreachable ();
     }
@@ -734,6 +788,10 @@ gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr)
 	case 8:
 	  n = BUILT_IN_CABS;
 	  break;
+	case 10:
+	case 16:
+	  n = BUILT_IN_CABSL;
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
@@ -896,6 +954,10 @@ gfc_conv_intrinsic_sign (gfc_se * se, gfc_expr * expr)
 	case 8:
 	  tmp = built_in_decls[BUILT_IN_COPYSIGN];
 	  break;
+	case 10:
+	case 16:
+	  tmp = built_in_decls[BUILT_IN_COPYSIGNL];
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
@@ -1861,6 +1923,9 @@ gfc_conv_intrinsic_ishftc (gfc_se * se, gfc_expr * expr)
 	case 8:
 	  tmp = gfor_fndecl_math_ishftc8;
 	  break;
+	case 16:
+	  tmp = gfor_fndecl_math_ishftc16;
+	  break;
 	default:
 	  gcc_unreachable ();
 	}
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index e89e63eff9bb02d9ec846fbdc4a232ea2a3cfba8..6482df811612190a2c663a8b946562c9b9db641d 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -566,29 +566,29 @@ gfc_init_types (void)
 tree
 gfc_get_int_type (int kind)
 {
-  int index = gfc_validate_kind (BT_INTEGER, kind, false);
-  return gfc_integer_types[index];
+  int index = gfc_validate_kind (BT_INTEGER, kind, true);
+  return index < 0 ? 0 : gfc_integer_types[index];
 }
 
 tree
 gfc_get_real_type (int kind)
 {
-  int index = gfc_validate_kind (BT_REAL, kind, false);
-  return gfc_real_types[index];
+  int index = gfc_validate_kind (BT_REAL, kind, true);
+  return index < 0 ? 0 : gfc_real_types[index];
 }
 
 tree
 gfc_get_complex_type (int kind)
 {
-  int index = gfc_validate_kind (BT_COMPLEX, kind, false);
-  return gfc_complex_types[index];
+  int index = gfc_validate_kind (BT_COMPLEX, kind, true);
+  return index < 0 ? 0 : gfc_complex_types[index];
 }
 
 tree
 gfc_get_logical_type (int kind)
 {
-  int index = gfc_validate_kind (BT_LOGICAL, kind, false);
-  return gfc_logical_types[index];
+  int index = gfc_validate_kind (BT_LOGICAL, kind, true);
+  return index < 0 ? 0 : gfc_logical_types[index];
 }
 
 /* Create a character type with the given kind and length.  */
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h
index a0b4334c3a142675b07fd775aa746dd3b651147e..e64640cfd0c4312960885127313dd0a63f357357 100644
--- a/gcc/fortran/trans.h
+++ b/gcc/fortran/trans.h
@@ -471,13 +471,18 @@ typedef struct gfc_powdecl_list GTY(())
 }
 gfc_powdecl_list;
 
-extern GTY(()) gfc_powdecl_list gfor_fndecl_math_powi[3][2];
+extern GTY(()) gfc_powdecl_list gfor_fndecl_math_powi[4][3];
 extern GTY(()) tree gfor_fndecl_math_cpowf;
 extern GTY(()) tree gfor_fndecl_math_cpow;
+extern GTY(()) tree gfor_fndecl_math_cpowl10;
+extern GTY(()) tree gfor_fndecl_math_cpowl16;
 extern GTY(()) tree gfor_fndecl_math_ishftc4;
 extern GTY(()) tree gfor_fndecl_math_ishftc8;
+extern GTY(()) tree gfor_fndecl_math_ishftc16;
 extern GTY(()) tree gfor_fndecl_math_exponent4;
 extern GTY(()) tree gfor_fndecl_math_exponent8;
+extern GTY(()) tree gfor_fndecl_math_exponent10;
+extern GTY(()) tree gfor_fndecl_math_exponent16;
 
 /* String functions.  */
 extern GTY(()) tree gfor_fndecl_copy_string;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a297cb321bce1ede1b03a835e338056a9f835a4c..ea8a2a7dd5a5fad79021acb5d0449fe84c1c1141 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-03  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	PR libfortran/19308
+	* gfortran.dg/large_real_kind_2.F90: New test.
+	* gfortran.dg/large_integer_kind_2.f90: New test.
+
 2005-10-03  Uros Bizjak  <uros@kss-loka.si>
 
 	* lib/target-supports.exp (check_effective_target_vect_shift):
diff --git a/gcc/testsuite/gfortran.dg/large_integer_kind_2.f90 b/gcc/testsuite/gfortran.dg/large_integer_kind_2.f90
new file mode 100644
index 0000000000000000000000000000000000000000..68e64ab8ee43b0b994ccf9c995250718c87c0179
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/large_integer_kind_2.f90
@@ -0,0 +1,15 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_int }
+
+! Testing library calls on large integer kinds (larger than kind=8)
+  implicit none
+
+  integer,parameter :: k = selected_int_kind (range (0_8) + 1)
+
+  integer(kind=k) :: i, j
+  integer(8) :: a, b
+
+  i = 0; j = 1; a = i; b = j
+  if (i ** j /= a ** b) call abort
+
+end
diff --git a/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
new file mode 100644
index 0000000000000000000000000000000000000000..4eb5a7fd8831c217e48cba4b25602e9306a8cad9
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/large_real_kind_2.F90
@@ -0,0 +1,106 @@
+! { dg-do run }
+! { dg-require-effective-target fortran_large_real }
+
+! Testing library calls on large real kinds (larger than kind=8)
+  implicit none
+
+  integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1)
+  real(8),parameter :: eps = 1e-8
+
+  real(kind=k) :: x, x1
+  real(8) :: y, y1
+  complex(kind=k) :: z, z1
+  complex(8) :: w, w1
+
+#define TEST_FUNCTION(func,val) \
+ x = val ;\
+ y = x ;\
+ x = func (x) ;\
+ y = func (y) ;\
+ if (abs((y - x) / y) > eps) call abort
+  
+#define CTEST_FUNCTION(func,valc) \
+ z = valc ;\
+ w = z ;\
+ z = func (z) ;\
+ w = func (w) ;\
+ if (abs((z - w) / w) > eps) call abort
+
+ TEST_FUNCTION(cos,17.456)
+ TEST_FUNCTION(sin,17.456)
+ TEST_FUNCTION(tan,1.456)
+ TEST_FUNCTION(cosh,-2.45)
+ TEST_FUNCTION(sinh,7.1)
+ TEST_FUNCTION(tanh,12.7)
+ TEST_FUNCTION(acos,0.78)
+ TEST_FUNCTION(asin,-0.24)
+ TEST_FUNCTION(atan,-17.123)
+ TEST_FUNCTION(acosh,0.2)
+ TEST_FUNCTION(asinh,0.3)
+ TEST_FUNCTION(atanh,0.4)
+ TEST_FUNCTION(exp,1.74)
+ TEST_FUNCTION(log,0.00178914)
+ TEST_FUNCTION(log10,123789.123)
+ TEST_FUNCTION(sqrt,789.1356)
+ TEST_FUNCTION(erf,1.45123231)
+ TEST_FUNCTION(erfc,-0.123789)
+
+ CTEST_FUNCTION(cos,(17.456,-1.123))
+ CTEST_FUNCTION(sin,(17.456,-7.6))
+ CTEST_FUNCTION(exp,(1.74,-1.01))
+ CTEST_FUNCTION(log,(0.00178914,-1.207))
+ CTEST_FUNCTION(sqrt,(789.1356,2.4))
+
+#define TEST_POWER(val1,val2) \
+ x = val1 ; \
+ y = x ; \
+ x1 = val2 ; \
+ y1 = x1; \
+ if (abs((x**x1 - y**y1)/(y**y1)) > eps) call abort
+ 
+#define CTEST_POWER(val1,val2) \
+ z = val1 ; \
+ w = z ; \
+ z1 = val2 ; \
+ w1 = z1; \
+ if (abs((z**z1 - w**w1)/(w**w1)) > eps) call abort
+
+ CTEST_POWER (1.0,1.0)
+ CTEST_POWER (1.0,5.4)
+ CTEST_POWER (1.0,-5.4)
+ CTEST_POWER (1.0,0.0)
+ CTEST_POWER (-1.0,1.0)
+ CTEST_POWER (-1.0,5.4)
+ CTEST_POWER (-1.0,-5.4)
+ CTEST_POWER (-1.0,0.0)
+ CTEST_POWER (0.0,1.0)
+ CTEST_POWER (0.0,5.4)
+ CTEST_POWER (0.0,-5.4)
+ CTEST_POWER (0.0,0.0)
+ CTEST_POWER (7.6,1.0)
+ CTEST_POWER (7.6,5.4)
+ CTEST_POWER (7.6,-5.4)
+ CTEST_POWER (7.6,0.0)
+ CTEST_POWER (-7.6,1.0)
+ CTEST_POWER (-7.6,5.4)
+ CTEST_POWER (-7.6,-5.4)
+ CTEST_POWER (-7.6,0.0)
+
+ CTEST_POWER ((10.78,123.213),(14.123,13279.5))
+ CTEST_POWER ((-10.78,123.213),(14.123,13279.5))
+ CTEST_POWER ((10.78,-123.213),(14.123,13279.5))
+ CTEST_POWER ((10.78,123.213),(-14.123,13279.5))
+ CTEST_POWER ((10.78,123.213),(14.123,-13279.5))
+ CTEST_POWER ((-10.78,-123.213),(14.123,13279.5))
+ CTEST_POWER ((-10.78,123.213),(-14.123,13279.5))
+ CTEST_POWER ((-10.78,123.213),(14.123,-13279.5))
+ CTEST_POWER ((10.78,-123.213),(-14.123,13279.5))
+ CTEST_POWER ((10.78,-123.213),(14.123,-13279.5))
+ CTEST_POWER ((10.78,123.213),(-14.123,-13279.5))
+ CTEST_POWER ((-10.78,-123.213),(-14.123,13279.5))
+ CTEST_POWER ((-10.78,-123.213),(14.123,-13279.5))
+ CTEST_POWER ((-10.78,123.213),(-14.123,-13279.5))
+ CTEST_POWER ((10.78,-123.213),(-14.123,-13279.5))
+ CTEST_POWER ((-10.78,-123.213),(-14.123,-13279.5))
+ 
+end
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 7c9189839565b5f8ba52d5eb825d34af7bbe88dc..34b07eb12d4307b17d81235a5e2398a6cb524ce8 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,29 @@
+2005-10-03  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+	PR libfortran/19308
+	PR libfortran/22437
+	* Makefile.am: Add generated files for large real and integers
+	kinds. Add a rule to create the kinds.inc c99_protos.inc files.
+	Use kinds.inc to preprocess Fortran generated files.
+	* libgfortran.h: Add macro definitions for GFC_INTEGER_16_HUGE,
+	GFC_REAL_10_HUGE and GFC_REAL_16_HUGE. Add types gfc_array_i16,
+	gfc_array_r10, gfc_array_r16, gfc_array_c10, gfc_array_c16,
+	gfc_array_l16.
+	* mk-kinds-h.sh: Define macros HAVE_GFC_LOGICAL_* and
+	HAVE_GFC_COMPLEX_* when these types are available.
+	* intrinsics/ishftc.c (ishftc16): New function for GFC_INTEGER_16.
+	* m4/all.m4, m4/any.m4, m4/count.m4, m4/cshift1.m4, m4/dotprod.m4,
+	m4/dotprodc.m4, m4/dotprodl.m4, m4/eoshift1.m4, m4/eoshift3.m4,
+	m4/exponent.m4, m4/fraction.m4, m4/in_pack.m4, m4/in_unpack.m4,
+	m4/matmul.m4, m4/matmull.m4, m4/maxloc0.m4, m4/maxloc1.m4,
+	m4/maxval.m4, m4/minloc0.m4, m4/minloc1.m4, m4/minval.m4, m4/mtype.m4,
+	m4/nearest.m4, m4/pow.m4, m4/product.m4, m4/reshape.m4,
+	m4/set_exponent.m4, m4/shape.m4, m4/specific.m4, m4/specific2.m4,
+	m4/sum.m4, m4/transpose.m4: Protect generated functions with
+	appropriate "#if defined (HAVE_GFC_type_kind)" preprocessor directives.
+	* Makefile.in: Regenerate.
+	* all files in generated/: Regenerate.
+
 2005-10-01  Jakub Jelinek  <jakub@redhat.com>
 
 	* runtime/memory.c (malloc_t): Remove.
@@ -65,7 +91,7 @@
 	* config.h.in: Regenerate.
 	* libgfortan.h (isfinite): undef if broken, set if needed.
 	(isnan): undef if broken, set if needed.
-        (fpclassify): undef if broken, set if needed.
+	(fpclassify): undef if broken, set if needed.
 	* io/write.c: Remove TODO comment about working isfinite.
 	* intrinsics/c99_functions.c (round): Use isfinite instead
 	of fpclassify.
diff --git a/libgfortran/Makefile.am b/libgfortran/Makefile.am
index 831ad76d9e53985586b6313f25da2449767d8602..cac343b1da63a8c947a50a47bb0fb4c8297ddfc3 100644
--- a/libgfortran/Makefile.am
+++ b/libgfortran/Makefile.am
@@ -108,181 +108,313 @@ libgfortran.h
 
 i_all_c= \
 generated/all_l4.c \
-generated/all_l8.c
+generated/all_l8.c \
+generated/all_l16.c
 
 i_any_c= \
 generated/any_l4.c \
-generated/any_l8.c
+generated/any_l8.c \
+generated/any_l16.c
 
 i_count_c= \
 generated/count_4_l4.c \
 generated/count_8_l4.c \
+generated/count_16_l4.c \
 generated/count_4_l8.c \
-generated/count_8_l8.c
+generated/count_8_l8.c \
+generated/count_16_l8.c \
+generated/count_4_l16.c \
+generated/count_8_l16.c \
+generated/count_16_l16.c
 
 i_maxloc0_c= \
 generated/maxloc0_4_i4.c \
 generated/maxloc0_8_i4.c \
+generated/maxloc0_16_i4.c \
 generated/maxloc0_4_i8.c \
 generated/maxloc0_8_i8.c \
+generated/maxloc0_16_i8.c \
+generated/maxloc0_4_i16.c \
+generated/maxloc0_8_i16.c \
+generated/maxloc0_16_i16.c \
 generated/maxloc0_4_r4.c \
 generated/maxloc0_8_r4.c \
+generated/maxloc0_16_r4.c \
 generated/maxloc0_4_r8.c \
-generated/maxloc0_8_r8.c
+generated/maxloc0_8_r8.c \
+generated/maxloc0_16_r8.c \
+generated/maxloc0_4_r10.c \
+generated/maxloc0_8_r10.c \
+generated/maxloc0_16_r10.c \
+generated/maxloc0_4_r16.c \
+generated/maxloc0_8_r16.c \
+generated/maxloc0_16_r16.c
 
 i_maxloc1_c= \
 generated/maxloc1_4_i4.c \
 generated/maxloc1_8_i4.c \
+generated/maxloc1_16_i4.c \
 generated/maxloc1_4_i8.c \
 generated/maxloc1_8_i8.c \
+generated/maxloc1_16_i8.c \
+generated/maxloc1_4_i16.c \
+generated/maxloc1_8_i16.c \
+generated/maxloc1_16_i16.c \
 generated/maxloc1_4_r4.c \
 generated/maxloc1_8_r4.c \
+generated/maxloc1_16_r4.c \
 generated/maxloc1_4_r8.c \
-generated/maxloc1_8_r8.c
+generated/maxloc1_8_r8.c \
+generated/maxloc1_16_r8.c \
+generated/maxloc1_4_r10.c \
+generated/maxloc1_8_r10.c \
+generated/maxloc1_16_r10.c \
+generated/maxloc1_4_r16.c \
+generated/maxloc1_8_r16.c \
+generated/maxloc1_16_r16.c
 
 i_maxval_c= \
 generated/maxval_i4.c \
 generated/maxval_i8.c \
+generated/maxval_i16.c \
 generated/maxval_r4.c \
-generated/maxval_r8.c
+generated/maxval_r8.c \
+generated/maxval_r10.c \
+generated/maxval_r16.c
 
 i_minloc0_c= \
 generated/minloc0_4_i4.c \
 generated/minloc0_8_i4.c \
+generated/minloc0_16_i4.c \
 generated/minloc0_4_i8.c \
 generated/minloc0_8_i8.c \
+generated/minloc0_16_i8.c \
+generated/minloc0_4_i16.c \
+generated/minloc0_8_i16.c \
+generated/minloc0_16_i16.c \
 generated/minloc0_4_r4.c \
 generated/minloc0_8_r4.c \
+generated/minloc0_16_r4.c \
 generated/minloc0_4_r8.c \
-generated/minloc0_8_r8.c
+generated/minloc0_8_r8.c \
+generated/minloc0_16_r8.c \
+generated/minloc0_4_r10.c \
+generated/minloc0_8_r10.c \
+generated/minloc0_16_r10.c \
+generated/minloc0_4_r16.c \
+generated/minloc0_8_r16.c \
+generated/minloc0_16_r16.c
 
 i_minloc1_c= \
 generated/minloc1_4_i4.c \
 generated/minloc1_8_i4.c \
+generated/minloc1_16_i4.c \
 generated/minloc1_4_i8.c \
 generated/minloc1_8_i8.c \
+generated/minloc1_16_i8.c \
+generated/minloc1_4_i16.c \
+generated/minloc1_8_i16.c \
+generated/minloc1_16_i16.c \
 generated/minloc1_4_r4.c \
 generated/minloc1_8_r4.c \
+generated/minloc1_16_r4.c \
 generated/minloc1_4_r8.c \
-generated/minloc1_8_r8.c
+generated/minloc1_8_r8.c \
+generated/minloc1_16_r8.c \
+generated/minloc1_4_r10.c \
+generated/minloc1_8_r10.c \
+generated/minloc1_16_r10.c \
+generated/minloc1_4_r16.c \
+generated/minloc1_8_r16.c \
+generated/minloc1_16_r16.c
 
 i_minval_c= \
 generated/minval_i4.c \
 generated/minval_i8.c \
+generated/minval_i16.c \
 generated/minval_r4.c \
-generated/minval_r8.c
+generated/minval_r8.c \
+generated/minval_r10.c \
+generated/minval_r16.c
 
 i_sum_c= \
 generated/sum_i4.c \
 generated/sum_i8.c \
+generated/sum_i16.c \
 generated/sum_r4.c \
 generated/sum_r8.c \
+generated/sum_r10.c \
+generated/sum_r16.c \
 generated/sum_c4.c \
-generated/sum_c8.c
+generated/sum_c8.c \
+generated/sum_c10.c \
+generated/sum_c16.c
 
 i_product_c= \
 generated/product_i4.c \
 generated/product_i8.c \
+generated/product_i16.c \
 generated/product_r4.c \
 generated/product_r8.c \
+generated/product_r10.c \
+generated/product_r16.c \
 generated/product_c4.c \
-generated/product_c8.c
+generated/product_c8.c \
+generated/product_c10.c \
+generated/product_c16.c
 
 i_dotprod_c= \
 generated/dotprod_i4.c \
 generated/dotprod_i8.c \
+generated/dotprod_i16.c \
 generated/dotprod_r4.c \
-generated/dotprod_r8.c
+generated/dotprod_r8.c \
+generated/dotprod_r10.c \
+generated/dotprod_r16.c
 
 i_dotprodl_c= \
 generated/dotprod_l4.c \
-generated/dotprod_l8.c
+generated/dotprod_l8.c \
+generated/dotprod_l16.c
 
 i_dotprodc_c= \
 generated/dotprod_c4.c \
-generated/dotprod_c8.c
+generated/dotprod_c8.c \
+generated/dotprod_c10.c \
+generated/dotprod_c16.c
 
 i_matmul_c= \
 generated/matmul_i4.c \
 generated/matmul_i8.c \
+generated/matmul_i16.c \
 generated/matmul_r4.c \
 generated/matmul_r8.c \
+generated/matmul_r10.c \
+generated/matmul_r16.c \
 generated/matmul_c4.c \
-generated/matmul_c8.c
+generated/matmul_c8.c \
+generated/matmul_c10.c \
+generated/matmul_c16.c
 
 i_matmull_c= \
 generated/matmul_l4.c \
-generated/matmul_l8.c
+generated/matmul_l8.c \
+generated/matmul_l16.c
 
 i_transpose_c= \
 generated/transpose_i4.c \
 generated/transpose_i8.c \
+generated/transpose_i16.c \
 generated/transpose_c4.c \
-generated/transpose_c8.c
+generated/transpose_c8.c \
+generated/transpose_c10.c \
+generated/transpose_c16.c
 
 i_shape_c= \
 generated/shape_i4.c \
-generated/shape_i8.c
+generated/shape_i8.c \
+generated/shape_i16.c
 
 i_reshape_c= \
 generated/reshape_i4.c \
 generated/reshape_i8.c \
+generated/reshape_i16.c \
 generated/reshape_c4.c \
-generated/reshape_c8.c
+generated/reshape_c8.c \
+generated/reshape_c10.c \
+generated/reshape_c16.c
 
 i_eoshift1_c= \
 generated/eoshift1_4.c \
-generated/eoshift1_8.c
+generated/eoshift1_8.c \
+generated/eoshift1_16.c
 
 i_eoshift3_c= \
 generated/eoshift3_4.c \
-generated/eoshift3_8.c
+generated/eoshift3_8.c \
+generated/eoshift3_16.c
 
 i_cshift1_c= \
 generated/cshift1_4.c \
-generated/cshift1_8.c
+generated/cshift1_8.c \
+generated/cshift1_16.c
 
 in_pack_c = \
 generated/in_pack_i4.c \
 generated/in_pack_i8.c \
+generated/in_pack_i16.c \
 generated/in_pack_c4.c \
-generated/in_pack_c8.c
+generated/in_pack_c8.c \
+generated/in_pack_c10.c \
+generated/in_pack_c16.c
 
 in_unpack_c = \
 generated/in_unpack_i4.c \
 generated/in_unpack_i8.c \
+generated/in_unpack_i16.c \
 generated/in_unpack_c4.c \
-generated/in_unpack_c8.c
+generated/in_unpack_c8.c \
+generated/in_unpack_c10.c \
+generated/in_unpack_c16.c
 
 i_exponent_c = \
 generated/exponent_r4.c \
-generated/exponent_r8.c
+generated/exponent_r8.c \
+generated/exponent_r10.c \
+generated/exponent_r16.c
 
 i_fraction_c = \
 generated/fraction_r4.c \
-generated/fraction_r8.c
+generated/fraction_r8.c \
+generated/fraction_r10.c \
+generated/fraction_r16.c
 
 i_nearest_c = \
 generated/nearest_r4.c \
-generated/nearest_r8.c
+generated/nearest_r8.c \
+generated/nearest_r10.c \
+generated/nearest_r16.c
 
 i_set_exponent_c = \
 generated/set_exponent_r4.c \
-generated/set_exponent_r8.c
+generated/set_exponent_r8.c \
+generated/set_exponent_r10.c \
+generated/set_exponent_r16.c
 
 i_pow_c = \
 generated/pow_i4_i4.c \
 generated/pow_i8_i4.c \
+generated/pow_i16_i4.c \
 generated/pow_r4_i4.c \
 generated/pow_r8_i4.c \
+generated/pow_r10_i4.c \
+generated/pow_r16_i4.c \
 generated/pow_c4_i4.c \
 generated/pow_c8_i4.c \
+generated/pow_c10_i4.c \
+generated/pow_c16_i4.c \
 generated/pow_i4_i8.c \
 generated/pow_i8_i8.c \
+generated/pow_i16_i8.c \
 generated/pow_r4_i8.c \
 generated/pow_r8_i8.c \
+generated/pow_r10_i8.c \
+generated/pow_r16_i8.c \
 generated/pow_c4_i8.c \
-generated/pow_c8_i8.c
+generated/pow_c8_i8.c \
+generated/pow_c10_i8.c \
+generated/pow_c16_i8.c \
+generated/pow_i4_i16.c \
+generated/pow_i8_i16.c \
+generated/pow_i16_i16.c \
+generated/pow_r4_i16.c \
+generated/pow_r8_i16.c \
+generated/pow_r10_i16.c \
+generated/pow_r16_i16.c \
+generated/pow_c4_i16.c \
+generated/pow_c8_i16.c \
+generated/pow_c10_i16.c \
+generated/pow_c16_i16.c
 
 m4_files= m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \
     m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval.m4 \
@@ -300,74 +432,135 @@ gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
     $(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
     $(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
     $(i_pow_c) \
-    selected_int_kind.inc selected_real_kind.inc kinds.h
+    selected_int_kind.inc selected_real_kind.inc kinds.h \
+    kinds.inc c99_protos.inc
 
 # Machine generated specifics
 gfor_built_specific_src= \
-generated/_abs_c4.f90 \
-generated/_abs_c8.f90 \
-generated/_abs_i4.f90 \
-generated/_abs_i8.f90 \
-generated/_abs_r4.f90 \
-generated/_abs_r8.f90 \
-generated/_exp_r4.f90 \
-generated/_exp_r8.f90 \
-generated/_exp_c4.f90 \
-generated/_exp_c8.f90 \
-generated/_log_r4.f90 \
-generated/_log_r8.f90 \
-generated/_log_c4.f90 \
-generated/_log_c8.f90 \
-generated/_log10_r4.f90 \
-generated/_log10_r8.f90 \
-generated/_sqrt_r4.f90 \
-generated/_sqrt_r8.f90 \
-generated/_sqrt_c4.f90 \
-generated/_sqrt_c8.f90 \
-generated/_asin_r4.f90 \
-generated/_asin_r8.f90 \
-generated/_acos_r4.f90 \
-generated/_acos_r8.f90 \
-generated/_atan_r4.f90 \
-generated/_atan_r8.f90 \
-generated/_sin_r4.f90 \
-generated/_sin_r8.f90 \
-generated/_sin_c4.f90 \
-generated/_sin_c8.f90 \
-generated/_cos_r4.f90 \
-generated/_cos_r8.f90 \
-generated/_cos_c4.f90 \
-generated/_cos_c8.f90 \
-generated/_tan_r4.f90 \
-generated/_tan_r8.f90 \
-generated/_sinh_r4.f90 \
-generated/_sinh_r8.f90 \
-generated/_cosh_r4.f90 \
-generated/_cosh_r8.f90 \
-generated/_tanh_r4.f90 \
-generated/_tanh_r8.f90 \
-generated/_conjg_c4.f90 \
-generated/_conjg_c8.f90 \
-generated/_aint_r4.f90 \
-generated/_aint_r8.f90 \
-generated/_anint_r4.f90 \
-generated/_anint_r8.f90
+generated/_abs_c4.F90 \
+generated/_abs_c8.F90 \
+generated/_abs_c10.F90 \
+generated/_abs_c16.F90 \
+generated/_abs_i4.F90 \
+generated/_abs_i8.F90 \
+generated/_abs_i16.F90 \
+generated/_abs_r4.F90 \
+generated/_abs_r8.F90 \
+generated/_abs_r10.F90 \
+generated/_abs_r16.F90 \
+generated/_exp_r4.F90 \
+generated/_exp_r8.F90 \
+generated/_exp_r10.F90 \
+generated/_exp_r16.F90 \
+generated/_exp_c4.F90 \
+generated/_exp_c8.F90 \
+generated/_exp_c10.F90 \
+generated/_exp_c16.F90 \
+generated/_log_r4.F90 \
+generated/_log_r8.F90 \
+generated/_log_r10.F90 \
+generated/_log_r16.F90 \
+generated/_log_c4.F90 \
+generated/_log_c8.F90 \
+generated/_log_c10.F90 \
+generated/_log_c16.F90 \
+generated/_log10_r4.F90 \
+generated/_log10_r8.F90 \
+generated/_log10_r10.F90 \
+generated/_log10_r16.F90 \
+generated/_sqrt_r4.F90 \
+generated/_sqrt_r8.F90 \
+generated/_sqrt_r10.F90 \
+generated/_sqrt_r16.F90 \
+generated/_sqrt_c4.F90 \
+generated/_sqrt_c8.F90 \
+generated/_sqrt_c10.F90 \
+generated/_sqrt_c16.F90 \
+generated/_asin_r4.F90 \
+generated/_asin_r8.F90 \
+generated/_asin_r10.F90 \
+generated/_asin_r16.F90 \
+generated/_acos_r4.F90 \
+generated/_acos_r8.F90 \
+generated/_acos_r10.F90 \
+generated/_acos_r16.F90 \
+generated/_atan_r4.F90 \
+generated/_atan_r8.F90 \
+generated/_atan_r10.F90 \
+generated/_atan_r16.F90 \
+generated/_sin_r4.F90 \
+generated/_sin_r8.F90 \
+generated/_sin_r10.F90 \
+generated/_sin_r16.F90 \
+generated/_sin_c4.F90 \
+generated/_sin_c8.F90 \
+generated/_sin_c10.F90 \
+generated/_sin_c16.F90 \
+generated/_cos_r4.F90 \
+generated/_cos_r8.F90 \
+generated/_cos_r10.F90 \
+generated/_cos_r16.F90 \
+generated/_cos_c4.F90 \
+generated/_cos_c8.F90 \
+generated/_cos_c10.F90 \
+generated/_cos_c16.F90 \
+generated/_tan_r4.F90 \
+generated/_tan_r8.F90 \
+generated/_tan_r10.F90 \
+generated/_tan_r16.F90 \
+generated/_sinh_r4.F90 \
+generated/_sinh_r8.F90 \
+generated/_sinh_r10.F90 \
+generated/_sinh_r16.F90 \
+generated/_cosh_r4.F90 \
+generated/_cosh_r8.F90 \
+generated/_cosh_r10.F90 \
+generated/_cosh_r16.F90 \
+generated/_tanh_r4.F90 \
+generated/_tanh_r8.F90 \
+generated/_tanh_r10.F90 \
+generated/_tanh_r16.F90 \
+generated/_conjg_c4.F90 \
+generated/_conjg_c8.F90 \
+generated/_conjg_c10.F90 \
+generated/_conjg_c16.F90 \
+generated/_aint_r4.F90 \
+generated/_aint_r8.F90 \
+generated/_aint_r10.F90 \
+generated/_aint_r16.F90 \
+generated/_anint_r4.F90 \
+generated/_anint_r8.F90 \
+generated/_anint_r10.F90 \
+generated/_anint_r16.F90
 
 gfor_built_specific2_src= \
-generated/_sign_i4.f90 \
-generated/_sign_i8.f90 \
-generated/_sign_r4.f90 \
-generated/_sign_r8.f90 \
-generated/_dim_i4.f90 \
-generated/_dim_i8.f90 \
-generated/_dim_r4.f90 \
-generated/_dim_r8.f90 \
-generated/_atan2_r4.f90 \
-generated/_atan2_r8.f90 \
-generated/_mod_i4.f90 \
-generated/_mod_i8.f90 \
-generated/_mod_r4.f90 \
-generated/_mod_r8.f90
+generated/_sign_i4.F90 \
+generated/_sign_i8.F90 \
+generated/_sign_i16.F90 \
+generated/_sign_r4.F90 \
+generated/_sign_r8.F90 \
+generated/_sign_r10.F90 \
+generated/_sign_r16.F90 \
+generated/_dim_i4.F90 \
+generated/_dim_i8.F90 \
+generated/_dim_i16.F90 \
+generated/_dim_r4.F90 \
+generated/_dim_r8.F90 \
+generated/_dim_r10.F90 \
+generated/_dim_r16.F90 \
+generated/_atan2_r4.F90 \
+generated/_atan2_r8.F90 \
+generated/_atan2_r10.F90 \
+generated/_atan2_r16.F90 \
+generated/_mod_i4.F90 \
+generated/_mod_i8.F90 \
+generated/_mod_i16.F90 \
+generated/_mod_r4.F90 \
+generated/_mod_r8.F90
+# There are commented out due to a bug in the way the front-end
+# handles MOD
+#generated/_mod_r10.F90
+#generated/_mod_r16.F90
 
 gfor_specific_src= \
 $(gfor_built_specific_src) \
@@ -387,6 +580,12 @@ I_M4_DEPS1=$(I_M4_DEPS) m4/ifunction.m4
 kinds.h: $(srcdir)/mk-kinds-h.sh
 	$(SHELL) $(srcdir)/mk-kinds-h.sh '$(FCCOMPILE)' > $@
 
+kinds.inc: kinds.h
+	grep '^#' < kinds.h > $@
+
+c99_protos.inc: $(srcdir)/c99_protos.h
+	grep '^#' < $(srcdir)/c99_protos.h > $@
+
 selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh
 	$(SHELL) $(srcdir)/mk-sik-inc.sh '$(FCCOMPILE)' > $@
 
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 06b90ce9f15fb134b95b26ebdd9f0b3e37dfd8f1..c4d3be6ef1138f6640f34707ca02cd24c3b7eccf 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -68,54 +68,89 @@ LTLIBRARIES = $(toolexeclib_LTLIBRARIES)
 libgfortran_la_LIBADD =
 am__objects_1 = compile_options.lo environ.lo error.lo main.lo \
 	memory.lo pause.lo stop.lo string.lo select.lo
-am__objects_2 = all_l4.lo all_l8.lo
-am__objects_3 = any_l4.lo any_l8.lo
-am__objects_4 = count_4_l4.lo count_8_l4.lo count_4_l8.lo \
-	count_8_l8.lo
-am__objects_5 = maxloc0_4_i4.lo maxloc0_8_i4.lo maxloc0_4_i8.lo \
-	maxloc0_8_i8.lo maxloc0_4_r4.lo maxloc0_8_r4.lo \
-	maxloc0_4_r8.lo maxloc0_8_r8.lo
-am__objects_6 = maxloc1_4_i4.lo maxloc1_8_i4.lo maxloc1_4_i8.lo \
-	maxloc1_8_i8.lo maxloc1_4_r4.lo maxloc1_8_r4.lo \
-	maxloc1_4_r8.lo maxloc1_8_r8.lo
-am__objects_7 = maxval_i4.lo maxval_i8.lo maxval_r4.lo maxval_r8.lo
-am__objects_8 = minloc0_4_i4.lo minloc0_8_i4.lo minloc0_4_i8.lo \
-	minloc0_8_i8.lo minloc0_4_r4.lo minloc0_8_r4.lo \
-	minloc0_4_r8.lo minloc0_8_r8.lo
-am__objects_9 = minloc1_4_i4.lo minloc1_8_i4.lo minloc1_4_i8.lo \
-	minloc1_8_i8.lo minloc1_4_r4.lo minloc1_8_r4.lo \
-	minloc1_4_r8.lo minloc1_8_r8.lo
-am__objects_10 = minval_i4.lo minval_i8.lo minval_r4.lo minval_r8.lo
-am__objects_11 = product_i4.lo product_i8.lo product_r4.lo \
-	product_r8.lo product_c4.lo product_c8.lo
-am__objects_12 = sum_i4.lo sum_i8.lo sum_r4.lo sum_r8.lo sum_c4.lo \
-	sum_c8.lo
-am__objects_13 = dotprod_i4.lo dotprod_i8.lo dotprod_r4.lo \
-	dotprod_r8.lo
-am__objects_14 = dotprod_l4.lo dotprod_l8.lo
-am__objects_15 = dotprod_c4.lo dotprod_c8.lo
-am__objects_16 = matmul_i4.lo matmul_i8.lo matmul_r4.lo matmul_r8.lo \
-	matmul_c4.lo matmul_c8.lo
-am__objects_17 = matmul_l4.lo matmul_l8.lo
-am__objects_18 = transpose_i4.lo transpose_i8.lo transpose_c4.lo \
-	transpose_c8.lo
-am__objects_19 = shape_i4.lo shape_i8.lo
-am__objects_20 = eoshift1_4.lo eoshift1_8.lo
-am__objects_21 = eoshift3_4.lo eoshift3_8.lo
-am__objects_22 = cshift1_4.lo cshift1_8.lo
-am__objects_23 = reshape_i4.lo reshape_i8.lo reshape_c4.lo \
-	reshape_c8.lo
-am__objects_24 = in_pack_i4.lo in_pack_i8.lo in_pack_c4.lo \
-	in_pack_c8.lo
-am__objects_25 = in_unpack_i4.lo in_unpack_i8.lo in_unpack_c4.lo \
-	in_unpack_c8.lo
-am__objects_26 = exponent_r4.lo exponent_r8.lo
-am__objects_27 = fraction_r4.lo fraction_r8.lo
-am__objects_28 = nearest_r4.lo nearest_r8.lo
-am__objects_29 = set_exponent_r4.lo set_exponent_r8.lo
-am__objects_30 = pow_i4_i4.lo pow_i8_i4.lo pow_r4_i4.lo pow_r8_i4.lo \
-	pow_c4_i4.lo pow_c8_i4.lo pow_i4_i8.lo pow_i8_i8.lo \
-	pow_r4_i8.lo pow_r8_i8.lo pow_c4_i8.lo pow_c8_i8.lo
+am__objects_2 = all_l4.lo all_l8.lo all_l16.lo
+am__objects_3 = any_l4.lo any_l8.lo any_l16.lo
+am__objects_4 = count_4_l4.lo count_8_l4.lo count_16_l4.lo \
+	count_4_l8.lo count_8_l8.lo count_16_l8.lo count_4_l16.lo \
+	count_8_l16.lo count_16_l16.lo
+am__objects_5 = maxloc0_4_i4.lo maxloc0_8_i4.lo maxloc0_16_i4.lo \
+	maxloc0_4_i8.lo maxloc0_8_i8.lo maxloc0_16_i8.lo \
+	maxloc0_4_i16.lo maxloc0_8_i16.lo maxloc0_16_i16.lo \
+	maxloc0_4_r4.lo maxloc0_8_r4.lo maxloc0_16_r4.lo \
+	maxloc0_4_r8.lo maxloc0_8_r8.lo maxloc0_16_r8.lo \
+	maxloc0_4_r10.lo maxloc0_8_r10.lo maxloc0_16_r10.lo \
+	maxloc0_4_r16.lo maxloc0_8_r16.lo maxloc0_16_r16.lo
+am__objects_6 = maxloc1_4_i4.lo maxloc1_8_i4.lo maxloc1_16_i4.lo \
+	maxloc1_4_i8.lo maxloc1_8_i8.lo maxloc1_16_i8.lo \
+	maxloc1_4_i16.lo maxloc1_8_i16.lo maxloc1_16_i16.lo \
+	maxloc1_4_r4.lo maxloc1_8_r4.lo maxloc1_16_r4.lo \
+	maxloc1_4_r8.lo maxloc1_8_r8.lo maxloc1_16_r8.lo \
+	maxloc1_4_r10.lo maxloc1_8_r10.lo maxloc1_16_r10.lo \
+	maxloc1_4_r16.lo maxloc1_8_r16.lo maxloc1_16_r16.lo
+am__objects_7 = maxval_i4.lo maxval_i8.lo maxval_i16.lo maxval_r4.lo \
+	maxval_r8.lo maxval_r10.lo maxval_r16.lo
+am__objects_8 = minloc0_4_i4.lo minloc0_8_i4.lo minloc0_16_i4.lo \
+	minloc0_4_i8.lo minloc0_8_i8.lo minloc0_16_i8.lo \
+	minloc0_4_i16.lo minloc0_8_i16.lo minloc0_16_i16.lo \
+	minloc0_4_r4.lo minloc0_8_r4.lo minloc0_16_r4.lo \
+	minloc0_4_r8.lo minloc0_8_r8.lo minloc0_16_r8.lo \
+	minloc0_4_r10.lo minloc0_8_r10.lo minloc0_16_r10.lo \
+	minloc0_4_r16.lo minloc0_8_r16.lo minloc0_16_r16.lo
+am__objects_9 = minloc1_4_i4.lo minloc1_8_i4.lo minloc1_16_i4.lo \
+	minloc1_4_i8.lo minloc1_8_i8.lo minloc1_16_i8.lo \
+	minloc1_4_i16.lo minloc1_8_i16.lo minloc1_16_i16.lo \
+	minloc1_4_r4.lo minloc1_8_r4.lo minloc1_16_r4.lo \
+	minloc1_4_r8.lo minloc1_8_r8.lo minloc1_16_r8.lo \
+	minloc1_4_r10.lo minloc1_8_r10.lo minloc1_16_r10.lo \
+	minloc1_4_r16.lo minloc1_8_r16.lo minloc1_16_r16.lo
+am__objects_10 = minval_i4.lo minval_i8.lo minval_i16.lo minval_r4.lo \
+	minval_r8.lo minval_r10.lo minval_r16.lo
+am__objects_11 = product_i4.lo product_i8.lo product_i16.lo \
+	product_r4.lo product_r8.lo product_r10.lo product_r16.lo \
+	product_c4.lo product_c8.lo product_c10.lo product_c16.lo
+am__objects_12 = sum_i4.lo sum_i8.lo sum_i16.lo sum_r4.lo sum_r8.lo \
+	sum_r10.lo sum_r16.lo sum_c4.lo sum_c8.lo sum_c10.lo \
+	sum_c16.lo
+am__objects_13 = dotprod_i4.lo dotprod_i8.lo dotprod_i16.lo \
+	dotprod_r4.lo dotprod_r8.lo dotprod_r10.lo dotprod_r16.lo
+am__objects_14 = dotprod_l4.lo dotprod_l8.lo dotprod_l16.lo
+am__objects_15 = dotprod_c4.lo dotprod_c8.lo dotprod_c10.lo \
+	dotprod_c16.lo
+am__objects_16 = matmul_i4.lo matmul_i8.lo matmul_i16.lo matmul_r4.lo \
+	matmul_r8.lo matmul_r10.lo matmul_r16.lo matmul_c4.lo \
+	matmul_c8.lo matmul_c10.lo matmul_c16.lo
+am__objects_17 = matmul_l4.lo matmul_l8.lo matmul_l16.lo
+am__objects_18 = transpose_i4.lo transpose_i8.lo transpose_i16.lo \
+	transpose_c4.lo transpose_c8.lo transpose_c10.lo \
+	transpose_c16.lo
+am__objects_19 = shape_i4.lo shape_i8.lo shape_i16.lo
+am__objects_20 = eoshift1_4.lo eoshift1_8.lo eoshift1_16.lo
+am__objects_21 = eoshift3_4.lo eoshift3_8.lo eoshift3_16.lo
+am__objects_22 = cshift1_4.lo cshift1_8.lo cshift1_16.lo
+am__objects_23 = reshape_i4.lo reshape_i8.lo reshape_i16.lo \
+	reshape_c4.lo reshape_c8.lo reshape_c10.lo reshape_c16.lo
+am__objects_24 = in_pack_i4.lo in_pack_i8.lo in_pack_i16.lo \
+	in_pack_c4.lo in_pack_c8.lo in_pack_c10.lo in_pack_c16.lo
+am__objects_25 = in_unpack_i4.lo in_unpack_i8.lo in_unpack_i16.lo \
+	in_unpack_c4.lo in_unpack_c8.lo in_unpack_c10.lo \
+	in_unpack_c16.lo
+am__objects_26 = exponent_r4.lo exponent_r8.lo exponent_r10.lo \
+	exponent_r16.lo
+am__objects_27 = fraction_r4.lo fraction_r8.lo fraction_r10.lo \
+	fraction_r16.lo
+am__objects_28 = nearest_r4.lo nearest_r8.lo nearest_r10.lo \
+	nearest_r16.lo
+am__objects_29 = set_exponent_r4.lo set_exponent_r8.lo \
+	set_exponent_r10.lo set_exponent_r16.lo
+am__objects_30 = pow_i4_i4.lo pow_i8_i4.lo pow_i16_i4.lo pow_r4_i4.lo \
+	pow_r8_i4.lo pow_r10_i4.lo pow_r16_i4.lo pow_c4_i4.lo \
+	pow_c8_i4.lo pow_c10_i4.lo pow_c16_i4.lo pow_i4_i8.lo \
+	pow_i8_i8.lo pow_i16_i8.lo pow_r4_i8.lo pow_r8_i8.lo \
+	pow_r10_i8.lo pow_r16_i8.lo pow_c4_i8.lo pow_c8_i8.lo \
+	pow_c10_i8.lo pow_c16_i8.lo pow_i4_i16.lo pow_i8_i16.lo \
+	pow_i16_i16.lo pow_r4_i16.lo pow_r8_i16.lo pow_r10_i16.lo \
+	pow_r16_i16.lo pow_c4_i16.lo pow_c8_i16.lo pow_c10_i16.lo \
+	pow_c16_i16.lo
 am__objects_31 = $(am__objects_2) $(am__objects_3) $(am__objects_4) \
 	$(am__objects_5) $(am__objects_6) $(am__objects_7) \
 	$(am__objects_8) $(am__objects_9) $(am__objects_10) \
@@ -142,19 +177,31 @@ am__objects_33 = associated.lo abort.lo args.lo bessel.lo \
 	tty.lo umask.lo unlink.lo unpack_generic.lo in_pack_generic.lo \
 	in_unpack_generic.lo normalize.lo
 am__objects_34 =
-am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_i4.lo _abs_i8.lo \
-	_abs_r4.lo _abs_r8.lo _exp_r4.lo _exp_r8.lo _exp_c4.lo \
-	_exp_c8.lo _log_r4.lo _log_r8.lo _log_c4.lo _log_c8.lo \
-	_log10_r4.lo _log10_r8.lo _sqrt_r4.lo _sqrt_r8.lo _sqrt_c4.lo \
-	_sqrt_c8.lo _asin_r4.lo _asin_r8.lo _acos_r4.lo _acos_r8.lo \
-	_atan_r4.lo _atan_r8.lo _sin_r4.lo _sin_r8.lo _sin_c4.lo \
-	_sin_c8.lo _cos_r4.lo _cos_r8.lo _cos_c4.lo _cos_c8.lo \
-	_tan_r4.lo _tan_r8.lo _sinh_r4.lo _sinh_r8.lo _cosh_r4.lo \
-	_cosh_r8.lo _tanh_r4.lo _tanh_r8.lo _conjg_c4.lo _conjg_c8.lo \
-	_aint_r4.lo _aint_r8.lo _anint_r4.lo _anint_r8.lo
-am__objects_36 = _sign_i4.lo _sign_i8.lo _sign_r4.lo _sign_r8.lo \
-	_dim_i4.lo _dim_i8.lo _dim_r4.lo _dim_r8.lo _atan2_r4.lo \
-	_atan2_r8.lo _mod_i4.lo _mod_i8.lo _mod_r4.lo _mod_r8.lo
+am__objects_35 = _abs_c4.lo _abs_c8.lo _abs_c10.lo _abs_c16.lo \
+	_abs_i4.lo _abs_i8.lo _abs_i16.lo _abs_r4.lo _abs_r8.lo \
+	_abs_r10.lo _abs_r16.lo _exp_r4.lo _exp_r8.lo _exp_r10.lo \
+	_exp_r16.lo _exp_c4.lo _exp_c8.lo _exp_c10.lo _exp_c16.lo \
+	_log_r4.lo _log_r8.lo _log_r10.lo _log_r16.lo _log_c4.lo \
+	_log_c8.lo _log_c10.lo _log_c16.lo _log10_r4.lo _log10_r8.lo \
+	_log10_r10.lo _log10_r16.lo _sqrt_r4.lo _sqrt_r8.lo \
+	_sqrt_r10.lo _sqrt_r16.lo _sqrt_c4.lo _sqrt_c8.lo _sqrt_c10.lo \
+	_sqrt_c16.lo _asin_r4.lo _asin_r8.lo _asin_r10.lo _asin_r16.lo \
+	_acos_r4.lo _acos_r8.lo _acos_r10.lo _acos_r16.lo _atan_r4.lo \
+	_atan_r8.lo _atan_r10.lo _atan_r16.lo _sin_r4.lo _sin_r8.lo \
+	_sin_r10.lo _sin_r16.lo _sin_c4.lo _sin_c8.lo _sin_c10.lo \
+	_sin_c16.lo _cos_r4.lo _cos_r8.lo _cos_r10.lo _cos_r16.lo \
+	_cos_c4.lo _cos_c8.lo _cos_c10.lo _cos_c16.lo _tan_r4.lo \
+	_tan_r8.lo _tan_r10.lo _tan_r16.lo _sinh_r4.lo _sinh_r8.lo \
+	_sinh_r10.lo _sinh_r16.lo _cosh_r4.lo _cosh_r8.lo _cosh_r10.lo \
+	_cosh_r16.lo _tanh_r4.lo _tanh_r8.lo _tanh_r10.lo _tanh_r16.lo \
+	_conjg_c4.lo _conjg_c8.lo _conjg_c10.lo _conjg_c16.lo \
+	_aint_r4.lo _aint_r8.lo _aint_r10.lo _aint_r16.lo _anint_r4.lo \
+	_anint_r8.lo _anint_r10.lo _anint_r16.lo
+am__objects_36 = _sign_i4.lo _sign_i8.lo _sign_i16.lo _sign_r4.lo \
+	_sign_r8.lo _sign_r10.lo _sign_r16.lo _dim_i4.lo _dim_i8.lo \
+	_dim_i16.lo _dim_r4.lo _dim_r8.lo _dim_r10.lo _dim_r16.lo \
+	_atan2_r4.lo _atan2_r8.lo _atan2_r10.lo _atan2_r16.lo \
+	_mod_i4.lo _mod_i8.lo _mod_i16.lo _mod_r4.lo _mod_r8.lo
 am__objects_37 = $(am__objects_35) $(am__objects_36) dprod_r8.lo \
 	f2c_specifics.lo
 am_libgfortran_la_OBJECTS = $(am__objects_1) $(am__objects_31) \
@@ -399,181 +446,313 @@ libgfortran.h
 
 i_all_c = \
 generated/all_l4.c \
-generated/all_l8.c
+generated/all_l8.c \
+generated/all_l16.c
 
 i_any_c = \
 generated/any_l4.c \
-generated/any_l8.c
+generated/any_l8.c \
+generated/any_l16.c
 
 i_count_c = \
 generated/count_4_l4.c \
 generated/count_8_l4.c \
+generated/count_16_l4.c \
 generated/count_4_l8.c \
-generated/count_8_l8.c
+generated/count_8_l8.c \
+generated/count_16_l8.c \
+generated/count_4_l16.c \
+generated/count_8_l16.c \
+generated/count_16_l16.c
 
 i_maxloc0_c = \
 generated/maxloc0_4_i4.c \
 generated/maxloc0_8_i4.c \
+generated/maxloc0_16_i4.c \
 generated/maxloc0_4_i8.c \
 generated/maxloc0_8_i8.c \
+generated/maxloc0_16_i8.c \
+generated/maxloc0_4_i16.c \
+generated/maxloc0_8_i16.c \
+generated/maxloc0_16_i16.c \
 generated/maxloc0_4_r4.c \
 generated/maxloc0_8_r4.c \
+generated/maxloc0_16_r4.c \
 generated/maxloc0_4_r8.c \
-generated/maxloc0_8_r8.c
+generated/maxloc0_8_r8.c \
+generated/maxloc0_16_r8.c \
+generated/maxloc0_4_r10.c \
+generated/maxloc0_8_r10.c \
+generated/maxloc0_16_r10.c \
+generated/maxloc0_4_r16.c \
+generated/maxloc0_8_r16.c \
+generated/maxloc0_16_r16.c
 
 i_maxloc1_c = \
 generated/maxloc1_4_i4.c \
 generated/maxloc1_8_i4.c \
+generated/maxloc1_16_i4.c \
 generated/maxloc1_4_i8.c \
 generated/maxloc1_8_i8.c \
+generated/maxloc1_16_i8.c \
+generated/maxloc1_4_i16.c \
+generated/maxloc1_8_i16.c \
+generated/maxloc1_16_i16.c \
 generated/maxloc1_4_r4.c \
 generated/maxloc1_8_r4.c \
+generated/maxloc1_16_r4.c \
 generated/maxloc1_4_r8.c \
-generated/maxloc1_8_r8.c
+generated/maxloc1_8_r8.c \
+generated/maxloc1_16_r8.c \
+generated/maxloc1_4_r10.c \
+generated/maxloc1_8_r10.c \
+generated/maxloc1_16_r10.c \
+generated/maxloc1_4_r16.c \
+generated/maxloc1_8_r16.c \
+generated/maxloc1_16_r16.c
 
 i_maxval_c = \
 generated/maxval_i4.c \
 generated/maxval_i8.c \
+generated/maxval_i16.c \
 generated/maxval_r4.c \
-generated/maxval_r8.c
+generated/maxval_r8.c \
+generated/maxval_r10.c \
+generated/maxval_r16.c
 
 i_minloc0_c = \
 generated/minloc0_4_i4.c \
 generated/minloc0_8_i4.c \
+generated/minloc0_16_i4.c \
 generated/minloc0_4_i8.c \
 generated/minloc0_8_i8.c \
+generated/minloc0_16_i8.c \
+generated/minloc0_4_i16.c \
+generated/minloc0_8_i16.c \
+generated/minloc0_16_i16.c \
 generated/minloc0_4_r4.c \
 generated/minloc0_8_r4.c \
+generated/minloc0_16_r4.c \
 generated/minloc0_4_r8.c \
-generated/minloc0_8_r8.c
+generated/minloc0_8_r8.c \
+generated/minloc0_16_r8.c \
+generated/minloc0_4_r10.c \
+generated/minloc0_8_r10.c \
+generated/minloc0_16_r10.c \
+generated/minloc0_4_r16.c \
+generated/minloc0_8_r16.c \
+generated/minloc0_16_r16.c
 
 i_minloc1_c = \
 generated/minloc1_4_i4.c \
 generated/minloc1_8_i4.c \
+generated/minloc1_16_i4.c \
 generated/minloc1_4_i8.c \
 generated/minloc1_8_i8.c \
+generated/minloc1_16_i8.c \
+generated/minloc1_4_i16.c \
+generated/minloc1_8_i16.c \
+generated/minloc1_16_i16.c \
 generated/minloc1_4_r4.c \
 generated/minloc1_8_r4.c \
+generated/minloc1_16_r4.c \
 generated/minloc1_4_r8.c \
-generated/minloc1_8_r8.c
+generated/minloc1_8_r8.c \
+generated/minloc1_16_r8.c \
+generated/minloc1_4_r10.c \
+generated/minloc1_8_r10.c \
+generated/minloc1_16_r10.c \
+generated/minloc1_4_r16.c \
+generated/minloc1_8_r16.c \
+generated/minloc1_16_r16.c
 
 i_minval_c = \
 generated/minval_i4.c \
 generated/minval_i8.c \
+generated/minval_i16.c \
 generated/minval_r4.c \
-generated/minval_r8.c
+generated/minval_r8.c \
+generated/minval_r10.c \
+generated/minval_r16.c
 
 i_sum_c = \
 generated/sum_i4.c \
 generated/sum_i8.c \
+generated/sum_i16.c \
 generated/sum_r4.c \
 generated/sum_r8.c \
+generated/sum_r10.c \
+generated/sum_r16.c \
 generated/sum_c4.c \
-generated/sum_c8.c
+generated/sum_c8.c \
+generated/sum_c10.c \
+generated/sum_c16.c
 
 i_product_c = \
 generated/product_i4.c \
 generated/product_i8.c \
+generated/product_i16.c \
 generated/product_r4.c \
 generated/product_r8.c \
+generated/product_r10.c \
+generated/product_r16.c \
 generated/product_c4.c \
-generated/product_c8.c
+generated/product_c8.c \
+generated/product_c10.c \
+generated/product_c16.c
 
 i_dotprod_c = \
 generated/dotprod_i4.c \
 generated/dotprod_i8.c \
+generated/dotprod_i16.c \
 generated/dotprod_r4.c \
-generated/dotprod_r8.c
+generated/dotprod_r8.c \
+generated/dotprod_r10.c \
+generated/dotprod_r16.c
 
 i_dotprodl_c = \
 generated/dotprod_l4.c \
-generated/dotprod_l8.c
+generated/dotprod_l8.c \
+generated/dotprod_l16.c
 
 i_dotprodc_c = \
 generated/dotprod_c4.c \
-generated/dotprod_c8.c
+generated/dotprod_c8.c \
+generated/dotprod_c10.c \
+generated/dotprod_c16.c
 
 i_matmul_c = \
 generated/matmul_i4.c \
 generated/matmul_i8.c \
+generated/matmul_i16.c \
 generated/matmul_r4.c \
 generated/matmul_r8.c \
+generated/matmul_r10.c \
+generated/matmul_r16.c \
 generated/matmul_c4.c \
-generated/matmul_c8.c
+generated/matmul_c8.c \
+generated/matmul_c10.c \
+generated/matmul_c16.c
 
 i_matmull_c = \
 generated/matmul_l4.c \
-generated/matmul_l8.c
+generated/matmul_l8.c \
+generated/matmul_l16.c
 
 i_transpose_c = \
 generated/transpose_i4.c \
 generated/transpose_i8.c \
+generated/transpose_i16.c \
 generated/transpose_c4.c \
-generated/transpose_c8.c
+generated/transpose_c8.c \
+generated/transpose_c10.c \
+generated/transpose_c16.c
 
 i_shape_c = \
 generated/shape_i4.c \
-generated/shape_i8.c
+generated/shape_i8.c \
+generated/shape_i16.c
 
 i_reshape_c = \
 generated/reshape_i4.c \
 generated/reshape_i8.c \
+generated/reshape_i16.c \
 generated/reshape_c4.c \
-generated/reshape_c8.c
+generated/reshape_c8.c \
+generated/reshape_c10.c \
+generated/reshape_c16.c
 
 i_eoshift1_c = \
 generated/eoshift1_4.c \
-generated/eoshift1_8.c
+generated/eoshift1_8.c \
+generated/eoshift1_16.c
 
 i_eoshift3_c = \
 generated/eoshift3_4.c \
-generated/eoshift3_8.c
+generated/eoshift3_8.c \
+generated/eoshift3_16.c
 
 i_cshift1_c = \
 generated/cshift1_4.c \
-generated/cshift1_8.c
+generated/cshift1_8.c \
+generated/cshift1_16.c
 
 in_pack_c = \
 generated/in_pack_i4.c \
 generated/in_pack_i8.c \
+generated/in_pack_i16.c \
 generated/in_pack_c4.c \
-generated/in_pack_c8.c
+generated/in_pack_c8.c \
+generated/in_pack_c10.c \
+generated/in_pack_c16.c
 
 in_unpack_c = \
 generated/in_unpack_i4.c \
 generated/in_unpack_i8.c \
+generated/in_unpack_i16.c \
 generated/in_unpack_c4.c \
-generated/in_unpack_c8.c
+generated/in_unpack_c8.c \
+generated/in_unpack_c10.c \
+generated/in_unpack_c16.c
 
 i_exponent_c = \
 generated/exponent_r4.c \
-generated/exponent_r8.c
+generated/exponent_r8.c \
+generated/exponent_r10.c \
+generated/exponent_r16.c
 
 i_fraction_c = \
 generated/fraction_r4.c \
-generated/fraction_r8.c
+generated/fraction_r8.c \
+generated/fraction_r10.c \
+generated/fraction_r16.c
 
 i_nearest_c = \
 generated/nearest_r4.c \
-generated/nearest_r8.c
+generated/nearest_r8.c \
+generated/nearest_r10.c \
+generated/nearest_r16.c
 
 i_set_exponent_c = \
 generated/set_exponent_r4.c \
-generated/set_exponent_r8.c
+generated/set_exponent_r8.c \
+generated/set_exponent_r10.c \
+generated/set_exponent_r16.c
 
 i_pow_c = \
 generated/pow_i4_i4.c \
 generated/pow_i8_i4.c \
+generated/pow_i16_i4.c \
 generated/pow_r4_i4.c \
 generated/pow_r8_i4.c \
+generated/pow_r10_i4.c \
+generated/pow_r16_i4.c \
 generated/pow_c4_i4.c \
 generated/pow_c8_i4.c \
+generated/pow_c10_i4.c \
+generated/pow_c16_i4.c \
 generated/pow_i4_i8.c \
 generated/pow_i8_i8.c \
+generated/pow_i16_i8.c \
 generated/pow_r4_i8.c \
 generated/pow_r8_i8.c \
+generated/pow_r10_i8.c \
+generated/pow_r16_i8.c \
 generated/pow_c4_i8.c \
-generated/pow_c8_i8.c
+generated/pow_c8_i8.c \
+generated/pow_c10_i8.c \
+generated/pow_c16_i8.c \
+generated/pow_i4_i16.c \
+generated/pow_i8_i16.c \
+generated/pow_i16_i16.c \
+generated/pow_r4_i16.c \
+generated/pow_r8_i16.c \
+generated/pow_r10_i16.c \
+generated/pow_r16_i16.c \
+generated/pow_c4_i16.c \
+generated/pow_c8_i16.c \
+generated/pow_c10_i16.c \
+generated/pow_c16_i16.c
 
 m4_files = m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \
     m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval.m4 \
@@ -591,76 +770,137 @@ gfor_built_src = $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
     $(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c) \
     $(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
     $(i_pow_c) \
-    selected_int_kind.inc selected_real_kind.inc kinds.h
+    selected_int_kind.inc selected_real_kind.inc kinds.h \
+    kinds.inc c99_protos.inc
 
 
 # Machine generated specifics
 gfor_built_specific_src = \
-generated/_abs_c4.f90 \
-generated/_abs_c8.f90 \
-generated/_abs_i4.f90 \
-generated/_abs_i8.f90 \
-generated/_abs_r4.f90 \
-generated/_abs_r8.f90 \
-generated/_exp_r4.f90 \
-generated/_exp_r8.f90 \
-generated/_exp_c4.f90 \
-generated/_exp_c8.f90 \
-generated/_log_r4.f90 \
-generated/_log_r8.f90 \
-generated/_log_c4.f90 \
-generated/_log_c8.f90 \
-generated/_log10_r4.f90 \
-generated/_log10_r8.f90 \
-generated/_sqrt_r4.f90 \
-generated/_sqrt_r8.f90 \
-generated/_sqrt_c4.f90 \
-generated/_sqrt_c8.f90 \
-generated/_asin_r4.f90 \
-generated/_asin_r8.f90 \
-generated/_acos_r4.f90 \
-generated/_acos_r8.f90 \
-generated/_atan_r4.f90 \
-generated/_atan_r8.f90 \
-generated/_sin_r4.f90 \
-generated/_sin_r8.f90 \
-generated/_sin_c4.f90 \
-generated/_sin_c8.f90 \
-generated/_cos_r4.f90 \
-generated/_cos_r8.f90 \
-generated/_cos_c4.f90 \
-generated/_cos_c8.f90 \
-generated/_tan_r4.f90 \
-generated/_tan_r8.f90 \
-generated/_sinh_r4.f90 \
-generated/_sinh_r8.f90 \
-generated/_cosh_r4.f90 \
-generated/_cosh_r8.f90 \
-generated/_tanh_r4.f90 \
-generated/_tanh_r8.f90 \
-generated/_conjg_c4.f90 \
-generated/_conjg_c8.f90 \
-generated/_aint_r4.f90 \
-generated/_aint_r8.f90 \
-generated/_anint_r4.f90 \
-generated/_anint_r8.f90
+generated/_abs_c4.F90 \
+generated/_abs_c8.F90 \
+generated/_abs_c10.F90 \
+generated/_abs_c16.F90 \
+generated/_abs_i4.F90 \
+generated/_abs_i8.F90 \
+generated/_abs_i16.F90 \
+generated/_abs_r4.F90 \
+generated/_abs_r8.F90 \
+generated/_abs_r10.F90 \
+generated/_abs_r16.F90 \
+generated/_exp_r4.F90 \
+generated/_exp_r8.F90 \
+generated/_exp_r10.F90 \
+generated/_exp_r16.F90 \
+generated/_exp_c4.F90 \
+generated/_exp_c8.F90 \
+generated/_exp_c10.F90 \
+generated/_exp_c16.F90 \
+generated/_log_r4.F90 \
+generated/_log_r8.F90 \
+generated/_log_r10.F90 \
+generated/_log_r16.F90 \
+generated/_log_c4.F90 \
+generated/_log_c8.F90 \
+generated/_log_c10.F90 \
+generated/_log_c16.F90 \
+generated/_log10_r4.F90 \
+generated/_log10_r8.F90 \
+generated/_log10_r10.F90 \
+generated/_log10_r16.F90 \
+generated/_sqrt_r4.F90 \
+generated/_sqrt_r8.F90 \
+generated/_sqrt_r10.F90 \
+generated/_sqrt_r16.F90 \
+generated/_sqrt_c4.F90 \
+generated/_sqrt_c8.F90 \
+generated/_sqrt_c10.F90 \
+generated/_sqrt_c16.F90 \
+generated/_asin_r4.F90 \
+generated/_asin_r8.F90 \
+generated/_asin_r10.F90 \
+generated/_asin_r16.F90 \
+generated/_acos_r4.F90 \
+generated/_acos_r8.F90 \
+generated/_acos_r10.F90 \
+generated/_acos_r16.F90 \
+generated/_atan_r4.F90 \
+generated/_atan_r8.F90 \
+generated/_atan_r10.F90 \
+generated/_atan_r16.F90 \
+generated/_sin_r4.F90 \
+generated/_sin_r8.F90 \
+generated/_sin_r10.F90 \
+generated/_sin_r16.F90 \
+generated/_sin_c4.F90 \
+generated/_sin_c8.F90 \
+generated/_sin_c10.F90 \
+generated/_sin_c16.F90 \
+generated/_cos_r4.F90 \
+generated/_cos_r8.F90 \
+generated/_cos_r10.F90 \
+generated/_cos_r16.F90 \
+generated/_cos_c4.F90 \
+generated/_cos_c8.F90 \
+generated/_cos_c10.F90 \
+generated/_cos_c16.F90 \
+generated/_tan_r4.F90 \
+generated/_tan_r8.F90 \
+generated/_tan_r10.F90 \
+generated/_tan_r16.F90 \
+generated/_sinh_r4.F90 \
+generated/_sinh_r8.F90 \
+generated/_sinh_r10.F90 \
+generated/_sinh_r16.F90 \
+generated/_cosh_r4.F90 \
+generated/_cosh_r8.F90 \
+generated/_cosh_r10.F90 \
+generated/_cosh_r16.F90 \
+generated/_tanh_r4.F90 \
+generated/_tanh_r8.F90 \
+generated/_tanh_r10.F90 \
+generated/_tanh_r16.F90 \
+generated/_conjg_c4.F90 \
+generated/_conjg_c8.F90 \
+generated/_conjg_c10.F90 \
+generated/_conjg_c16.F90 \
+generated/_aint_r4.F90 \
+generated/_aint_r8.F90 \
+generated/_aint_r10.F90 \
+generated/_aint_r16.F90 \
+generated/_anint_r4.F90 \
+generated/_anint_r8.F90 \
+generated/_anint_r10.F90 \
+generated/_anint_r16.F90
 
 gfor_built_specific2_src = \
-generated/_sign_i4.f90 \
-generated/_sign_i8.f90 \
-generated/_sign_r4.f90 \
-generated/_sign_r8.f90 \
-generated/_dim_i4.f90 \
-generated/_dim_i8.f90 \
-generated/_dim_r4.f90 \
-generated/_dim_r8.f90 \
-generated/_atan2_r4.f90 \
-generated/_atan2_r8.f90 \
-generated/_mod_i4.f90 \
-generated/_mod_i8.f90 \
-generated/_mod_r4.f90 \
-generated/_mod_r8.f90
-
+generated/_sign_i4.F90 \
+generated/_sign_i8.F90 \
+generated/_sign_i16.F90 \
+generated/_sign_r4.F90 \
+generated/_sign_r8.F90 \
+generated/_sign_r10.F90 \
+generated/_sign_r16.F90 \
+generated/_dim_i4.F90 \
+generated/_dim_i8.F90 \
+generated/_dim_i16.F90 \
+generated/_dim_r4.F90 \
+generated/_dim_r8.F90 \
+generated/_dim_r10.F90 \
+generated/_dim_r16.F90 \
+generated/_atan2_r4.F90 \
+generated/_atan2_r8.F90 \
+generated/_atan2_r10.F90 \
+generated/_atan2_r16.F90 \
+generated/_mod_i4.F90 \
+generated/_mod_i8.F90 \
+generated/_mod_i16.F90 \
+generated/_mod_r4.F90 \
+generated/_mod_r8.F90
+
+# There are commented out due to a bug in the way the front-end
+# handles MOD
+#generated/_mod_r10.F90
+#generated/_mod_r16.F90
 gfor_specific_src = \
 $(gfor_built_specific_src) \
 $(gfor_built_specific2_src) \
@@ -779,6 +1019,360 @@ distclean-compile:
 .F90.lo:
 	$(LTPPFCCOMPILE) -c -o $@ $<
 
+_abs_c4.lo: generated/_abs_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c4.lo `test -f 'generated/_abs_c4.F90' || echo '$(srcdir)/'`generated/_abs_c4.F90
+
+_abs_c8.lo: generated/_abs_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c8.lo `test -f 'generated/_abs_c8.F90' || echo '$(srcdir)/'`generated/_abs_c8.F90
+
+_abs_c10.lo: generated/_abs_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c10.lo `test -f 'generated/_abs_c10.F90' || echo '$(srcdir)/'`generated/_abs_c10.F90
+
+_abs_c16.lo: generated/_abs_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c16.lo `test -f 'generated/_abs_c16.F90' || echo '$(srcdir)/'`generated/_abs_c16.F90
+
+_abs_i4.lo: generated/_abs_i4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_i4.lo `test -f 'generated/_abs_i4.F90' || echo '$(srcdir)/'`generated/_abs_i4.F90
+
+_abs_i8.lo: generated/_abs_i8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_i8.lo `test -f 'generated/_abs_i8.F90' || echo '$(srcdir)/'`generated/_abs_i8.F90
+
+_abs_i16.lo: generated/_abs_i16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_i16.lo `test -f 'generated/_abs_i16.F90' || echo '$(srcdir)/'`generated/_abs_i16.F90
+
+_abs_r4.lo: generated/_abs_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r4.lo `test -f 'generated/_abs_r4.F90' || echo '$(srcdir)/'`generated/_abs_r4.F90
+
+_abs_r8.lo: generated/_abs_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r8.lo `test -f 'generated/_abs_r8.F90' || echo '$(srcdir)/'`generated/_abs_r8.F90
+
+_abs_r10.lo: generated/_abs_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r10.lo `test -f 'generated/_abs_r10.F90' || echo '$(srcdir)/'`generated/_abs_r10.F90
+
+_abs_r16.lo: generated/_abs_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r16.lo `test -f 'generated/_abs_r16.F90' || echo '$(srcdir)/'`generated/_abs_r16.F90
+
+_exp_r4.lo: generated/_exp_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r4.lo `test -f 'generated/_exp_r4.F90' || echo '$(srcdir)/'`generated/_exp_r4.F90
+
+_exp_r8.lo: generated/_exp_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r8.lo `test -f 'generated/_exp_r8.F90' || echo '$(srcdir)/'`generated/_exp_r8.F90
+
+_exp_r10.lo: generated/_exp_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r10.lo `test -f 'generated/_exp_r10.F90' || echo '$(srcdir)/'`generated/_exp_r10.F90
+
+_exp_r16.lo: generated/_exp_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r16.lo `test -f 'generated/_exp_r16.F90' || echo '$(srcdir)/'`generated/_exp_r16.F90
+
+_exp_c4.lo: generated/_exp_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c4.lo `test -f 'generated/_exp_c4.F90' || echo '$(srcdir)/'`generated/_exp_c4.F90
+
+_exp_c8.lo: generated/_exp_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c8.lo `test -f 'generated/_exp_c8.F90' || echo '$(srcdir)/'`generated/_exp_c8.F90
+
+_exp_c10.lo: generated/_exp_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c10.lo `test -f 'generated/_exp_c10.F90' || echo '$(srcdir)/'`generated/_exp_c10.F90
+
+_exp_c16.lo: generated/_exp_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c16.lo `test -f 'generated/_exp_c16.F90' || echo '$(srcdir)/'`generated/_exp_c16.F90
+
+_log_r4.lo: generated/_log_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r4.lo `test -f 'generated/_log_r4.F90' || echo '$(srcdir)/'`generated/_log_r4.F90
+
+_log_r8.lo: generated/_log_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r8.lo `test -f 'generated/_log_r8.F90' || echo '$(srcdir)/'`generated/_log_r8.F90
+
+_log_r10.lo: generated/_log_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r10.lo `test -f 'generated/_log_r10.F90' || echo '$(srcdir)/'`generated/_log_r10.F90
+
+_log_r16.lo: generated/_log_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r16.lo `test -f 'generated/_log_r16.F90' || echo '$(srcdir)/'`generated/_log_r16.F90
+
+_log_c4.lo: generated/_log_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c4.lo `test -f 'generated/_log_c4.F90' || echo '$(srcdir)/'`generated/_log_c4.F90
+
+_log_c8.lo: generated/_log_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c8.lo `test -f 'generated/_log_c8.F90' || echo '$(srcdir)/'`generated/_log_c8.F90
+
+_log_c10.lo: generated/_log_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c10.lo `test -f 'generated/_log_c10.F90' || echo '$(srcdir)/'`generated/_log_c10.F90
+
+_log_c16.lo: generated/_log_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c16.lo `test -f 'generated/_log_c16.F90' || echo '$(srcdir)/'`generated/_log_c16.F90
+
+_log10_r4.lo: generated/_log10_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r4.lo `test -f 'generated/_log10_r4.F90' || echo '$(srcdir)/'`generated/_log10_r4.F90
+
+_log10_r8.lo: generated/_log10_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r8.lo `test -f 'generated/_log10_r8.F90' || echo '$(srcdir)/'`generated/_log10_r8.F90
+
+_log10_r10.lo: generated/_log10_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r10.lo `test -f 'generated/_log10_r10.F90' || echo '$(srcdir)/'`generated/_log10_r10.F90
+
+_log10_r16.lo: generated/_log10_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r16.lo `test -f 'generated/_log10_r16.F90' || echo '$(srcdir)/'`generated/_log10_r16.F90
+
+_sqrt_r4.lo: generated/_sqrt_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r4.lo `test -f 'generated/_sqrt_r4.F90' || echo '$(srcdir)/'`generated/_sqrt_r4.F90
+
+_sqrt_r8.lo: generated/_sqrt_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r8.lo `test -f 'generated/_sqrt_r8.F90' || echo '$(srcdir)/'`generated/_sqrt_r8.F90
+
+_sqrt_r10.lo: generated/_sqrt_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r10.lo `test -f 'generated/_sqrt_r10.F90' || echo '$(srcdir)/'`generated/_sqrt_r10.F90
+
+_sqrt_r16.lo: generated/_sqrt_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r16.lo `test -f 'generated/_sqrt_r16.F90' || echo '$(srcdir)/'`generated/_sqrt_r16.F90
+
+_sqrt_c4.lo: generated/_sqrt_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c4.lo `test -f 'generated/_sqrt_c4.F90' || echo '$(srcdir)/'`generated/_sqrt_c4.F90
+
+_sqrt_c8.lo: generated/_sqrt_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c8.lo `test -f 'generated/_sqrt_c8.F90' || echo '$(srcdir)/'`generated/_sqrt_c8.F90
+
+_sqrt_c10.lo: generated/_sqrt_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c10.lo `test -f 'generated/_sqrt_c10.F90' || echo '$(srcdir)/'`generated/_sqrt_c10.F90
+
+_sqrt_c16.lo: generated/_sqrt_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c16.lo `test -f 'generated/_sqrt_c16.F90' || echo '$(srcdir)/'`generated/_sqrt_c16.F90
+
+_asin_r4.lo: generated/_asin_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r4.lo `test -f 'generated/_asin_r4.F90' || echo '$(srcdir)/'`generated/_asin_r4.F90
+
+_asin_r8.lo: generated/_asin_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r8.lo `test -f 'generated/_asin_r8.F90' || echo '$(srcdir)/'`generated/_asin_r8.F90
+
+_asin_r10.lo: generated/_asin_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r10.lo `test -f 'generated/_asin_r10.F90' || echo '$(srcdir)/'`generated/_asin_r10.F90
+
+_asin_r16.lo: generated/_asin_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r16.lo `test -f 'generated/_asin_r16.F90' || echo '$(srcdir)/'`generated/_asin_r16.F90
+
+_acos_r4.lo: generated/_acos_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r4.lo `test -f 'generated/_acos_r4.F90' || echo '$(srcdir)/'`generated/_acos_r4.F90
+
+_acos_r8.lo: generated/_acos_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r8.lo `test -f 'generated/_acos_r8.F90' || echo '$(srcdir)/'`generated/_acos_r8.F90
+
+_acos_r10.lo: generated/_acos_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r10.lo `test -f 'generated/_acos_r10.F90' || echo '$(srcdir)/'`generated/_acos_r10.F90
+
+_acos_r16.lo: generated/_acos_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r16.lo `test -f 'generated/_acos_r16.F90' || echo '$(srcdir)/'`generated/_acos_r16.F90
+
+_atan_r4.lo: generated/_atan_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r4.lo `test -f 'generated/_atan_r4.F90' || echo '$(srcdir)/'`generated/_atan_r4.F90
+
+_atan_r8.lo: generated/_atan_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r8.lo `test -f 'generated/_atan_r8.F90' || echo '$(srcdir)/'`generated/_atan_r8.F90
+
+_atan_r10.lo: generated/_atan_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r10.lo `test -f 'generated/_atan_r10.F90' || echo '$(srcdir)/'`generated/_atan_r10.F90
+
+_atan_r16.lo: generated/_atan_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r16.lo `test -f 'generated/_atan_r16.F90' || echo '$(srcdir)/'`generated/_atan_r16.F90
+
+_sin_r4.lo: generated/_sin_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r4.lo `test -f 'generated/_sin_r4.F90' || echo '$(srcdir)/'`generated/_sin_r4.F90
+
+_sin_r8.lo: generated/_sin_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r8.lo `test -f 'generated/_sin_r8.F90' || echo '$(srcdir)/'`generated/_sin_r8.F90
+
+_sin_r10.lo: generated/_sin_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r10.lo `test -f 'generated/_sin_r10.F90' || echo '$(srcdir)/'`generated/_sin_r10.F90
+
+_sin_r16.lo: generated/_sin_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r16.lo `test -f 'generated/_sin_r16.F90' || echo '$(srcdir)/'`generated/_sin_r16.F90
+
+_sin_c4.lo: generated/_sin_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c4.lo `test -f 'generated/_sin_c4.F90' || echo '$(srcdir)/'`generated/_sin_c4.F90
+
+_sin_c8.lo: generated/_sin_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c8.lo `test -f 'generated/_sin_c8.F90' || echo '$(srcdir)/'`generated/_sin_c8.F90
+
+_sin_c10.lo: generated/_sin_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c10.lo `test -f 'generated/_sin_c10.F90' || echo '$(srcdir)/'`generated/_sin_c10.F90
+
+_sin_c16.lo: generated/_sin_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c16.lo `test -f 'generated/_sin_c16.F90' || echo '$(srcdir)/'`generated/_sin_c16.F90
+
+_cos_r4.lo: generated/_cos_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r4.lo `test -f 'generated/_cos_r4.F90' || echo '$(srcdir)/'`generated/_cos_r4.F90
+
+_cos_r8.lo: generated/_cos_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r8.lo `test -f 'generated/_cos_r8.F90' || echo '$(srcdir)/'`generated/_cos_r8.F90
+
+_cos_r10.lo: generated/_cos_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r10.lo `test -f 'generated/_cos_r10.F90' || echo '$(srcdir)/'`generated/_cos_r10.F90
+
+_cos_r16.lo: generated/_cos_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r16.lo `test -f 'generated/_cos_r16.F90' || echo '$(srcdir)/'`generated/_cos_r16.F90
+
+_cos_c4.lo: generated/_cos_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c4.lo `test -f 'generated/_cos_c4.F90' || echo '$(srcdir)/'`generated/_cos_c4.F90
+
+_cos_c8.lo: generated/_cos_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c8.lo `test -f 'generated/_cos_c8.F90' || echo '$(srcdir)/'`generated/_cos_c8.F90
+
+_cos_c10.lo: generated/_cos_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c10.lo `test -f 'generated/_cos_c10.F90' || echo '$(srcdir)/'`generated/_cos_c10.F90
+
+_cos_c16.lo: generated/_cos_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c16.lo `test -f 'generated/_cos_c16.F90' || echo '$(srcdir)/'`generated/_cos_c16.F90
+
+_tan_r4.lo: generated/_tan_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r4.lo `test -f 'generated/_tan_r4.F90' || echo '$(srcdir)/'`generated/_tan_r4.F90
+
+_tan_r8.lo: generated/_tan_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r8.lo `test -f 'generated/_tan_r8.F90' || echo '$(srcdir)/'`generated/_tan_r8.F90
+
+_tan_r10.lo: generated/_tan_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r10.lo `test -f 'generated/_tan_r10.F90' || echo '$(srcdir)/'`generated/_tan_r10.F90
+
+_tan_r16.lo: generated/_tan_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r16.lo `test -f 'generated/_tan_r16.F90' || echo '$(srcdir)/'`generated/_tan_r16.F90
+
+_sinh_r4.lo: generated/_sinh_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r4.lo `test -f 'generated/_sinh_r4.F90' || echo '$(srcdir)/'`generated/_sinh_r4.F90
+
+_sinh_r8.lo: generated/_sinh_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r8.lo `test -f 'generated/_sinh_r8.F90' || echo '$(srcdir)/'`generated/_sinh_r8.F90
+
+_sinh_r10.lo: generated/_sinh_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r10.lo `test -f 'generated/_sinh_r10.F90' || echo '$(srcdir)/'`generated/_sinh_r10.F90
+
+_sinh_r16.lo: generated/_sinh_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r16.lo `test -f 'generated/_sinh_r16.F90' || echo '$(srcdir)/'`generated/_sinh_r16.F90
+
+_cosh_r4.lo: generated/_cosh_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r4.lo `test -f 'generated/_cosh_r4.F90' || echo '$(srcdir)/'`generated/_cosh_r4.F90
+
+_cosh_r8.lo: generated/_cosh_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r8.lo `test -f 'generated/_cosh_r8.F90' || echo '$(srcdir)/'`generated/_cosh_r8.F90
+
+_cosh_r10.lo: generated/_cosh_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r10.lo `test -f 'generated/_cosh_r10.F90' || echo '$(srcdir)/'`generated/_cosh_r10.F90
+
+_cosh_r16.lo: generated/_cosh_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r16.lo `test -f 'generated/_cosh_r16.F90' || echo '$(srcdir)/'`generated/_cosh_r16.F90
+
+_tanh_r4.lo: generated/_tanh_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r4.lo `test -f 'generated/_tanh_r4.F90' || echo '$(srcdir)/'`generated/_tanh_r4.F90
+
+_tanh_r8.lo: generated/_tanh_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r8.lo `test -f 'generated/_tanh_r8.F90' || echo '$(srcdir)/'`generated/_tanh_r8.F90
+
+_tanh_r10.lo: generated/_tanh_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r10.lo `test -f 'generated/_tanh_r10.F90' || echo '$(srcdir)/'`generated/_tanh_r10.F90
+
+_tanh_r16.lo: generated/_tanh_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r16.lo `test -f 'generated/_tanh_r16.F90' || echo '$(srcdir)/'`generated/_tanh_r16.F90
+
+_conjg_c4.lo: generated/_conjg_c4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c4.lo `test -f 'generated/_conjg_c4.F90' || echo '$(srcdir)/'`generated/_conjg_c4.F90
+
+_conjg_c8.lo: generated/_conjg_c8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c8.lo `test -f 'generated/_conjg_c8.F90' || echo '$(srcdir)/'`generated/_conjg_c8.F90
+
+_conjg_c10.lo: generated/_conjg_c10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c10.lo `test -f 'generated/_conjg_c10.F90' || echo '$(srcdir)/'`generated/_conjg_c10.F90
+
+_conjg_c16.lo: generated/_conjg_c16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c16.lo `test -f 'generated/_conjg_c16.F90' || echo '$(srcdir)/'`generated/_conjg_c16.F90
+
+_aint_r4.lo: generated/_aint_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r4.lo `test -f 'generated/_aint_r4.F90' || echo '$(srcdir)/'`generated/_aint_r4.F90
+
+_aint_r8.lo: generated/_aint_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r8.lo `test -f 'generated/_aint_r8.F90' || echo '$(srcdir)/'`generated/_aint_r8.F90
+
+_aint_r10.lo: generated/_aint_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r10.lo `test -f 'generated/_aint_r10.F90' || echo '$(srcdir)/'`generated/_aint_r10.F90
+
+_aint_r16.lo: generated/_aint_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r16.lo `test -f 'generated/_aint_r16.F90' || echo '$(srcdir)/'`generated/_aint_r16.F90
+
+_anint_r4.lo: generated/_anint_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r4.lo `test -f 'generated/_anint_r4.F90' || echo '$(srcdir)/'`generated/_anint_r4.F90
+
+_anint_r8.lo: generated/_anint_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r8.lo `test -f 'generated/_anint_r8.F90' || echo '$(srcdir)/'`generated/_anint_r8.F90
+
+_anint_r10.lo: generated/_anint_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r10.lo `test -f 'generated/_anint_r10.F90' || echo '$(srcdir)/'`generated/_anint_r10.F90
+
+_anint_r16.lo: generated/_anint_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r16.lo `test -f 'generated/_anint_r16.F90' || echo '$(srcdir)/'`generated/_anint_r16.F90
+
+_sign_i4.lo: generated/_sign_i4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_i4.lo `test -f 'generated/_sign_i4.F90' || echo '$(srcdir)/'`generated/_sign_i4.F90
+
+_sign_i8.lo: generated/_sign_i8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_i8.lo `test -f 'generated/_sign_i8.F90' || echo '$(srcdir)/'`generated/_sign_i8.F90
+
+_sign_i16.lo: generated/_sign_i16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_i16.lo `test -f 'generated/_sign_i16.F90' || echo '$(srcdir)/'`generated/_sign_i16.F90
+
+_sign_r4.lo: generated/_sign_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r4.lo `test -f 'generated/_sign_r4.F90' || echo '$(srcdir)/'`generated/_sign_r4.F90
+
+_sign_r8.lo: generated/_sign_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r8.lo `test -f 'generated/_sign_r8.F90' || echo '$(srcdir)/'`generated/_sign_r8.F90
+
+_sign_r10.lo: generated/_sign_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r10.lo `test -f 'generated/_sign_r10.F90' || echo '$(srcdir)/'`generated/_sign_r10.F90
+
+_sign_r16.lo: generated/_sign_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r16.lo `test -f 'generated/_sign_r16.F90' || echo '$(srcdir)/'`generated/_sign_r16.F90
+
+_dim_i4.lo: generated/_dim_i4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_i4.lo `test -f 'generated/_dim_i4.F90' || echo '$(srcdir)/'`generated/_dim_i4.F90
+
+_dim_i8.lo: generated/_dim_i8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_i8.lo `test -f 'generated/_dim_i8.F90' || echo '$(srcdir)/'`generated/_dim_i8.F90
+
+_dim_i16.lo: generated/_dim_i16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_i16.lo `test -f 'generated/_dim_i16.F90' || echo '$(srcdir)/'`generated/_dim_i16.F90
+
+_dim_r4.lo: generated/_dim_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r4.lo `test -f 'generated/_dim_r4.F90' || echo '$(srcdir)/'`generated/_dim_r4.F90
+
+_dim_r8.lo: generated/_dim_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r8.lo `test -f 'generated/_dim_r8.F90' || echo '$(srcdir)/'`generated/_dim_r8.F90
+
+_dim_r10.lo: generated/_dim_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r10.lo `test -f 'generated/_dim_r10.F90' || echo '$(srcdir)/'`generated/_dim_r10.F90
+
+_dim_r16.lo: generated/_dim_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r16.lo `test -f 'generated/_dim_r16.F90' || echo '$(srcdir)/'`generated/_dim_r16.F90
+
+_atan2_r4.lo: generated/_atan2_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r4.lo `test -f 'generated/_atan2_r4.F90' || echo '$(srcdir)/'`generated/_atan2_r4.F90
+
+_atan2_r8.lo: generated/_atan2_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r8.lo `test -f 'generated/_atan2_r8.F90' || echo '$(srcdir)/'`generated/_atan2_r8.F90
+
+_atan2_r10.lo: generated/_atan2_r10.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r10.lo `test -f 'generated/_atan2_r10.F90' || echo '$(srcdir)/'`generated/_atan2_r10.F90
+
+_atan2_r16.lo: generated/_atan2_r16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r16.lo `test -f 'generated/_atan2_r16.F90' || echo '$(srcdir)/'`generated/_atan2_r16.F90
+
+_mod_i4.lo: generated/_mod_i4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_i4.lo `test -f 'generated/_mod_i4.F90' || echo '$(srcdir)/'`generated/_mod_i4.F90
+
+_mod_i8.lo: generated/_mod_i8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_i8.lo `test -f 'generated/_mod_i8.F90' || echo '$(srcdir)/'`generated/_mod_i8.F90
+
+_mod_i16.lo: generated/_mod_i16.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_i16.lo `test -f 'generated/_mod_i16.F90' || echo '$(srcdir)/'`generated/_mod_i16.F90
+
+_mod_r4.lo: generated/_mod_r4.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_r4.lo `test -f 'generated/_mod_r4.F90' || echo '$(srcdir)/'`generated/_mod_r4.F90
+
+_mod_r8.lo: generated/_mod_r8.F90
+	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_r8.lo `test -f 'generated/_mod_r8.F90' || echo '$(srcdir)/'`generated/_mod_r8.F90
+
 f2c_specifics.lo: intrinsics/f2c_specifics.F90
 	$(LIBTOOL) --mode=compile $(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS) -c -o f2c_specifics.lo `test -f 'intrinsics/f2c_specifics.F90' || echo '$(srcdir)/'`intrinsics/f2c_specifics.F90
 
@@ -824,360 +1418,756 @@ all_l4.lo: generated/all_l4.c
 all_l8.lo: generated/all_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o all_l8.lo `test -f 'generated/all_l8.c' || echo '$(srcdir)/'`generated/all_l8.c
 
+all_l16.lo: generated/all_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o all_l16.lo `test -f 'generated/all_l16.c' || echo '$(srcdir)/'`generated/all_l16.c
+
 any_l4.lo: generated/any_l4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o any_l4.lo `test -f 'generated/any_l4.c' || echo '$(srcdir)/'`generated/any_l4.c
 
 any_l8.lo: generated/any_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o any_l8.lo `test -f 'generated/any_l8.c' || echo '$(srcdir)/'`generated/any_l8.c
 
+any_l16.lo: generated/any_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o any_l16.lo `test -f 'generated/any_l16.c' || echo '$(srcdir)/'`generated/any_l16.c
+
 count_4_l4.lo: generated/count_4_l4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_4_l4.lo `test -f 'generated/count_4_l4.c' || echo '$(srcdir)/'`generated/count_4_l4.c
 
 count_8_l4.lo: generated/count_8_l4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_8_l4.lo `test -f 'generated/count_8_l4.c' || echo '$(srcdir)/'`generated/count_8_l4.c
 
+count_16_l4.lo: generated/count_16_l4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_16_l4.lo `test -f 'generated/count_16_l4.c' || echo '$(srcdir)/'`generated/count_16_l4.c
+
 count_4_l8.lo: generated/count_4_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_4_l8.lo `test -f 'generated/count_4_l8.c' || echo '$(srcdir)/'`generated/count_4_l8.c
 
 count_8_l8.lo: generated/count_8_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_8_l8.lo `test -f 'generated/count_8_l8.c' || echo '$(srcdir)/'`generated/count_8_l8.c
 
+count_16_l8.lo: generated/count_16_l8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_16_l8.lo `test -f 'generated/count_16_l8.c' || echo '$(srcdir)/'`generated/count_16_l8.c
+
+count_4_l16.lo: generated/count_4_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_4_l16.lo `test -f 'generated/count_4_l16.c' || echo '$(srcdir)/'`generated/count_4_l16.c
+
+count_8_l16.lo: generated/count_8_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_8_l16.lo `test -f 'generated/count_8_l16.c' || echo '$(srcdir)/'`generated/count_8_l16.c
+
+count_16_l16.lo: generated/count_16_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o count_16_l16.lo `test -f 'generated/count_16_l16.c' || echo '$(srcdir)/'`generated/count_16_l16.c
+
 maxloc0_4_i4.lo: generated/maxloc0_4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_i4.lo `test -f 'generated/maxloc0_4_i4.c' || echo '$(srcdir)/'`generated/maxloc0_4_i4.c
 
 maxloc0_8_i4.lo: generated/maxloc0_8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_i4.lo `test -f 'generated/maxloc0_8_i4.c' || echo '$(srcdir)/'`generated/maxloc0_8_i4.c
 
+maxloc0_16_i4.lo: generated/maxloc0_16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_i4.lo `test -f 'generated/maxloc0_16_i4.c' || echo '$(srcdir)/'`generated/maxloc0_16_i4.c
+
 maxloc0_4_i8.lo: generated/maxloc0_4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_i8.lo `test -f 'generated/maxloc0_4_i8.c' || echo '$(srcdir)/'`generated/maxloc0_4_i8.c
 
 maxloc0_8_i8.lo: generated/maxloc0_8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_i8.lo `test -f 'generated/maxloc0_8_i8.c' || echo '$(srcdir)/'`generated/maxloc0_8_i8.c
 
+maxloc0_16_i8.lo: generated/maxloc0_16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_i8.lo `test -f 'generated/maxloc0_16_i8.c' || echo '$(srcdir)/'`generated/maxloc0_16_i8.c
+
+maxloc0_4_i16.lo: generated/maxloc0_4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_i16.lo `test -f 'generated/maxloc0_4_i16.c' || echo '$(srcdir)/'`generated/maxloc0_4_i16.c
+
+maxloc0_8_i16.lo: generated/maxloc0_8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_i16.lo `test -f 'generated/maxloc0_8_i16.c' || echo '$(srcdir)/'`generated/maxloc0_8_i16.c
+
+maxloc0_16_i16.lo: generated/maxloc0_16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_i16.lo `test -f 'generated/maxloc0_16_i16.c' || echo '$(srcdir)/'`generated/maxloc0_16_i16.c
+
 maxloc0_4_r4.lo: generated/maxloc0_4_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_r4.lo `test -f 'generated/maxloc0_4_r4.c' || echo '$(srcdir)/'`generated/maxloc0_4_r4.c
 
 maxloc0_8_r4.lo: generated/maxloc0_8_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_r4.lo `test -f 'generated/maxloc0_8_r4.c' || echo '$(srcdir)/'`generated/maxloc0_8_r4.c
 
+maxloc0_16_r4.lo: generated/maxloc0_16_r4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_r4.lo `test -f 'generated/maxloc0_16_r4.c' || echo '$(srcdir)/'`generated/maxloc0_16_r4.c
+
 maxloc0_4_r8.lo: generated/maxloc0_4_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_r8.lo `test -f 'generated/maxloc0_4_r8.c' || echo '$(srcdir)/'`generated/maxloc0_4_r8.c
 
 maxloc0_8_r8.lo: generated/maxloc0_8_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_r8.lo `test -f 'generated/maxloc0_8_r8.c' || echo '$(srcdir)/'`generated/maxloc0_8_r8.c
 
+maxloc0_16_r8.lo: generated/maxloc0_16_r8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_r8.lo `test -f 'generated/maxloc0_16_r8.c' || echo '$(srcdir)/'`generated/maxloc0_16_r8.c
+
+maxloc0_4_r10.lo: generated/maxloc0_4_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_r10.lo `test -f 'generated/maxloc0_4_r10.c' || echo '$(srcdir)/'`generated/maxloc0_4_r10.c
+
+maxloc0_8_r10.lo: generated/maxloc0_8_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_r10.lo `test -f 'generated/maxloc0_8_r10.c' || echo '$(srcdir)/'`generated/maxloc0_8_r10.c
+
+maxloc0_16_r10.lo: generated/maxloc0_16_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_r10.lo `test -f 'generated/maxloc0_16_r10.c' || echo '$(srcdir)/'`generated/maxloc0_16_r10.c
+
+maxloc0_4_r16.lo: generated/maxloc0_4_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_4_r16.lo `test -f 'generated/maxloc0_4_r16.c' || echo '$(srcdir)/'`generated/maxloc0_4_r16.c
+
+maxloc0_8_r16.lo: generated/maxloc0_8_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_8_r16.lo `test -f 'generated/maxloc0_8_r16.c' || echo '$(srcdir)/'`generated/maxloc0_8_r16.c
+
+maxloc0_16_r16.lo: generated/maxloc0_16_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc0_16_r16.lo `test -f 'generated/maxloc0_16_r16.c' || echo '$(srcdir)/'`generated/maxloc0_16_r16.c
+
 maxloc1_4_i4.lo: generated/maxloc1_4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_i4.lo `test -f 'generated/maxloc1_4_i4.c' || echo '$(srcdir)/'`generated/maxloc1_4_i4.c
 
 maxloc1_8_i4.lo: generated/maxloc1_8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_i4.lo `test -f 'generated/maxloc1_8_i4.c' || echo '$(srcdir)/'`generated/maxloc1_8_i4.c
 
+maxloc1_16_i4.lo: generated/maxloc1_16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_i4.lo `test -f 'generated/maxloc1_16_i4.c' || echo '$(srcdir)/'`generated/maxloc1_16_i4.c
+
 maxloc1_4_i8.lo: generated/maxloc1_4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_i8.lo `test -f 'generated/maxloc1_4_i8.c' || echo '$(srcdir)/'`generated/maxloc1_4_i8.c
 
 maxloc1_8_i8.lo: generated/maxloc1_8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_i8.lo `test -f 'generated/maxloc1_8_i8.c' || echo '$(srcdir)/'`generated/maxloc1_8_i8.c
 
+maxloc1_16_i8.lo: generated/maxloc1_16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_i8.lo `test -f 'generated/maxloc1_16_i8.c' || echo '$(srcdir)/'`generated/maxloc1_16_i8.c
+
+maxloc1_4_i16.lo: generated/maxloc1_4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_i16.lo `test -f 'generated/maxloc1_4_i16.c' || echo '$(srcdir)/'`generated/maxloc1_4_i16.c
+
+maxloc1_8_i16.lo: generated/maxloc1_8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_i16.lo `test -f 'generated/maxloc1_8_i16.c' || echo '$(srcdir)/'`generated/maxloc1_8_i16.c
+
+maxloc1_16_i16.lo: generated/maxloc1_16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_i16.lo `test -f 'generated/maxloc1_16_i16.c' || echo '$(srcdir)/'`generated/maxloc1_16_i16.c
+
 maxloc1_4_r4.lo: generated/maxloc1_4_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_r4.lo `test -f 'generated/maxloc1_4_r4.c' || echo '$(srcdir)/'`generated/maxloc1_4_r4.c
 
 maxloc1_8_r4.lo: generated/maxloc1_8_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_r4.lo `test -f 'generated/maxloc1_8_r4.c' || echo '$(srcdir)/'`generated/maxloc1_8_r4.c
 
+maxloc1_16_r4.lo: generated/maxloc1_16_r4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_r4.lo `test -f 'generated/maxloc1_16_r4.c' || echo '$(srcdir)/'`generated/maxloc1_16_r4.c
+
 maxloc1_4_r8.lo: generated/maxloc1_4_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_r8.lo `test -f 'generated/maxloc1_4_r8.c' || echo '$(srcdir)/'`generated/maxloc1_4_r8.c
 
 maxloc1_8_r8.lo: generated/maxloc1_8_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_r8.lo `test -f 'generated/maxloc1_8_r8.c' || echo '$(srcdir)/'`generated/maxloc1_8_r8.c
 
+maxloc1_16_r8.lo: generated/maxloc1_16_r8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_r8.lo `test -f 'generated/maxloc1_16_r8.c' || echo '$(srcdir)/'`generated/maxloc1_16_r8.c
+
+maxloc1_4_r10.lo: generated/maxloc1_4_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_r10.lo `test -f 'generated/maxloc1_4_r10.c' || echo '$(srcdir)/'`generated/maxloc1_4_r10.c
+
+maxloc1_8_r10.lo: generated/maxloc1_8_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_r10.lo `test -f 'generated/maxloc1_8_r10.c' || echo '$(srcdir)/'`generated/maxloc1_8_r10.c
+
+maxloc1_16_r10.lo: generated/maxloc1_16_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_r10.lo `test -f 'generated/maxloc1_16_r10.c' || echo '$(srcdir)/'`generated/maxloc1_16_r10.c
+
+maxloc1_4_r16.lo: generated/maxloc1_4_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_4_r16.lo `test -f 'generated/maxloc1_4_r16.c' || echo '$(srcdir)/'`generated/maxloc1_4_r16.c
+
+maxloc1_8_r16.lo: generated/maxloc1_8_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_8_r16.lo `test -f 'generated/maxloc1_8_r16.c' || echo '$(srcdir)/'`generated/maxloc1_8_r16.c
+
+maxloc1_16_r16.lo: generated/maxloc1_16_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxloc1_16_r16.lo `test -f 'generated/maxloc1_16_r16.c' || echo '$(srcdir)/'`generated/maxloc1_16_r16.c
+
 maxval_i4.lo: generated/maxval_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_i4.lo `test -f 'generated/maxval_i4.c' || echo '$(srcdir)/'`generated/maxval_i4.c
 
 maxval_i8.lo: generated/maxval_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_i8.lo `test -f 'generated/maxval_i8.c' || echo '$(srcdir)/'`generated/maxval_i8.c
 
+maxval_i16.lo: generated/maxval_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_i16.lo `test -f 'generated/maxval_i16.c' || echo '$(srcdir)/'`generated/maxval_i16.c
+
 maxval_r4.lo: generated/maxval_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_r4.lo `test -f 'generated/maxval_r4.c' || echo '$(srcdir)/'`generated/maxval_r4.c
 
 maxval_r8.lo: generated/maxval_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_r8.lo `test -f 'generated/maxval_r8.c' || echo '$(srcdir)/'`generated/maxval_r8.c
 
+maxval_r10.lo: generated/maxval_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_r10.lo `test -f 'generated/maxval_r10.c' || echo '$(srcdir)/'`generated/maxval_r10.c
+
+maxval_r16.lo: generated/maxval_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o maxval_r16.lo `test -f 'generated/maxval_r16.c' || echo '$(srcdir)/'`generated/maxval_r16.c
+
 minloc0_4_i4.lo: generated/minloc0_4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_i4.lo `test -f 'generated/minloc0_4_i4.c' || echo '$(srcdir)/'`generated/minloc0_4_i4.c
 
 minloc0_8_i4.lo: generated/minloc0_8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_i4.lo `test -f 'generated/minloc0_8_i4.c' || echo '$(srcdir)/'`generated/minloc0_8_i4.c
 
+minloc0_16_i4.lo: generated/minloc0_16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_i4.lo `test -f 'generated/minloc0_16_i4.c' || echo '$(srcdir)/'`generated/minloc0_16_i4.c
+
 minloc0_4_i8.lo: generated/minloc0_4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_i8.lo `test -f 'generated/minloc0_4_i8.c' || echo '$(srcdir)/'`generated/minloc0_4_i8.c
 
 minloc0_8_i8.lo: generated/minloc0_8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_i8.lo `test -f 'generated/minloc0_8_i8.c' || echo '$(srcdir)/'`generated/minloc0_8_i8.c
 
+minloc0_16_i8.lo: generated/minloc0_16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_i8.lo `test -f 'generated/minloc0_16_i8.c' || echo '$(srcdir)/'`generated/minloc0_16_i8.c
+
+minloc0_4_i16.lo: generated/minloc0_4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_i16.lo `test -f 'generated/minloc0_4_i16.c' || echo '$(srcdir)/'`generated/minloc0_4_i16.c
+
+minloc0_8_i16.lo: generated/minloc0_8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_i16.lo `test -f 'generated/minloc0_8_i16.c' || echo '$(srcdir)/'`generated/minloc0_8_i16.c
+
+minloc0_16_i16.lo: generated/minloc0_16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_i16.lo `test -f 'generated/minloc0_16_i16.c' || echo '$(srcdir)/'`generated/minloc0_16_i16.c
+
 minloc0_4_r4.lo: generated/minloc0_4_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_r4.lo `test -f 'generated/minloc0_4_r4.c' || echo '$(srcdir)/'`generated/minloc0_4_r4.c
 
 minloc0_8_r4.lo: generated/minloc0_8_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_r4.lo `test -f 'generated/minloc0_8_r4.c' || echo '$(srcdir)/'`generated/minloc0_8_r4.c
 
+minloc0_16_r4.lo: generated/minloc0_16_r4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_r4.lo `test -f 'generated/minloc0_16_r4.c' || echo '$(srcdir)/'`generated/minloc0_16_r4.c
+
 minloc0_4_r8.lo: generated/minloc0_4_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_r8.lo `test -f 'generated/minloc0_4_r8.c' || echo '$(srcdir)/'`generated/minloc0_4_r8.c
 
 minloc0_8_r8.lo: generated/minloc0_8_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_r8.lo `test -f 'generated/minloc0_8_r8.c' || echo '$(srcdir)/'`generated/minloc0_8_r8.c
 
+minloc0_16_r8.lo: generated/minloc0_16_r8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_r8.lo `test -f 'generated/minloc0_16_r8.c' || echo '$(srcdir)/'`generated/minloc0_16_r8.c
+
+minloc0_4_r10.lo: generated/minloc0_4_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_r10.lo `test -f 'generated/minloc0_4_r10.c' || echo '$(srcdir)/'`generated/minloc0_4_r10.c
+
+minloc0_8_r10.lo: generated/minloc0_8_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_r10.lo `test -f 'generated/minloc0_8_r10.c' || echo '$(srcdir)/'`generated/minloc0_8_r10.c
+
+minloc0_16_r10.lo: generated/minloc0_16_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_r10.lo `test -f 'generated/minloc0_16_r10.c' || echo '$(srcdir)/'`generated/minloc0_16_r10.c
+
+minloc0_4_r16.lo: generated/minloc0_4_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_4_r16.lo `test -f 'generated/minloc0_4_r16.c' || echo '$(srcdir)/'`generated/minloc0_4_r16.c
+
+minloc0_8_r16.lo: generated/minloc0_8_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_8_r16.lo `test -f 'generated/minloc0_8_r16.c' || echo '$(srcdir)/'`generated/minloc0_8_r16.c
+
+minloc0_16_r16.lo: generated/minloc0_16_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc0_16_r16.lo `test -f 'generated/minloc0_16_r16.c' || echo '$(srcdir)/'`generated/minloc0_16_r16.c
+
 minloc1_4_i4.lo: generated/minloc1_4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_i4.lo `test -f 'generated/minloc1_4_i4.c' || echo '$(srcdir)/'`generated/minloc1_4_i4.c
 
 minloc1_8_i4.lo: generated/minloc1_8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_i4.lo `test -f 'generated/minloc1_8_i4.c' || echo '$(srcdir)/'`generated/minloc1_8_i4.c
 
+minloc1_16_i4.lo: generated/minloc1_16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_i4.lo `test -f 'generated/minloc1_16_i4.c' || echo '$(srcdir)/'`generated/minloc1_16_i4.c
+
 minloc1_4_i8.lo: generated/minloc1_4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_i8.lo `test -f 'generated/minloc1_4_i8.c' || echo '$(srcdir)/'`generated/minloc1_4_i8.c
 
 minloc1_8_i8.lo: generated/minloc1_8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_i8.lo `test -f 'generated/minloc1_8_i8.c' || echo '$(srcdir)/'`generated/minloc1_8_i8.c
 
+minloc1_16_i8.lo: generated/minloc1_16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_i8.lo `test -f 'generated/minloc1_16_i8.c' || echo '$(srcdir)/'`generated/minloc1_16_i8.c
+
+minloc1_4_i16.lo: generated/minloc1_4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_i16.lo `test -f 'generated/minloc1_4_i16.c' || echo '$(srcdir)/'`generated/minloc1_4_i16.c
+
+minloc1_8_i16.lo: generated/minloc1_8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_i16.lo `test -f 'generated/minloc1_8_i16.c' || echo '$(srcdir)/'`generated/minloc1_8_i16.c
+
+minloc1_16_i16.lo: generated/minloc1_16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_i16.lo `test -f 'generated/minloc1_16_i16.c' || echo '$(srcdir)/'`generated/minloc1_16_i16.c
+
 minloc1_4_r4.lo: generated/minloc1_4_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_r4.lo `test -f 'generated/minloc1_4_r4.c' || echo '$(srcdir)/'`generated/minloc1_4_r4.c
 
 minloc1_8_r4.lo: generated/minloc1_8_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_r4.lo `test -f 'generated/minloc1_8_r4.c' || echo '$(srcdir)/'`generated/minloc1_8_r4.c
 
+minloc1_16_r4.lo: generated/minloc1_16_r4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_r4.lo `test -f 'generated/minloc1_16_r4.c' || echo '$(srcdir)/'`generated/minloc1_16_r4.c
+
 minloc1_4_r8.lo: generated/minloc1_4_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_r8.lo `test -f 'generated/minloc1_4_r8.c' || echo '$(srcdir)/'`generated/minloc1_4_r8.c
 
 minloc1_8_r8.lo: generated/minloc1_8_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_r8.lo `test -f 'generated/minloc1_8_r8.c' || echo '$(srcdir)/'`generated/minloc1_8_r8.c
 
+minloc1_16_r8.lo: generated/minloc1_16_r8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_r8.lo `test -f 'generated/minloc1_16_r8.c' || echo '$(srcdir)/'`generated/minloc1_16_r8.c
+
+minloc1_4_r10.lo: generated/minloc1_4_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_r10.lo `test -f 'generated/minloc1_4_r10.c' || echo '$(srcdir)/'`generated/minloc1_4_r10.c
+
+minloc1_8_r10.lo: generated/minloc1_8_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_r10.lo `test -f 'generated/minloc1_8_r10.c' || echo '$(srcdir)/'`generated/minloc1_8_r10.c
+
+minloc1_16_r10.lo: generated/minloc1_16_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_r10.lo `test -f 'generated/minloc1_16_r10.c' || echo '$(srcdir)/'`generated/minloc1_16_r10.c
+
+minloc1_4_r16.lo: generated/minloc1_4_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_4_r16.lo `test -f 'generated/minloc1_4_r16.c' || echo '$(srcdir)/'`generated/minloc1_4_r16.c
+
+minloc1_8_r16.lo: generated/minloc1_8_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_8_r16.lo `test -f 'generated/minloc1_8_r16.c' || echo '$(srcdir)/'`generated/minloc1_8_r16.c
+
+minloc1_16_r16.lo: generated/minloc1_16_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minloc1_16_r16.lo `test -f 'generated/minloc1_16_r16.c' || echo '$(srcdir)/'`generated/minloc1_16_r16.c
+
 minval_i4.lo: generated/minval_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_i4.lo `test -f 'generated/minval_i4.c' || echo '$(srcdir)/'`generated/minval_i4.c
 
 minval_i8.lo: generated/minval_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_i8.lo `test -f 'generated/minval_i8.c' || echo '$(srcdir)/'`generated/minval_i8.c
 
+minval_i16.lo: generated/minval_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_i16.lo `test -f 'generated/minval_i16.c' || echo '$(srcdir)/'`generated/minval_i16.c
+
 minval_r4.lo: generated/minval_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_r4.lo `test -f 'generated/minval_r4.c' || echo '$(srcdir)/'`generated/minval_r4.c
 
 minval_r8.lo: generated/minval_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_r8.lo `test -f 'generated/minval_r8.c' || echo '$(srcdir)/'`generated/minval_r8.c
 
+minval_r10.lo: generated/minval_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_r10.lo `test -f 'generated/minval_r10.c' || echo '$(srcdir)/'`generated/minval_r10.c
+
+minval_r16.lo: generated/minval_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o minval_r16.lo `test -f 'generated/minval_r16.c' || echo '$(srcdir)/'`generated/minval_r16.c
+
 product_i4.lo: generated/product_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_i4.lo `test -f 'generated/product_i4.c' || echo '$(srcdir)/'`generated/product_i4.c
 
 product_i8.lo: generated/product_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_i8.lo `test -f 'generated/product_i8.c' || echo '$(srcdir)/'`generated/product_i8.c
 
+product_i16.lo: generated/product_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_i16.lo `test -f 'generated/product_i16.c' || echo '$(srcdir)/'`generated/product_i16.c
+
 product_r4.lo: generated/product_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_r4.lo `test -f 'generated/product_r4.c' || echo '$(srcdir)/'`generated/product_r4.c
 
 product_r8.lo: generated/product_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_r8.lo `test -f 'generated/product_r8.c' || echo '$(srcdir)/'`generated/product_r8.c
 
+product_r10.lo: generated/product_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_r10.lo `test -f 'generated/product_r10.c' || echo '$(srcdir)/'`generated/product_r10.c
+
+product_r16.lo: generated/product_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_r16.lo `test -f 'generated/product_r16.c' || echo '$(srcdir)/'`generated/product_r16.c
+
 product_c4.lo: generated/product_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_c4.lo `test -f 'generated/product_c4.c' || echo '$(srcdir)/'`generated/product_c4.c
 
 product_c8.lo: generated/product_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_c8.lo `test -f 'generated/product_c8.c' || echo '$(srcdir)/'`generated/product_c8.c
 
+product_c10.lo: generated/product_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_c10.lo `test -f 'generated/product_c10.c' || echo '$(srcdir)/'`generated/product_c10.c
+
+product_c16.lo: generated/product_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o product_c16.lo `test -f 'generated/product_c16.c' || echo '$(srcdir)/'`generated/product_c16.c
+
 sum_i4.lo: generated/sum_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_i4.lo `test -f 'generated/sum_i4.c' || echo '$(srcdir)/'`generated/sum_i4.c
 
 sum_i8.lo: generated/sum_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_i8.lo `test -f 'generated/sum_i8.c' || echo '$(srcdir)/'`generated/sum_i8.c
 
+sum_i16.lo: generated/sum_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_i16.lo `test -f 'generated/sum_i16.c' || echo '$(srcdir)/'`generated/sum_i16.c
+
 sum_r4.lo: generated/sum_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_r4.lo `test -f 'generated/sum_r4.c' || echo '$(srcdir)/'`generated/sum_r4.c
 
 sum_r8.lo: generated/sum_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_r8.lo `test -f 'generated/sum_r8.c' || echo '$(srcdir)/'`generated/sum_r8.c
 
+sum_r10.lo: generated/sum_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_r10.lo `test -f 'generated/sum_r10.c' || echo '$(srcdir)/'`generated/sum_r10.c
+
+sum_r16.lo: generated/sum_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_r16.lo `test -f 'generated/sum_r16.c' || echo '$(srcdir)/'`generated/sum_r16.c
+
 sum_c4.lo: generated/sum_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_c4.lo `test -f 'generated/sum_c4.c' || echo '$(srcdir)/'`generated/sum_c4.c
 
 sum_c8.lo: generated/sum_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_c8.lo `test -f 'generated/sum_c8.c' || echo '$(srcdir)/'`generated/sum_c8.c
 
+sum_c10.lo: generated/sum_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_c10.lo `test -f 'generated/sum_c10.c' || echo '$(srcdir)/'`generated/sum_c10.c
+
+sum_c16.lo: generated/sum_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sum_c16.lo `test -f 'generated/sum_c16.c' || echo '$(srcdir)/'`generated/sum_c16.c
+
 dotprod_i4.lo: generated/dotprod_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_i4.lo `test -f 'generated/dotprod_i4.c' || echo '$(srcdir)/'`generated/dotprod_i4.c
 
 dotprod_i8.lo: generated/dotprod_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_i8.lo `test -f 'generated/dotprod_i8.c' || echo '$(srcdir)/'`generated/dotprod_i8.c
 
+dotprod_i16.lo: generated/dotprod_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_i16.lo `test -f 'generated/dotprod_i16.c' || echo '$(srcdir)/'`generated/dotprod_i16.c
+
 dotprod_r4.lo: generated/dotprod_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_r4.lo `test -f 'generated/dotprod_r4.c' || echo '$(srcdir)/'`generated/dotprod_r4.c
 
 dotprod_r8.lo: generated/dotprod_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_r8.lo `test -f 'generated/dotprod_r8.c' || echo '$(srcdir)/'`generated/dotprod_r8.c
 
+dotprod_r10.lo: generated/dotprod_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_r10.lo `test -f 'generated/dotprod_r10.c' || echo '$(srcdir)/'`generated/dotprod_r10.c
+
+dotprod_r16.lo: generated/dotprod_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_r16.lo `test -f 'generated/dotprod_r16.c' || echo '$(srcdir)/'`generated/dotprod_r16.c
+
 dotprod_l4.lo: generated/dotprod_l4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_l4.lo `test -f 'generated/dotprod_l4.c' || echo '$(srcdir)/'`generated/dotprod_l4.c
 
 dotprod_l8.lo: generated/dotprod_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_l8.lo `test -f 'generated/dotprod_l8.c' || echo '$(srcdir)/'`generated/dotprod_l8.c
 
+dotprod_l16.lo: generated/dotprod_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_l16.lo `test -f 'generated/dotprod_l16.c' || echo '$(srcdir)/'`generated/dotprod_l16.c
+
 dotprod_c4.lo: generated/dotprod_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_c4.lo `test -f 'generated/dotprod_c4.c' || echo '$(srcdir)/'`generated/dotprod_c4.c
 
 dotprod_c8.lo: generated/dotprod_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_c8.lo `test -f 'generated/dotprod_c8.c' || echo '$(srcdir)/'`generated/dotprod_c8.c
 
+dotprod_c10.lo: generated/dotprod_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_c10.lo `test -f 'generated/dotprod_c10.c' || echo '$(srcdir)/'`generated/dotprod_c10.c
+
+dotprod_c16.lo: generated/dotprod_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dotprod_c16.lo `test -f 'generated/dotprod_c16.c' || echo '$(srcdir)/'`generated/dotprod_c16.c
+
 matmul_i4.lo: generated/matmul_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i4.lo `test -f 'generated/matmul_i4.c' || echo '$(srcdir)/'`generated/matmul_i4.c
 
 matmul_i8.lo: generated/matmul_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i8.lo `test -f 'generated/matmul_i8.c' || echo '$(srcdir)/'`generated/matmul_i8.c
 
+matmul_i16.lo: generated/matmul_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_i16.lo `test -f 'generated/matmul_i16.c' || echo '$(srcdir)/'`generated/matmul_i16.c
+
 matmul_r4.lo: generated/matmul_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r4.lo `test -f 'generated/matmul_r4.c' || echo '$(srcdir)/'`generated/matmul_r4.c
 
 matmul_r8.lo: generated/matmul_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r8.lo `test -f 'generated/matmul_r8.c' || echo '$(srcdir)/'`generated/matmul_r8.c
 
+matmul_r10.lo: generated/matmul_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r10.lo `test -f 'generated/matmul_r10.c' || echo '$(srcdir)/'`generated/matmul_r10.c
+
+matmul_r16.lo: generated/matmul_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_r16.lo `test -f 'generated/matmul_r16.c' || echo '$(srcdir)/'`generated/matmul_r16.c
+
 matmul_c4.lo: generated/matmul_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c4.lo `test -f 'generated/matmul_c4.c' || echo '$(srcdir)/'`generated/matmul_c4.c
 
 matmul_c8.lo: generated/matmul_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c8.lo `test -f 'generated/matmul_c8.c' || echo '$(srcdir)/'`generated/matmul_c8.c
 
+matmul_c10.lo: generated/matmul_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c10.lo `test -f 'generated/matmul_c10.c' || echo '$(srcdir)/'`generated/matmul_c10.c
+
+matmul_c16.lo: generated/matmul_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_c16.lo `test -f 'generated/matmul_c16.c' || echo '$(srcdir)/'`generated/matmul_c16.c
+
 matmul_l4.lo: generated/matmul_l4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_l4.lo `test -f 'generated/matmul_l4.c' || echo '$(srcdir)/'`generated/matmul_l4.c
 
 matmul_l8.lo: generated/matmul_l8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_l8.lo `test -f 'generated/matmul_l8.c' || echo '$(srcdir)/'`generated/matmul_l8.c
 
+matmul_l16.lo: generated/matmul_l16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o matmul_l16.lo `test -f 'generated/matmul_l16.c' || echo '$(srcdir)/'`generated/matmul_l16.c
+
 transpose_i4.lo: generated/transpose_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_i4.lo `test -f 'generated/transpose_i4.c' || echo '$(srcdir)/'`generated/transpose_i4.c
 
 transpose_i8.lo: generated/transpose_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_i8.lo `test -f 'generated/transpose_i8.c' || echo '$(srcdir)/'`generated/transpose_i8.c
 
+transpose_i16.lo: generated/transpose_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_i16.lo `test -f 'generated/transpose_i16.c' || echo '$(srcdir)/'`generated/transpose_i16.c
+
 transpose_c4.lo: generated/transpose_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_c4.lo `test -f 'generated/transpose_c4.c' || echo '$(srcdir)/'`generated/transpose_c4.c
 
 transpose_c8.lo: generated/transpose_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_c8.lo `test -f 'generated/transpose_c8.c' || echo '$(srcdir)/'`generated/transpose_c8.c
 
+transpose_c10.lo: generated/transpose_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_c10.lo `test -f 'generated/transpose_c10.c' || echo '$(srcdir)/'`generated/transpose_c10.c
+
+transpose_c16.lo: generated/transpose_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o transpose_c16.lo `test -f 'generated/transpose_c16.c' || echo '$(srcdir)/'`generated/transpose_c16.c
+
 shape_i4.lo: generated/shape_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shape_i4.lo `test -f 'generated/shape_i4.c' || echo '$(srcdir)/'`generated/shape_i4.c
 
 shape_i8.lo: generated/shape_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shape_i8.lo `test -f 'generated/shape_i8.c' || echo '$(srcdir)/'`generated/shape_i8.c
 
+shape_i16.lo: generated/shape_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shape_i16.lo `test -f 'generated/shape_i16.c' || echo '$(srcdir)/'`generated/shape_i16.c
+
 eoshift1_4.lo: generated/eoshift1_4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift1_4.lo `test -f 'generated/eoshift1_4.c' || echo '$(srcdir)/'`generated/eoshift1_4.c
 
 eoshift1_8.lo: generated/eoshift1_8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift1_8.lo `test -f 'generated/eoshift1_8.c' || echo '$(srcdir)/'`generated/eoshift1_8.c
 
+eoshift1_16.lo: generated/eoshift1_16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift1_16.lo `test -f 'generated/eoshift1_16.c' || echo '$(srcdir)/'`generated/eoshift1_16.c
+
 eoshift3_4.lo: generated/eoshift3_4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift3_4.lo `test -f 'generated/eoshift3_4.c' || echo '$(srcdir)/'`generated/eoshift3_4.c
 
 eoshift3_8.lo: generated/eoshift3_8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift3_8.lo `test -f 'generated/eoshift3_8.c' || echo '$(srcdir)/'`generated/eoshift3_8.c
 
+eoshift3_16.lo: generated/eoshift3_16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o eoshift3_16.lo `test -f 'generated/eoshift3_16.c' || echo '$(srcdir)/'`generated/eoshift3_16.c
+
 cshift1_4.lo: generated/cshift1_4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift1_4.lo `test -f 'generated/cshift1_4.c' || echo '$(srcdir)/'`generated/cshift1_4.c
 
 cshift1_8.lo: generated/cshift1_8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift1_8.lo `test -f 'generated/cshift1_8.c' || echo '$(srcdir)/'`generated/cshift1_8.c
 
+cshift1_16.lo: generated/cshift1_16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cshift1_16.lo `test -f 'generated/cshift1_16.c' || echo '$(srcdir)/'`generated/cshift1_16.c
+
 reshape_i4.lo: generated/reshape_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_i4.lo `test -f 'generated/reshape_i4.c' || echo '$(srcdir)/'`generated/reshape_i4.c
 
 reshape_i8.lo: generated/reshape_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_i8.lo `test -f 'generated/reshape_i8.c' || echo '$(srcdir)/'`generated/reshape_i8.c
 
+reshape_i16.lo: generated/reshape_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_i16.lo `test -f 'generated/reshape_i16.c' || echo '$(srcdir)/'`generated/reshape_i16.c
+
 reshape_c4.lo: generated/reshape_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_c4.lo `test -f 'generated/reshape_c4.c' || echo '$(srcdir)/'`generated/reshape_c4.c
 
 reshape_c8.lo: generated/reshape_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_c8.lo `test -f 'generated/reshape_c8.c' || echo '$(srcdir)/'`generated/reshape_c8.c
 
+reshape_c10.lo: generated/reshape_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_c10.lo `test -f 'generated/reshape_c10.c' || echo '$(srcdir)/'`generated/reshape_c10.c
+
+reshape_c16.lo: generated/reshape_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o reshape_c16.lo `test -f 'generated/reshape_c16.c' || echo '$(srcdir)/'`generated/reshape_c16.c
+
 in_pack_i4.lo: generated/in_pack_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_i4.lo `test -f 'generated/in_pack_i4.c' || echo '$(srcdir)/'`generated/in_pack_i4.c
 
 in_pack_i8.lo: generated/in_pack_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_i8.lo `test -f 'generated/in_pack_i8.c' || echo '$(srcdir)/'`generated/in_pack_i8.c
 
+in_pack_i16.lo: generated/in_pack_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_i16.lo `test -f 'generated/in_pack_i16.c' || echo '$(srcdir)/'`generated/in_pack_i16.c
+
 in_pack_c4.lo: generated/in_pack_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_c4.lo `test -f 'generated/in_pack_c4.c' || echo '$(srcdir)/'`generated/in_pack_c4.c
 
 in_pack_c8.lo: generated/in_pack_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_c8.lo `test -f 'generated/in_pack_c8.c' || echo '$(srcdir)/'`generated/in_pack_c8.c
 
+in_pack_c10.lo: generated/in_pack_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_c10.lo `test -f 'generated/in_pack_c10.c' || echo '$(srcdir)/'`generated/in_pack_c10.c
+
+in_pack_c16.lo: generated/in_pack_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_pack_c16.lo `test -f 'generated/in_pack_c16.c' || echo '$(srcdir)/'`generated/in_pack_c16.c
+
 in_unpack_i4.lo: generated/in_unpack_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_i4.lo `test -f 'generated/in_unpack_i4.c' || echo '$(srcdir)/'`generated/in_unpack_i4.c
 
 in_unpack_i8.lo: generated/in_unpack_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_i8.lo `test -f 'generated/in_unpack_i8.c' || echo '$(srcdir)/'`generated/in_unpack_i8.c
 
+in_unpack_i16.lo: generated/in_unpack_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_i16.lo `test -f 'generated/in_unpack_i16.c' || echo '$(srcdir)/'`generated/in_unpack_i16.c
+
 in_unpack_c4.lo: generated/in_unpack_c4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_c4.lo `test -f 'generated/in_unpack_c4.c' || echo '$(srcdir)/'`generated/in_unpack_c4.c
 
 in_unpack_c8.lo: generated/in_unpack_c8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_c8.lo `test -f 'generated/in_unpack_c8.c' || echo '$(srcdir)/'`generated/in_unpack_c8.c
 
+in_unpack_c10.lo: generated/in_unpack_c10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_c10.lo `test -f 'generated/in_unpack_c10.c' || echo '$(srcdir)/'`generated/in_unpack_c10.c
+
+in_unpack_c16.lo: generated/in_unpack_c16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o in_unpack_c16.lo `test -f 'generated/in_unpack_c16.c' || echo '$(srcdir)/'`generated/in_unpack_c16.c
+
 exponent_r4.lo: generated/exponent_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exponent_r4.lo `test -f 'generated/exponent_r4.c' || echo '$(srcdir)/'`generated/exponent_r4.c
 
 exponent_r8.lo: generated/exponent_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exponent_r8.lo `test -f 'generated/exponent_r8.c' || echo '$(srcdir)/'`generated/exponent_r8.c
 
+exponent_r10.lo: generated/exponent_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exponent_r10.lo `test -f 'generated/exponent_r10.c' || echo '$(srcdir)/'`generated/exponent_r10.c
+
+exponent_r16.lo: generated/exponent_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o exponent_r16.lo `test -f 'generated/exponent_r16.c' || echo '$(srcdir)/'`generated/exponent_r16.c
+
 fraction_r4.lo: generated/fraction_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fraction_r4.lo `test -f 'generated/fraction_r4.c' || echo '$(srcdir)/'`generated/fraction_r4.c
 
 fraction_r8.lo: generated/fraction_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fraction_r8.lo `test -f 'generated/fraction_r8.c' || echo '$(srcdir)/'`generated/fraction_r8.c
 
+fraction_r10.lo: generated/fraction_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fraction_r10.lo `test -f 'generated/fraction_r10.c' || echo '$(srcdir)/'`generated/fraction_r10.c
+
+fraction_r16.lo: generated/fraction_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o fraction_r16.lo `test -f 'generated/fraction_r16.c' || echo '$(srcdir)/'`generated/fraction_r16.c
+
 nearest_r4.lo: generated/nearest_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nearest_r4.lo `test -f 'generated/nearest_r4.c' || echo '$(srcdir)/'`generated/nearest_r4.c
 
 nearest_r8.lo: generated/nearest_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nearest_r8.lo `test -f 'generated/nearest_r8.c' || echo '$(srcdir)/'`generated/nearest_r8.c
 
+nearest_r10.lo: generated/nearest_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nearest_r10.lo `test -f 'generated/nearest_r10.c' || echo '$(srcdir)/'`generated/nearest_r10.c
+
+nearest_r16.lo: generated/nearest_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nearest_r16.lo `test -f 'generated/nearest_r16.c' || echo '$(srcdir)/'`generated/nearest_r16.c
+
 set_exponent_r4.lo: generated/set_exponent_r4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_exponent_r4.lo `test -f 'generated/set_exponent_r4.c' || echo '$(srcdir)/'`generated/set_exponent_r4.c
 
 set_exponent_r8.lo: generated/set_exponent_r8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_exponent_r8.lo `test -f 'generated/set_exponent_r8.c' || echo '$(srcdir)/'`generated/set_exponent_r8.c
 
+set_exponent_r10.lo: generated/set_exponent_r10.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_exponent_r10.lo `test -f 'generated/set_exponent_r10.c' || echo '$(srcdir)/'`generated/set_exponent_r10.c
+
+set_exponent_r16.lo: generated/set_exponent_r16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_exponent_r16.lo `test -f 'generated/set_exponent_r16.c' || echo '$(srcdir)/'`generated/set_exponent_r16.c
+
 pow_i4_i4.lo: generated/pow_i4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i4_i4.lo `test -f 'generated/pow_i4_i4.c' || echo '$(srcdir)/'`generated/pow_i4_i4.c
 
 pow_i8_i4.lo: generated/pow_i8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i8_i4.lo `test -f 'generated/pow_i8_i4.c' || echo '$(srcdir)/'`generated/pow_i8_i4.c
 
+pow_i16_i4.lo: generated/pow_i16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i16_i4.lo `test -f 'generated/pow_i16_i4.c' || echo '$(srcdir)/'`generated/pow_i16_i4.c
+
 pow_r4_i4.lo: generated/pow_r4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r4_i4.lo `test -f 'generated/pow_r4_i4.c' || echo '$(srcdir)/'`generated/pow_r4_i4.c
 
 pow_r8_i4.lo: generated/pow_r8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r8_i4.lo `test -f 'generated/pow_r8_i4.c' || echo '$(srcdir)/'`generated/pow_r8_i4.c
 
+pow_r10_i4.lo: generated/pow_r10_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r10_i4.lo `test -f 'generated/pow_r10_i4.c' || echo '$(srcdir)/'`generated/pow_r10_i4.c
+
+pow_r16_i4.lo: generated/pow_r16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r16_i4.lo `test -f 'generated/pow_r16_i4.c' || echo '$(srcdir)/'`generated/pow_r16_i4.c
+
 pow_c4_i4.lo: generated/pow_c4_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c4_i4.lo `test -f 'generated/pow_c4_i4.c' || echo '$(srcdir)/'`generated/pow_c4_i4.c
 
 pow_c8_i4.lo: generated/pow_c8_i4.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c8_i4.lo `test -f 'generated/pow_c8_i4.c' || echo '$(srcdir)/'`generated/pow_c8_i4.c
 
+pow_c10_i4.lo: generated/pow_c10_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c10_i4.lo `test -f 'generated/pow_c10_i4.c' || echo '$(srcdir)/'`generated/pow_c10_i4.c
+
+pow_c16_i4.lo: generated/pow_c16_i4.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c16_i4.lo `test -f 'generated/pow_c16_i4.c' || echo '$(srcdir)/'`generated/pow_c16_i4.c
+
 pow_i4_i8.lo: generated/pow_i4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i4_i8.lo `test -f 'generated/pow_i4_i8.c' || echo '$(srcdir)/'`generated/pow_i4_i8.c
 
 pow_i8_i8.lo: generated/pow_i8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i8_i8.lo `test -f 'generated/pow_i8_i8.c' || echo '$(srcdir)/'`generated/pow_i8_i8.c
 
+pow_i16_i8.lo: generated/pow_i16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i16_i8.lo `test -f 'generated/pow_i16_i8.c' || echo '$(srcdir)/'`generated/pow_i16_i8.c
+
 pow_r4_i8.lo: generated/pow_r4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r4_i8.lo `test -f 'generated/pow_r4_i8.c' || echo '$(srcdir)/'`generated/pow_r4_i8.c
 
 pow_r8_i8.lo: generated/pow_r8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r8_i8.lo `test -f 'generated/pow_r8_i8.c' || echo '$(srcdir)/'`generated/pow_r8_i8.c
 
+pow_r10_i8.lo: generated/pow_r10_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r10_i8.lo `test -f 'generated/pow_r10_i8.c' || echo '$(srcdir)/'`generated/pow_r10_i8.c
+
+pow_r16_i8.lo: generated/pow_r16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r16_i8.lo `test -f 'generated/pow_r16_i8.c' || echo '$(srcdir)/'`generated/pow_r16_i8.c
+
 pow_c4_i8.lo: generated/pow_c4_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c4_i8.lo `test -f 'generated/pow_c4_i8.c' || echo '$(srcdir)/'`generated/pow_c4_i8.c
 
 pow_c8_i8.lo: generated/pow_c8_i8.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c8_i8.lo `test -f 'generated/pow_c8_i8.c' || echo '$(srcdir)/'`generated/pow_c8_i8.c
 
+pow_c10_i8.lo: generated/pow_c10_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c10_i8.lo `test -f 'generated/pow_c10_i8.c' || echo '$(srcdir)/'`generated/pow_c10_i8.c
+
+pow_c16_i8.lo: generated/pow_c16_i8.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c16_i8.lo `test -f 'generated/pow_c16_i8.c' || echo '$(srcdir)/'`generated/pow_c16_i8.c
+
+pow_i4_i16.lo: generated/pow_i4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i4_i16.lo `test -f 'generated/pow_i4_i16.c' || echo '$(srcdir)/'`generated/pow_i4_i16.c
+
+pow_i8_i16.lo: generated/pow_i8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i8_i16.lo `test -f 'generated/pow_i8_i16.c' || echo '$(srcdir)/'`generated/pow_i8_i16.c
+
+pow_i16_i16.lo: generated/pow_i16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_i16_i16.lo `test -f 'generated/pow_i16_i16.c' || echo '$(srcdir)/'`generated/pow_i16_i16.c
+
+pow_r4_i16.lo: generated/pow_r4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r4_i16.lo `test -f 'generated/pow_r4_i16.c' || echo '$(srcdir)/'`generated/pow_r4_i16.c
+
+pow_r8_i16.lo: generated/pow_r8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r8_i16.lo `test -f 'generated/pow_r8_i16.c' || echo '$(srcdir)/'`generated/pow_r8_i16.c
+
+pow_r10_i16.lo: generated/pow_r10_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r10_i16.lo `test -f 'generated/pow_r10_i16.c' || echo '$(srcdir)/'`generated/pow_r10_i16.c
+
+pow_r16_i16.lo: generated/pow_r16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_r16_i16.lo `test -f 'generated/pow_r16_i16.c' || echo '$(srcdir)/'`generated/pow_r16_i16.c
+
+pow_c4_i16.lo: generated/pow_c4_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c4_i16.lo `test -f 'generated/pow_c4_i16.c' || echo '$(srcdir)/'`generated/pow_c4_i16.c
+
+pow_c8_i16.lo: generated/pow_c8_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c8_i16.lo `test -f 'generated/pow_c8_i16.c' || echo '$(srcdir)/'`generated/pow_c8_i16.c
+
+pow_c10_i16.lo: generated/pow_c10_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c10_i16.lo `test -f 'generated/pow_c10_i16.c' || echo '$(srcdir)/'`generated/pow_c10_i16.c
+
+pow_c16_i16.lo: generated/pow_c16_i16.c
+	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pow_c16_i16.lo `test -f 'generated/pow_c16_i16.c' || echo '$(srcdir)/'`generated/pow_c16_i16.c
+
 close.lo: io/close.c
 	$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o close.lo `test -f 'io/close.c' || echo '$(srcdir)/'`io/close.c
 
@@ -1385,192 +2375,6 @@ selected_int_kind.lo: intrinsics/selected_int_kind.f90
 selected_real_kind.lo: intrinsics/selected_real_kind.f90
 	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o selected_real_kind.lo `test -f 'intrinsics/selected_real_kind.f90' || echo '$(srcdir)/'`intrinsics/selected_real_kind.f90
 
-_abs_c4.lo: generated/_abs_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c4.lo `test -f 'generated/_abs_c4.f90' || echo '$(srcdir)/'`generated/_abs_c4.f90
-
-_abs_c8.lo: generated/_abs_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_c8.lo `test -f 'generated/_abs_c8.f90' || echo '$(srcdir)/'`generated/_abs_c8.f90
-
-_abs_i4.lo: generated/_abs_i4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_i4.lo `test -f 'generated/_abs_i4.f90' || echo '$(srcdir)/'`generated/_abs_i4.f90
-
-_abs_i8.lo: generated/_abs_i8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_i8.lo `test -f 'generated/_abs_i8.f90' || echo '$(srcdir)/'`generated/_abs_i8.f90
-
-_abs_r4.lo: generated/_abs_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r4.lo `test -f 'generated/_abs_r4.f90' || echo '$(srcdir)/'`generated/_abs_r4.f90
-
-_abs_r8.lo: generated/_abs_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _abs_r8.lo `test -f 'generated/_abs_r8.f90' || echo '$(srcdir)/'`generated/_abs_r8.f90
-
-_exp_r4.lo: generated/_exp_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r4.lo `test -f 'generated/_exp_r4.f90' || echo '$(srcdir)/'`generated/_exp_r4.f90
-
-_exp_r8.lo: generated/_exp_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_r8.lo `test -f 'generated/_exp_r8.f90' || echo '$(srcdir)/'`generated/_exp_r8.f90
-
-_exp_c4.lo: generated/_exp_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c4.lo `test -f 'generated/_exp_c4.f90' || echo '$(srcdir)/'`generated/_exp_c4.f90
-
-_exp_c8.lo: generated/_exp_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _exp_c8.lo `test -f 'generated/_exp_c8.f90' || echo '$(srcdir)/'`generated/_exp_c8.f90
-
-_log_r4.lo: generated/_log_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r4.lo `test -f 'generated/_log_r4.f90' || echo '$(srcdir)/'`generated/_log_r4.f90
-
-_log_r8.lo: generated/_log_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_r8.lo `test -f 'generated/_log_r8.f90' || echo '$(srcdir)/'`generated/_log_r8.f90
-
-_log_c4.lo: generated/_log_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c4.lo `test -f 'generated/_log_c4.f90' || echo '$(srcdir)/'`generated/_log_c4.f90
-
-_log_c8.lo: generated/_log_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log_c8.lo `test -f 'generated/_log_c8.f90' || echo '$(srcdir)/'`generated/_log_c8.f90
-
-_log10_r4.lo: generated/_log10_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r4.lo `test -f 'generated/_log10_r4.f90' || echo '$(srcdir)/'`generated/_log10_r4.f90
-
-_log10_r8.lo: generated/_log10_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _log10_r8.lo `test -f 'generated/_log10_r8.f90' || echo '$(srcdir)/'`generated/_log10_r8.f90
-
-_sqrt_r4.lo: generated/_sqrt_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r4.lo `test -f 'generated/_sqrt_r4.f90' || echo '$(srcdir)/'`generated/_sqrt_r4.f90
-
-_sqrt_r8.lo: generated/_sqrt_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_r8.lo `test -f 'generated/_sqrt_r8.f90' || echo '$(srcdir)/'`generated/_sqrt_r8.f90
-
-_sqrt_c4.lo: generated/_sqrt_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c4.lo `test -f 'generated/_sqrt_c4.f90' || echo '$(srcdir)/'`generated/_sqrt_c4.f90
-
-_sqrt_c8.lo: generated/_sqrt_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sqrt_c8.lo `test -f 'generated/_sqrt_c8.f90' || echo '$(srcdir)/'`generated/_sqrt_c8.f90
-
-_asin_r4.lo: generated/_asin_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r4.lo `test -f 'generated/_asin_r4.f90' || echo '$(srcdir)/'`generated/_asin_r4.f90
-
-_asin_r8.lo: generated/_asin_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _asin_r8.lo `test -f 'generated/_asin_r8.f90' || echo '$(srcdir)/'`generated/_asin_r8.f90
-
-_acos_r4.lo: generated/_acos_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r4.lo `test -f 'generated/_acos_r4.f90' || echo '$(srcdir)/'`generated/_acos_r4.f90
-
-_acos_r8.lo: generated/_acos_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _acos_r8.lo `test -f 'generated/_acos_r8.f90' || echo '$(srcdir)/'`generated/_acos_r8.f90
-
-_atan_r4.lo: generated/_atan_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r4.lo `test -f 'generated/_atan_r4.f90' || echo '$(srcdir)/'`generated/_atan_r4.f90
-
-_atan_r8.lo: generated/_atan_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan_r8.lo `test -f 'generated/_atan_r8.f90' || echo '$(srcdir)/'`generated/_atan_r8.f90
-
-_sin_r4.lo: generated/_sin_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r4.lo `test -f 'generated/_sin_r4.f90' || echo '$(srcdir)/'`generated/_sin_r4.f90
-
-_sin_r8.lo: generated/_sin_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_r8.lo `test -f 'generated/_sin_r8.f90' || echo '$(srcdir)/'`generated/_sin_r8.f90
-
-_sin_c4.lo: generated/_sin_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c4.lo `test -f 'generated/_sin_c4.f90' || echo '$(srcdir)/'`generated/_sin_c4.f90
-
-_sin_c8.lo: generated/_sin_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sin_c8.lo `test -f 'generated/_sin_c8.f90' || echo '$(srcdir)/'`generated/_sin_c8.f90
-
-_cos_r4.lo: generated/_cos_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r4.lo `test -f 'generated/_cos_r4.f90' || echo '$(srcdir)/'`generated/_cos_r4.f90
-
-_cos_r8.lo: generated/_cos_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_r8.lo `test -f 'generated/_cos_r8.f90' || echo '$(srcdir)/'`generated/_cos_r8.f90
-
-_cos_c4.lo: generated/_cos_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c4.lo `test -f 'generated/_cos_c4.f90' || echo '$(srcdir)/'`generated/_cos_c4.f90
-
-_cos_c8.lo: generated/_cos_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cos_c8.lo `test -f 'generated/_cos_c8.f90' || echo '$(srcdir)/'`generated/_cos_c8.f90
-
-_tan_r4.lo: generated/_tan_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r4.lo `test -f 'generated/_tan_r4.f90' || echo '$(srcdir)/'`generated/_tan_r4.f90
-
-_tan_r8.lo: generated/_tan_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tan_r8.lo `test -f 'generated/_tan_r8.f90' || echo '$(srcdir)/'`generated/_tan_r8.f90
-
-_sinh_r4.lo: generated/_sinh_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r4.lo `test -f 'generated/_sinh_r4.f90' || echo '$(srcdir)/'`generated/_sinh_r4.f90
-
-_sinh_r8.lo: generated/_sinh_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sinh_r8.lo `test -f 'generated/_sinh_r8.f90' || echo '$(srcdir)/'`generated/_sinh_r8.f90
-
-_cosh_r4.lo: generated/_cosh_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r4.lo `test -f 'generated/_cosh_r4.f90' || echo '$(srcdir)/'`generated/_cosh_r4.f90
-
-_cosh_r8.lo: generated/_cosh_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _cosh_r8.lo `test -f 'generated/_cosh_r8.f90' || echo '$(srcdir)/'`generated/_cosh_r8.f90
-
-_tanh_r4.lo: generated/_tanh_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r4.lo `test -f 'generated/_tanh_r4.f90' || echo '$(srcdir)/'`generated/_tanh_r4.f90
-
-_tanh_r8.lo: generated/_tanh_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _tanh_r8.lo `test -f 'generated/_tanh_r8.f90' || echo '$(srcdir)/'`generated/_tanh_r8.f90
-
-_conjg_c4.lo: generated/_conjg_c4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c4.lo `test -f 'generated/_conjg_c4.f90' || echo '$(srcdir)/'`generated/_conjg_c4.f90
-
-_conjg_c8.lo: generated/_conjg_c8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _conjg_c8.lo `test -f 'generated/_conjg_c8.f90' || echo '$(srcdir)/'`generated/_conjg_c8.f90
-
-_aint_r4.lo: generated/_aint_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r4.lo `test -f 'generated/_aint_r4.f90' || echo '$(srcdir)/'`generated/_aint_r4.f90
-
-_aint_r8.lo: generated/_aint_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _aint_r8.lo `test -f 'generated/_aint_r8.f90' || echo '$(srcdir)/'`generated/_aint_r8.f90
-
-_anint_r4.lo: generated/_anint_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r4.lo `test -f 'generated/_anint_r4.f90' || echo '$(srcdir)/'`generated/_anint_r4.f90
-
-_anint_r8.lo: generated/_anint_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _anint_r8.lo `test -f 'generated/_anint_r8.f90' || echo '$(srcdir)/'`generated/_anint_r8.f90
-
-_sign_i4.lo: generated/_sign_i4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_i4.lo `test -f 'generated/_sign_i4.f90' || echo '$(srcdir)/'`generated/_sign_i4.f90
-
-_sign_i8.lo: generated/_sign_i8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_i8.lo `test -f 'generated/_sign_i8.f90' || echo '$(srcdir)/'`generated/_sign_i8.f90
-
-_sign_r4.lo: generated/_sign_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r4.lo `test -f 'generated/_sign_r4.f90' || echo '$(srcdir)/'`generated/_sign_r4.f90
-
-_sign_r8.lo: generated/_sign_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _sign_r8.lo `test -f 'generated/_sign_r8.f90' || echo '$(srcdir)/'`generated/_sign_r8.f90
-
-_dim_i4.lo: generated/_dim_i4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_i4.lo `test -f 'generated/_dim_i4.f90' || echo '$(srcdir)/'`generated/_dim_i4.f90
-
-_dim_i8.lo: generated/_dim_i8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_i8.lo `test -f 'generated/_dim_i8.f90' || echo '$(srcdir)/'`generated/_dim_i8.f90
-
-_dim_r4.lo: generated/_dim_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r4.lo `test -f 'generated/_dim_r4.f90' || echo '$(srcdir)/'`generated/_dim_r4.f90
-
-_dim_r8.lo: generated/_dim_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _dim_r8.lo `test -f 'generated/_dim_r8.f90' || echo '$(srcdir)/'`generated/_dim_r8.f90
-
-_atan2_r4.lo: generated/_atan2_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r4.lo `test -f 'generated/_atan2_r4.f90' || echo '$(srcdir)/'`generated/_atan2_r4.f90
-
-_atan2_r8.lo: generated/_atan2_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _atan2_r8.lo `test -f 'generated/_atan2_r8.f90' || echo '$(srcdir)/'`generated/_atan2_r8.f90
-
-_mod_i4.lo: generated/_mod_i4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_i4.lo `test -f 'generated/_mod_i4.f90' || echo '$(srcdir)/'`generated/_mod_i4.f90
-
-_mod_i8.lo: generated/_mod_i8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_i8.lo `test -f 'generated/_mod_i8.f90' || echo '$(srcdir)/'`generated/_mod_i8.f90
-
-_mod_r4.lo: generated/_mod_r4.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_r4.lo `test -f 'generated/_mod_r4.f90' || echo '$(srcdir)/'`generated/_mod_r4.f90
-
-_mod_r8.lo: generated/_mod_r8.f90
-	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o _mod_r8.lo `test -f 'generated/_mod_r8.f90' || echo '$(srcdir)/'`generated/_mod_r8.f90
-
 dprod_r8.lo: intrinsics/dprod_r8.f90
 	$(LIBTOOL) --mode=compile $(FC) $(AM_FCFLAGS) $(FCFLAGS) -c -o dprod_r8.lo `test -f 'intrinsics/dprod_r8.f90' || echo '$(srcdir)/'`intrinsics/dprod_r8.f90
 
@@ -1883,6 +2687,12 @@ uninstall-am: uninstall-info-am uninstall-toolexeclibLTLIBRARIES
 kinds.h: $(srcdir)/mk-kinds-h.sh
 	$(SHELL) $(srcdir)/mk-kinds-h.sh '$(FCCOMPILE)' > $@
 
+kinds.inc: kinds.h
+	grep '^#' < kinds.h > $@
+
+c99_protos.inc: $(srcdir)/c99_protos.h
+	grep '^#' < $(srcdir)/c99_protos.h > $@
+
 selected_int_kind.inc: $(srcdir)/mk-sik-inc.sh
 	$(SHELL) $(srcdir)/mk-sik-inc.sh '$(FCCOMPILE)' > $@
 
diff --git a/libgfortran/generated/_abs_c10.F90 b/libgfortran/generated/_abs_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..8e76b3474f79a6648a3f6383ba0706d511415f7a
--- /dev/null
+++ b/libgfortran/generated/_abs_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CABSL
+
+elemental function specific__abs_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__abs_c10
+
+   specific__abs_c10 = abs (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_c16.F90 b/libgfortran/generated/_abs_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..acc7f22dfa47b295cf42e55fd1367fab751a3d56
--- /dev/null
+++ b/libgfortran/generated/_abs_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CABSL
+
+elemental function specific__abs_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__abs_c16
+
+   specific__abs_c16 = abs (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_c4.f90 b/libgfortran/generated/_abs_c4.F90
similarity index 92%
rename from libgfortran/generated/_abs_c4.f90
rename to libgfortran/generated/_abs_c4.F90
index 342dc3d16389bbc05cadfba8a2be995387857ca1..a87fcf6c4a48e181fa1299e67f1fa42071ee2470 100644
--- a/libgfortran/generated/_abs_c4.f90
+++ b/libgfortran/generated/_abs_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CABSF
+
 elemental function specific__abs_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__abs_c4
 
    specific__abs_c4 = abs (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_c8.f90 b/libgfortran/generated/_abs_c8.F90
similarity index 92%
rename from libgfortran/generated/_abs_c8.f90
rename to libgfortran/generated/_abs_c8.F90
index e3e18d1b865e44ee76689636372d8181411dd2c5..294c0027b5d42f9538ed8d22521a548c68f720a1 100644
--- a/libgfortran/generated/_abs_c8.f90
+++ b/libgfortran/generated/_abs_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CABS
+
 elemental function specific__abs_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__abs_c8
 
    specific__abs_c8 = abs (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_i16.F90 b/libgfortran/generated/_abs_i16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..afbb67f480eaf12341e125c795b5a15365d892b0
--- /dev/null
+++ b/libgfortran/generated/_abs_i16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+
+elemental function specific__abs_i16 (parm)
+   integer (kind=16), intent (in) :: parm
+   integer (kind=16) :: specific__abs_i16
+
+   specific__abs_i16 = abs (parm)
+end function
+
+
+#endif
diff --git a/libgfortran/generated/_abs_i4.f90 b/libgfortran/generated/_abs_i4.F90
similarity index 93%
rename from libgfortran/generated/_abs_i4.f90
rename to libgfortran/generated/_abs_i4.F90
index 97d94a1a7b766861f643da187f3397069a1f050f..4037d3473aeb349dbf239a4453d14ac73f4dd28a 100644
--- a/libgfortran/generated/_abs_i4.f90
+++ b/libgfortran/generated/_abs_i4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_4)
+
+
 elemental function specific__abs_i4 (parm)
    integer (kind=4), intent (in) :: parm
    integer (kind=4) :: specific__abs_i4
 
    specific__abs_i4 = abs (parm)
 end function
+
+
+#endif
diff --git a/libgfortran/generated/_abs_i8.f90 b/libgfortran/generated/_abs_i8.F90
similarity index 93%
rename from libgfortran/generated/_abs_i8.f90
rename to libgfortran/generated/_abs_i8.F90
index 909cccfb002c75422e6f74959c57fe218e38bbf9..1f2e4244cf984a0c83fe9e21564d43355ccb1360 100644
--- a/libgfortran/generated/_abs_i8.f90
+++ b/libgfortran/generated/_abs_i8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_8)
+
+
 elemental function specific__abs_i8 (parm)
    integer (kind=8), intent (in) :: parm
    integer (kind=8) :: specific__abs_i8
 
    specific__abs_i8 = abs (parm)
 end function
+
+
+#endif
diff --git a/libgfortran/generated/_abs_r10.F90 b/libgfortran/generated/_abs_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..4d76a1eafa9faae5763eab383a71c0720159b35e
--- /dev/null
+++ b/libgfortran/generated/_abs_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_FABSL
+
+elemental function specific__abs_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__abs_r10
+
+   specific__abs_r10 = abs (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_r16.F90 b/libgfortran/generated/_abs_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..3c7d8a74f3107e6bbc58b096b6b143cde63d5867
--- /dev/null
+++ b/libgfortran/generated/_abs_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_FABSL
+
+elemental function specific__abs_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__abs_r16
+
+   specific__abs_r16 = abs (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_r4.f90 b/libgfortran/generated/_abs_r4.F90
similarity index 92%
rename from libgfortran/generated/_abs_r4.f90
rename to libgfortran/generated/_abs_r4.F90
index 52a50056af8a751345b0b99d068d055d9f35f280..31ef426f2acc4fc2a98c24f02482e819d6d36a63 100644
--- a/libgfortran/generated/_abs_r4.f90
+++ b/libgfortran/generated/_abs_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_FABSF
+
 elemental function specific__abs_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__abs_r4
 
    specific__abs_r4 = abs (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_abs_r8.f90 b/libgfortran/generated/_abs_r8.F90
similarity index 92%
rename from libgfortran/generated/_abs_r8.f90
rename to libgfortran/generated/_abs_r8.F90
index 0f137b626d4a0a165cf528706981fce3a5254605..c0b4ce1febe42680578c0a32e971fd8a83a325e3 100644
--- a/libgfortran/generated/_abs_r8.f90
+++ b/libgfortran/generated/_abs_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_FABS
+
 elemental function specific__abs_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__abs_r8
 
    specific__abs_r8 = abs (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_acos_r10.F90 b/libgfortran/generated/_acos_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..d7be7c8940e34d8817288483f5733eb1a0fe6845
--- /dev/null
+++ b/libgfortran/generated/_acos_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_ACOSL
+
+elemental function specific__acos_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__acos_r10
+
+   specific__acos_r10 = acos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_acos_r16.F90 b/libgfortran/generated/_acos_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..f0c6dde0863d9a6c4ef2cf16fab596ae4b3e0784
--- /dev/null
+++ b/libgfortran/generated/_acos_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_ACOSL
+
+elemental function specific__acos_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__acos_r16
+
+   specific__acos_r16 = acos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_acos_r4.f90 b/libgfortran/generated/_acos_r4.F90
similarity index 92%
rename from libgfortran/generated/_acos_r4.f90
rename to libgfortran/generated/_acos_r4.F90
index 8163e387ce3ab46a9054a0bf24fbeeacf4a89029..9e1b97b0e6a0434cd26696a9e30335cdf17d0071 100644
--- a/libgfortran/generated/_acos_r4.f90
+++ b/libgfortran/generated/_acos_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_ACOSF
+
 elemental function specific__acos_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__acos_r4
 
    specific__acos_r4 = acos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_acos_r8.f90 b/libgfortran/generated/_acos_r8.F90
similarity index 92%
rename from libgfortran/generated/_acos_r8.f90
rename to libgfortran/generated/_acos_r8.F90
index d2570911dc2263fbf385b7d2ee71cdae8041aad9..3bded77850329f5e588ebddd93d9eae57d0fb355 100644
--- a/libgfortran/generated/_acos_r8.f90
+++ b/libgfortran/generated/_acos_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_ACOS
+
 elemental function specific__acos_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__acos_r8
 
    specific__acos_r8 = acos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_aint_r10.F90 b/libgfortran/generated/_aint_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2448baa53e850569ac2200a36c070f474d501448
--- /dev/null
+++ b/libgfortran/generated/_aint_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_TRUNCL
+
+elemental function specific__aint_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__aint_r10
+
+   specific__aint_r10 = aint (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_aint_r16.F90 b/libgfortran/generated/_aint_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..9903ad4af19e69e7c20a169e658426cab406cb49
--- /dev/null
+++ b/libgfortran/generated/_aint_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_TRUNCL
+
+elemental function specific__aint_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__aint_r16
+
+   specific__aint_r16 = aint (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_aint_r4.f90 b/libgfortran/generated/_aint_r4.F90
similarity index 92%
rename from libgfortran/generated/_aint_r4.f90
rename to libgfortran/generated/_aint_r4.F90
index a525748c50ac319f1beb83580fc98f1e7b52aacd..4fb714588340dd1772da97938361fedc7c875165 100644
--- a/libgfortran/generated/_aint_r4.f90
+++ b/libgfortran/generated/_aint_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_TRUNCF
+
 elemental function specific__aint_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__aint_r4
 
    specific__aint_r4 = aint (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_aint_r8.f90 b/libgfortran/generated/_aint_r8.F90
similarity index 92%
rename from libgfortran/generated/_aint_r8.f90
rename to libgfortran/generated/_aint_r8.F90
index 0f6e5dd418ab12c1b4e90e45e02153bf8f8d6f4a..f860c7ae38260718f324e080b40aabc05d891646 100644
--- a/libgfortran/generated/_aint_r8.f90
+++ b/libgfortran/generated/_aint_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_TRUNC
+
 elemental function specific__aint_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__aint_r8
 
    specific__aint_r8 = aint (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_anint_r10.F90 b/libgfortran/generated/_anint_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..1652417943f03e5db69c4bdb8ec77db637a0072a
--- /dev/null
+++ b/libgfortran/generated/_anint_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_ROUNDL
+
+elemental function specific__anint_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__anint_r10
+
+   specific__anint_r10 = anint (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_anint_r16.F90 b/libgfortran/generated/_anint_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..48e1dffb1c3a089b17bff70bed85fd67401b521d
--- /dev/null
+++ b/libgfortran/generated/_anint_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_ROUNDL
+
+elemental function specific__anint_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__anint_r16
+
+   specific__anint_r16 = anint (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_anint_r4.f90 b/libgfortran/generated/_anint_r4.F90
similarity index 92%
rename from libgfortran/generated/_anint_r4.f90
rename to libgfortran/generated/_anint_r4.F90
index 8b6d62a359a60c06c9ddd7462a4eae4324cfa4f2..c1c955ce5e89235f6f61c97b1228248b1abd6c29 100644
--- a/libgfortran/generated/_anint_r4.f90
+++ b/libgfortran/generated/_anint_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_ROUNDF
+
 elemental function specific__anint_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__anint_r4
 
    specific__anint_r4 = anint (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_anint_r8.f90 b/libgfortran/generated/_anint_r8.F90
similarity index 92%
rename from libgfortran/generated/_anint_r8.f90
rename to libgfortran/generated/_anint_r8.F90
index 4dc6ab18685a48d07aa7492cddb9bf9a1aad1be2..6c72678944de1c8bd6b12cd927abf287127332a1 100644
--- a/libgfortran/generated/_anint_r8.f90
+++ b/libgfortran/generated/_anint_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_ROUND
+
 elemental function specific__anint_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__anint_r8
 
    specific__anint_r8 = anint (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_asin_r10.F90 b/libgfortran/generated/_asin_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..80939fa3a18ac894b80433b86eff7ae7919fedf5
--- /dev/null
+++ b/libgfortran/generated/_asin_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_ASINL
+
+elemental function specific__asin_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__asin_r10
+
+   specific__asin_r10 = asin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_asin_r16.F90 b/libgfortran/generated/_asin_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..76e37b6f6a5fedd8020f22b9d73ce4ac2d1ac6d1
--- /dev/null
+++ b/libgfortran/generated/_asin_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_ASINL
+
+elemental function specific__asin_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__asin_r16
+
+   specific__asin_r16 = asin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_asin_r4.f90 b/libgfortran/generated/_asin_r4.F90
similarity index 92%
rename from libgfortran/generated/_asin_r4.f90
rename to libgfortran/generated/_asin_r4.F90
index 907d495e5055b1b62f27ec64e5f8abb6def43366..cd77113879fef69d813e1cf59c09f0ef6b8d30ac 100644
--- a/libgfortran/generated/_asin_r4.f90
+++ b/libgfortran/generated/_asin_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_ASINF
+
 elemental function specific__asin_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__asin_r4
 
    specific__asin_r4 = asin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_asin_r8.f90 b/libgfortran/generated/_asin_r8.F90
similarity index 92%
rename from libgfortran/generated/_asin_r8.f90
rename to libgfortran/generated/_asin_r8.F90
index af035a1b04f5b3b7f52399c60b1a74383a352b58..c31f2bc8db3d28ed8ddf8c2899e092b634702437 100644
--- a/libgfortran/generated/_asin_r8.f90
+++ b/libgfortran/generated/_asin_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_ASIN
+
 elemental function specific__asin_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__asin_r8
 
    specific__asin_r8 = asin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_atan2_r10.F90 b/libgfortran/generated/_atan2_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..cc9a170bd2d6e67ce3d2d7b6016123b05a32a292
--- /dev/null
+++ b/libgfortran/generated/_atan2_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+
+#ifdef HAVE_ATAN2L
+
+elemental function specific__atan2_r10 (p1, p2)
+   real (kind=10), intent (in) :: p1, p2
+   real (kind=10) :: specific__atan2_r10
+
+   specific__atan2_r10 = atan2 (p1, p2)
+end function
+
+#endif
+
+#endif
diff --git a/libgfortran/generated/_atan2_r16.F90 b/libgfortran/generated/_atan2_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..f56aabef8e3804156f00e4d2cb9a3afe77c4254a
--- /dev/null
+++ b/libgfortran/generated/_atan2_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+
+#ifdef HAVE_ATAN2L
+
+elemental function specific__atan2_r16 (p1, p2)
+   real (kind=16), intent (in) :: p1, p2
+   real (kind=16) :: specific__atan2_r16
+
+   specific__atan2_r16 = atan2 (p1, p2)
+end function
+
+#endif
+
+#endif
diff --git a/libgfortran/generated/_atan2_r4.f90 b/libgfortran/generated/_atan2_r4.F90
similarity index 92%
rename from libgfortran/generated/_atan2_r4.f90
rename to libgfortran/generated/_atan2_r4.F90
index 92fa2d1b6e82125c0e7b4a9e1e043210cd0a8197..52ecf7917bab06fc1561e8367507e0891a735176 100644
--- a/libgfortran/generated/_atan2_r4.f90
+++ b/libgfortran/generated/_atan2_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+
+#ifdef HAVE_ATAN2F
+
 elemental function specific__atan2_r4 (p1, p2)
    real (kind=4), intent (in) :: p1, p2
    real (kind=4) :: specific__atan2_r4
 
    specific__atan2_r4 = atan2 (p1, p2)
 end function
+
+#endif
+
+#endif
diff --git a/libgfortran/generated/_atan2_r8.f90 b/libgfortran/generated/_atan2_r8.F90
similarity index 92%
rename from libgfortran/generated/_atan2_r8.f90
rename to libgfortran/generated/_atan2_r8.F90
index ef359996a881232d4ee2fd37acf62cab44e9caa1..752b16539873940d5caf447ac092e87297c4514b 100644
--- a/libgfortran/generated/_atan2_r8.f90
+++ b/libgfortran/generated/_atan2_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+
+#ifdef HAVE_ATAN2
+
 elemental function specific__atan2_r8 (p1, p2)
    real (kind=8), intent (in) :: p1, p2
    real (kind=8) :: specific__atan2_r8
 
    specific__atan2_r8 = atan2 (p1, p2)
 end function
+
+#endif
+
+#endif
diff --git a/libgfortran/generated/_atan_r10.F90 b/libgfortran/generated/_atan_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..195d9414f5281e2e57a32b62fd023176e14327bd
--- /dev/null
+++ b/libgfortran/generated/_atan_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_ATANL
+
+elemental function specific__atan_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__atan_r10
+
+   specific__atan_r10 = atan (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_atan_r16.F90 b/libgfortran/generated/_atan_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2691a34fd372cbd217f45c99650352a4a25654c3
--- /dev/null
+++ b/libgfortran/generated/_atan_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_ATANL
+
+elemental function specific__atan_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__atan_r16
+
+   specific__atan_r16 = atan (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_atan_r4.f90 b/libgfortran/generated/_atan_r4.F90
similarity index 92%
rename from libgfortran/generated/_atan_r4.f90
rename to libgfortran/generated/_atan_r4.F90
index e3410cfb0fd660d6ac0cb5ffb7f1093d214ac072..4e88ab24f6978811a831d329c532d3584ea0addf 100644
--- a/libgfortran/generated/_atan_r4.f90
+++ b/libgfortran/generated/_atan_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_ATANF
+
 elemental function specific__atan_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__atan_r4
 
    specific__atan_r4 = atan (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_atan_r8.f90 b/libgfortran/generated/_atan_r8.F90
similarity index 92%
rename from libgfortran/generated/_atan_r8.f90
rename to libgfortran/generated/_atan_r8.F90
index 2e0b75bf2aabfca3dca80676b602a2289f77d776..a99de95447ba4f5fe5492a576f20d65a220e6419 100644
--- a/libgfortran/generated/_atan_r8.f90
+++ b/libgfortran/generated/_atan_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_ATAN
+
 elemental function specific__atan_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__atan_r8
 
    specific__atan_r8 = atan (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_conjg_c10.F90 b/libgfortran/generated/_conjg_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..1fa158d283c844d328349a95905e19700eeb90e3
--- /dev/null
+++ b/libgfortran/generated/_conjg_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+
+elemental function specific__conjg_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__conjg_c10
+
+   specific__conjg_c10 = conjg (parm)
+end function
+
+
+#endif
diff --git a/libgfortran/generated/_conjg_c16.F90 b/libgfortran/generated/_conjg_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..13c8e147830f919f5daadfb3369289c667df8dba
--- /dev/null
+++ b/libgfortran/generated/_conjg_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+
+elemental function specific__conjg_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__conjg_c16
+
+   specific__conjg_c16 = conjg (parm)
+end function
+
+
+#endif
diff --git a/libgfortran/generated/_conjg_c4.f90 b/libgfortran/generated/_conjg_c4.F90
similarity index 93%
rename from libgfortran/generated/_conjg_c4.f90
rename to libgfortran/generated/_conjg_c4.F90
index e5904db113ef0122be4d9109584a790d57d06bfc..a4409c94f495ec5a1dad5d8b68fd1ee9a7a8cb9d 100644
--- a/libgfortran/generated/_conjg_c4.f90
+++ b/libgfortran/generated/_conjg_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+
+
 elemental function specific__conjg_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__conjg_c4
 
    specific__conjg_c4 = conjg (parm)
 end function
+
+
+#endif
diff --git a/libgfortran/generated/_conjg_c8.f90 b/libgfortran/generated/_conjg_c8.F90
similarity index 93%
rename from libgfortran/generated/_conjg_c8.f90
rename to libgfortran/generated/_conjg_c8.F90
index 5e6d35b5e0e6809fabbcf8e574974f04ac2af5bf..f1c1254c9707136a692ca5210047a7fa6ab7ecc8 100644
--- a/libgfortran/generated/_conjg_c8.f90
+++ b/libgfortran/generated/_conjg_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+
+
 elemental function specific__conjg_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__conjg_c8
 
    specific__conjg_c8 = conjg (parm)
 end function
+
+
+#endif
diff --git a/libgfortran/generated/_cos_c10.F90 b/libgfortran/generated/_cos_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..018394cc91934bed724ca67686204d5c71330315
--- /dev/null
+++ b/libgfortran/generated/_cos_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CCOSL
+
+elemental function specific__cos_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__cos_c10
+
+   specific__cos_c10 = cos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_c16.F90 b/libgfortran/generated/_cos_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..ac6bc876862935957a0676607f424663fcf86a77
--- /dev/null
+++ b/libgfortran/generated/_cos_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CCOSL
+
+elemental function specific__cos_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__cos_c16
+
+   specific__cos_c16 = cos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_c4.f90 b/libgfortran/generated/_cos_c4.F90
similarity index 92%
rename from libgfortran/generated/_cos_c4.f90
rename to libgfortran/generated/_cos_c4.F90
index 336f25077c0a00f8a75e991d14c5039e41065831..e49469577bc262c7f0b7e93bda8f5a823801e9c6 100644
--- a/libgfortran/generated/_cos_c4.f90
+++ b/libgfortran/generated/_cos_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CCOSF
+
 elemental function specific__cos_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__cos_c4
 
    specific__cos_c4 = cos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_c8.f90 b/libgfortran/generated/_cos_c8.F90
similarity index 92%
rename from libgfortran/generated/_cos_c8.f90
rename to libgfortran/generated/_cos_c8.F90
index 68e1c707f23a5c123b1317c346f651d90b282c2e..d3daf6e1360d3450db5163d8dbea9d3cc4832234 100644
--- a/libgfortran/generated/_cos_c8.f90
+++ b/libgfortran/generated/_cos_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CCOS
+
 elemental function specific__cos_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__cos_c8
 
    specific__cos_c8 = cos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_r10.F90 b/libgfortran/generated/_cos_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..142cb4b947f7fc6aca7c9e4ea4f0a429ed62e8db
--- /dev/null
+++ b/libgfortran/generated/_cos_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_COSL
+
+elemental function specific__cos_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__cos_r10
+
+   specific__cos_r10 = cos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_r16.F90 b/libgfortran/generated/_cos_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..434639755c4849e1ba0d4c06a936d243be0bcfab
--- /dev/null
+++ b/libgfortran/generated/_cos_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_COSL
+
+elemental function specific__cos_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__cos_r16
+
+   specific__cos_r16 = cos (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_r4.f90 b/libgfortran/generated/_cos_r4.F90
similarity index 92%
rename from libgfortran/generated/_cos_r4.f90
rename to libgfortran/generated/_cos_r4.F90
index 028c69de1c0fa2e0dee4a8c5b4b4022ee13a26ad..ddf2509a272a5e22876925dd8d59a4f5c43f7972 100644
--- a/libgfortran/generated/_cos_r4.f90
+++ b/libgfortran/generated/_cos_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_COSF
+
 elemental function specific__cos_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__cos_r4
 
    specific__cos_r4 = cos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cos_r8.f90 b/libgfortran/generated/_cos_r8.F90
similarity index 92%
rename from libgfortran/generated/_cos_r8.f90
rename to libgfortran/generated/_cos_r8.F90
index 11edb56a61f1054dab4ce56d5d70a988b8a4376f..d45a11aa33cd4e84c668c093160be3cf5c436b3b 100644
--- a/libgfortran/generated/_cos_r8.f90
+++ b/libgfortran/generated/_cos_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_COS
+
 elemental function specific__cos_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__cos_r8
 
    specific__cos_r8 = cos (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cosh_r10.F90 b/libgfortran/generated/_cosh_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..9c7d3fbdf88367ab5028be4ea00be5ce98a3ae47
--- /dev/null
+++ b/libgfortran/generated/_cosh_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_COSHL
+
+elemental function specific__cosh_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__cosh_r10
+
+   specific__cosh_r10 = cosh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cosh_r16.F90 b/libgfortran/generated/_cosh_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..ac28f9965900298bcbee5d1b1a74332b9923027f
--- /dev/null
+++ b/libgfortran/generated/_cosh_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_COSHL
+
+elemental function specific__cosh_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__cosh_r16
+
+   specific__cosh_r16 = cosh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cosh_r4.f90 b/libgfortran/generated/_cosh_r4.F90
similarity index 92%
rename from libgfortran/generated/_cosh_r4.f90
rename to libgfortran/generated/_cosh_r4.F90
index 7fab9fc404d8db1dd492bf4d040381a834c1a81c..289c9bc0e24a1856f62dc6dfc33480a805d3ec77 100644
--- a/libgfortran/generated/_cosh_r4.f90
+++ b/libgfortran/generated/_cosh_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_COSHF
+
 elemental function specific__cosh_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__cosh_r4
 
    specific__cosh_r4 = cosh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_cosh_r8.f90 b/libgfortran/generated/_cosh_r8.F90
similarity index 92%
rename from libgfortran/generated/_cosh_r8.f90
rename to libgfortran/generated/_cosh_r8.F90
index 855ee485c5e98b5ac9eaa84f0fd69527920e0f05..6b47452298c69001dd49e12c1735ac16bf97510e 100644
--- a/libgfortran/generated/_cosh_r8.f90
+++ b/libgfortran/generated/_cosh_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_COSH
+
 elemental function specific__cosh_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__cosh_r8
 
    specific__cosh_r8 = cosh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_dim_i16.F90 b/libgfortran/generated/_dim_i16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..55a1a521a88295c988abdd59bfc80e6640ed3175
--- /dev/null
+++ b/libgfortran/generated/_dim_i16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+
+
+elemental function specific__dim_i16 (p1, p2)
+   integer (kind=16), intent (in) :: p1, p2
+   integer (kind=16) :: specific__dim_i16
+
+   specific__dim_i16 = dim (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_i4.f90 b/libgfortran/generated/_dim_i4.F90
similarity index 93%
rename from libgfortran/generated/_dim_i4.f90
rename to libgfortran/generated/_dim_i4.F90
index 4396c66bcc0b11328849be7702bd1ebe52d6172b..2fd8658460ae09a158b4aa001bcaa36ff1e3cd68 100644
--- a/libgfortran/generated/_dim_i4.f90
+++ b/libgfortran/generated/_dim_i4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_4)
+
+
+
 elemental function specific__dim_i4 (p1, p2)
    integer (kind=4), intent (in) :: p1, p2
    integer (kind=4) :: specific__dim_i4
 
    specific__dim_i4 = dim (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_i8.f90 b/libgfortran/generated/_dim_i8.F90
similarity index 93%
rename from libgfortran/generated/_dim_i8.f90
rename to libgfortran/generated/_dim_i8.F90
index 0584d1a3a451e4a7d095a0f0de9e04e640cf390a..e861d9eb8416b8fc33c1dc67be52025bd5070b4a 100644
--- a/libgfortran/generated/_dim_i8.f90
+++ b/libgfortran/generated/_dim_i8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_8)
+
+
+
 elemental function specific__dim_i8 (p1, p2)
    integer (kind=8), intent (in) :: p1, p2
    integer (kind=8) :: specific__dim_i8
 
    specific__dim_i8 = dim (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_r10.F90 b/libgfortran/generated/_dim_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..1e7743d667193be188917d1f68beaa4861514cef
--- /dev/null
+++ b/libgfortran/generated/_dim_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+
+
+
+elemental function specific__dim_r10 (p1, p2)
+   real (kind=10), intent (in) :: p1, p2
+   real (kind=10) :: specific__dim_r10
+
+   specific__dim_r10 = dim (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_r16.F90 b/libgfortran/generated/_dim_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..97a048890e3e8055913cdfdb1126386588038f2b
--- /dev/null
+++ b/libgfortran/generated/_dim_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+
+
+
+elemental function specific__dim_r16 (p1, p2)
+   real (kind=16), intent (in) :: p1, p2
+   real (kind=16) :: specific__dim_r16
+
+   specific__dim_r16 = dim (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_r4.f90 b/libgfortran/generated/_dim_r4.F90
similarity index 93%
rename from libgfortran/generated/_dim_r4.f90
rename to libgfortran/generated/_dim_r4.F90
index 7fd1bc5dc85aeb42a93bc157ff22ef44d7394d6d..465b28489aa352cb8e8a713a5f75e4f868fb8263 100644
--- a/libgfortran/generated/_dim_r4.f90
+++ b/libgfortran/generated/_dim_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+
+
+
 elemental function specific__dim_r4 (p1, p2)
    real (kind=4), intent (in) :: p1, p2
    real (kind=4) :: specific__dim_r4
 
    specific__dim_r4 = dim (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_dim_r8.f90 b/libgfortran/generated/_dim_r8.F90
similarity index 93%
rename from libgfortran/generated/_dim_r8.f90
rename to libgfortran/generated/_dim_r8.F90
index 3e43f11f1f64a5230636ac18799f30db0b49e167..3e6b3379fe26509077e768b7e3d88ac3ece89f6a 100644
--- a/libgfortran/generated/_dim_r8.f90
+++ b/libgfortran/generated/_dim_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+
+
+
 elemental function specific__dim_r8 (p1, p2)
    real (kind=8), intent (in) :: p1, p2
    real (kind=8) :: specific__dim_r8
 
    specific__dim_r8 = dim (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_exp_c10.F90 b/libgfortran/generated/_exp_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..bcf1f2bdd8733758acde51e5259557b945217bbb
--- /dev/null
+++ b/libgfortran/generated/_exp_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CEXPL
+
+elemental function specific__exp_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__exp_c10
+
+   specific__exp_c10 = exp (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_c16.F90 b/libgfortran/generated/_exp_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..58527bc536ab66970f6194091745858ed7280c4c
--- /dev/null
+++ b/libgfortran/generated/_exp_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CEXPL
+
+elemental function specific__exp_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__exp_c16
+
+   specific__exp_c16 = exp (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_c4.f90 b/libgfortran/generated/_exp_c4.F90
similarity index 92%
rename from libgfortran/generated/_exp_c4.f90
rename to libgfortran/generated/_exp_c4.F90
index 28044eb75da6117c34299ddeaf27aa5a96abc082..6fba6756be9c63e692cb53fb4924f9abc50ab219 100644
--- a/libgfortran/generated/_exp_c4.f90
+++ b/libgfortran/generated/_exp_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CEXPF
+
 elemental function specific__exp_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__exp_c4
 
    specific__exp_c4 = exp (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_c8.f90 b/libgfortran/generated/_exp_c8.F90
similarity index 92%
rename from libgfortran/generated/_exp_c8.f90
rename to libgfortran/generated/_exp_c8.F90
index 17f15375f0c6048ebc06728314f33ded1ba8ed31..cbc82a156dd0d079d8443b19787ed7ba59a36fef 100644
--- a/libgfortran/generated/_exp_c8.f90
+++ b/libgfortran/generated/_exp_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CEXP
+
 elemental function specific__exp_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__exp_c8
 
    specific__exp_c8 = exp (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_r10.F90 b/libgfortran/generated/_exp_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..86bf749943a8aec6ea7fe2b5bc376c45d6de5f0a
--- /dev/null
+++ b/libgfortran/generated/_exp_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_EXPL
+
+elemental function specific__exp_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__exp_r10
+
+   specific__exp_r10 = exp (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_r16.F90 b/libgfortran/generated/_exp_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..4aaee9eb17d8d069318cbd96afae8523359dbabe
--- /dev/null
+++ b/libgfortran/generated/_exp_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_EXPL
+
+elemental function specific__exp_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__exp_r16
+
+   specific__exp_r16 = exp (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_r4.f90 b/libgfortran/generated/_exp_r4.F90
similarity index 92%
rename from libgfortran/generated/_exp_r4.f90
rename to libgfortran/generated/_exp_r4.F90
index 261f6a08489fda33422998858fbda5cc13902005..d76fb143cc649b304bc7cbaffeefb3d376bf636b 100644
--- a/libgfortran/generated/_exp_r4.f90
+++ b/libgfortran/generated/_exp_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_EXPF
+
 elemental function specific__exp_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__exp_r4
 
    specific__exp_r4 = exp (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_exp_r8.f90 b/libgfortran/generated/_exp_r8.F90
similarity index 92%
rename from libgfortran/generated/_exp_r8.f90
rename to libgfortran/generated/_exp_r8.F90
index f525b413a1be0701846bded752b557ae33677ca6..d529810ca57cce13563edc8dec1f913253861bfc 100644
--- a/libgfortran/generated/_exp_r8.f90
+++ b/libgfortran/generated/_exp_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_EXP
+
 elemental function specific__exp_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__exp_r8
 
    specific__exp_r8 = exp (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log10_r10.F90 b/libgfortran/generated/_log10_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..19aeac5c1befd58251403867cf924299542861ca
--- /dev/null
+++ b/libgfortran/generated/_log10_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_LOG10L
+
+elemental function specific__log10_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__log10_r10
+
+   specific__log10_r10 = log10 (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log10_r16.F90 b/libgfortran/generated/_log10_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..c03002aa45604c78e2bff4f48697eafdc598ba04
--- /dev/null
+++ b/libgfortran/generated/_log10_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_LOG10L
+
+elemental function specific__log10_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__log10_r16
+
+   specific__log10_r16 = log10 (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log10_r4.f90 b/libgfortran/generated/_log10_r4.F90
similarity index 92%
rename from libgfortran/generated/_log10_r4.f90
rename to libgfortran/generated/_log10_r4.F90
index 712d56b4aae65499de1293dfacca3d2175d29e42..c772527ae861d56d61b77cc73fba2f464640226b 100644
--- a/libgfortran/generated/_log10_r4.f90
+++ b/libgfortran/generated/_log10_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_LOG10F
+
 elemental function specific__log10_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__log10_r4
 
    specific__log10_r4 = log10 (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log10_r8.f90 b/libgfortran/generated/_log10_r8.F90
similarity index 92%
rename from libgfortran/generated/_log10_r8.f90
rename to libgfortran/generated/_log10_r8.F90
index 7c3f63de5e125369cae20711aa88340e0ec0ed78..396570989e6af5af6fd31fa424c457fff1445039 100644
--- a/libgfortran/generated/_log10_r8.f90
+++ b/libgfortran/generated/_log10_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_LOG10
+
 elemental function specific__log10_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__log10_r8
 
    specific__log10_r8 = log10 (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_c10.F90 b/libgfortran/generated/_log_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..e3f6934e6288d948943f42c93ce259a418385ac1
--- /dev/null
+++ b/libgfortran/generated/_log_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CLOGL
+
+elemental function specific__log_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__log_c10
+
+   specific__log_c10 = log (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_c16.F90 b/libgfortran/generated/_log_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..776140a7e78bc452f7c5b8f5bad1b895bf3ec8ad
--- /dev/null
+++ b/libgfortran/generated/_log_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CLOGL
+
+elemental function specific__log_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__log_c16
+
+   specific__log_c16 = log (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_c4.f90 b/libgfortran/generated/_log_c4.F90
similarity index 92%
rename from libgfortran/generated/_log_c4.f90
rename to libgfortran/generated/_log_c4.F90
index 7f83e527f264978fddd739f2e75c88554be9c36e..923bdd573cab4acb5c03f9958d3906c05b555a67 100644
--- a/libgfortran/generated/_log_c4.f90
+++ b/libgfortran/generated/_log_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CLOGF
+
 elemental function specific__log_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__log_c4
 
    specific__log_c4 = log (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_c8.f90 b/libgfortran/generated/_log_c8.F90
similarity index 92%
rename from libgfortran/generated/_log_c8.f90
rename to libgfortran/generated/_log_c8.F90
index 92b267be0a95246b836dd85761d633902763a20f..0df0dd83d2d15c6f8f0d14e04ca43f2dd828cafb 100644
--- a/libgfortran/generated/_log_c8.f90
+++ b/libgfortran/generated/_log_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CLOG
+
 elemental function specific__log_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__log_c8
 
    specific__log_c8 = log (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_r10.F90 b/libgfortran/generated/_log_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..d8938818053b7d79bfb7d03ed9274d85a2cc0c93
--- /dev/null
+++ b/libgfortran/generated/_log_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_LOGL
+
+elemental function specific__log_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__log_r10
+
+   specific__log_r10 = log (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_r16.F90 b/libgfortran/generated/_log_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..5013656e9da8d0405c563346481fd78467ca6b4c
--- /dev/null
+++ b/libgfortran/generated/_log_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_LOGL
+
+elemental function specific__log_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__log_r16
+
+   specific__log_r16 = log (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_r4.f90 b/libgfortran/generated/_log_r4.F90
similarity index 92%
rename from libgfortran/generated/_log_r4.f90
rename to libgfortran/generated/_log_r4.F90
index 6e667a02718c27c1fd1708aabfe6ddea0647653c..6a742377648d01a379b3d040d88286669f283664 100644
--- a/libgfortran/generated/_log_r4.f90
+++ b/libgfortran/generated/_log_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_LOGF
+
 elemental function specific__log_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__log_r4
 
    specific__log_r4 = log (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_log_r8.f90 b/libgfortran/generated/_log_r8.F90
similarity index 92%
rename from libgfortran/generated/_log_r8.f90
rename to libgfortran/generated/_log_r8.F90
index 38a862835047489ad1c85f93b51ff2cede259228..8383bbfd36a996ae01e169bfb73d6bb23815a5f5 100644
--- a/libgfortran/generated/_log_r8.f90
+++ b/libgfortran/generated/_log_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_LOG
+
 elemental function specific__log_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__log_r8
 
    specific__log_r8 = log (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_mod_i16.F90 b/libgfortran/generated/_mod_i16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..571db409bf9e732da37c7a51c535cbb5a4490823
--- /dev/null
+++ b/libgfortran/generated/_mod_i16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+
+
+elemental function specific__mod_i16 (p1, p2)
+   integer (kind=16), intent (in) :: p1, p2
+   integer (kind=16) :: specific__mod_i16
+
+   specific__mod_i16 = mod (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_mod_i4.f90 b/libgfortran/generated/_mod_i4.F90
similarity index 93%
rename from libgfortran/generated/_mod_i4.f90
rename to libgfortran/generated/_mod_i4.F90
index 3776e05c4d8a1567e95337412370b953f7bbf63b..ec6f81dee2a0051cf46006647bb35f439bc04326 100644
--- a/libgfortran/generated/_mod_i4.f90
+++ b/libgfortran/generated/_mod_i4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_4)
+
+
+
 elemental function specific__mod_i4 (p1, p2)
    integer (kind=4), intent (in) :: p1, p2
    integer (kind=4) :: specific__mod_i4
 
    specific__mod_i4 = mod (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_mod_i8.f90 b/libgfortran/generated/_mod_i8.F90
similarity index 93%
rename from libgfortran/generated/_mod_i8.f90
rename to libgfortran/generated/_mod_i8.F90
index 4dd2b52d2c9f876e13ec951e3f4ad1ecd343f58e..e34278b13eca85209a2eaf7461699dd337442c69 100644
--- a/libgfortran/generated/_mod_i8.f90
+++ b/libgfortran/generated/_mod_i8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_8)
+
+
+
 elemental function specific__mod_i8 (p1, p2)
    integer (kind=8), intent (in) :: p1, p2
    integer (kind=8) :: specific__mod_i8
 
    specific__mod_i8 = mod (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_mod_r4.f90 b/libgfortran/generated/_mod_r4.F90
similarity index 93%
rename from libgfortran/generated/_mod_r4.f90
rename to libgfortran/generated/_mod_r4.F90
index 20fb128f1cc01a3e78cccbbee4fdf37ab6610d6e..6742ee488affe0d1b8b5c0c946855a7c0c6c01d8 100644
--- a/libgfortran/generated/_mod_r4.f90
+++ b/libgfortran/generated/_mod_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+
+
+
 elemental function specific__mod_r4 (p1, p2)
    real (kind=4), intent (in) :: p1, p2
    real (kind=4) :: specific__mod_r4
 
    specific__mod_r4 = mod (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_mod_r8.f90 b/libgfortran/generated/_mod_r8.F90
similarity index 93%
rename from libgfortran/generated/_mod_r8.f90
rename to libgfortran/generated/_mod_r8.F90
index 25b90d4df25de777bcb6dc57fb6399eda5c9513e..3cc7e1651114b53847d75b060cfd210c910ca274 100644
--- a/libgfortran/generated/_mod_r8.f90
+++ b/libgfortran/generated/_mod_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+
+
+
 elemental function specific__mod_r8 (p1, p2)
    real (kind=8), intent (in) :: p1, p2
    real (kind=8) :: specific__mod_r8
 
    specific__mod_r8 = mod (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_i16.F90 b/libgfortran/generated/_sign_i16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..50e492c3f802aa4026d3bba0aa66683219ffce4a
--- /dev/null
+++ b/libgfortran/generated/_sign_i16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+
+
+elemental function specific__sign_i16 (p1, p2)
+   integer (kind=16), intent (in) :: p1, p2
+   integer (kind=16) :: specific__sign_i16
+
+   specific__sign_i16 = sign (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_i4.f90 b/libgfortran/generated/_sign_i4.F90
similarity index 93%
rename from libgfortran/generated/_sign_i4.f90
rename to libgfortran/generated/_sign_i4.F90
index 420318876c27082d073acac4f23be47cbde1a668..d9ea551c6d9d2fdd3b52379bf07bd1c41762903a 100644
--- a/libgfortran/generated/_sign_i4.f90
+++ b/libgfortran/generated/_sign_i4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_4)
+
+
+
 elemental function specific__sign_i4 (p1, p2)
    integer (kind=4), intent (in) :: p1, p2
    integer (kind=4) :: specific__sign_i4
 
    specific__sign_i4 = sign (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_i8.f90 b/libgfortran/generated/_sign_i8.F90
similarity index 93%
rename from libgfortran/generated/_sign_i8.f90
rename to libgfortran/generated/_sign_i8.F90
index e3cd674cbb94d04a67741802e33f3bfa5eb8ffb8..241fb8b0f1c9c948d34899f9d43b58ed27a61919 100644
--- a/libgfortran/generated/_sign_i8.f90
+++ b/libgfortran/generated/_sign_i8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_INTEGER_8)
+
+
+
 elemental function specific__sign_i8 (p1, p2)
    integer (kind=8), intent (in) :: p1, p2
    integer (kind=8) :: specific__sign_i8
 
    specific__sign_i8 = sign (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_r10.F90 b/libgfortran/generated/_sign_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..002330f0d80c71972a7b04e7e953f4e1b48587e4
--- /dev/null
+++ b/libgfortran/generated/_sign_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+
+
+
+elemental function specific__sign_r10 (p1, p2)
+   real (kind=10), intent (in) :: p1, p2
+   real (kind=10) :: specific__sign_r10
+
+   specific__sign_r10 = sign (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_r16.F90 b/libgfortran/generated/_sign_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..8377969c67aebbaae679474bf1128472d81cdcd5
--- /dev/null
+++ b/libgfortran/generated/_sign_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+
+
+
+elemental function specific__sign_r16 (p1, p2)
+   real (kind=16), intent (in) :: p1, p2
+   real (kind=16) :: specific__sign_r16
+
+   specific__sign_r16 = sign (p1, p2)
+end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_r4.f90 b/libgfortran/generated/_sign_r4.F90
similarity index 93%
rename from libgfortran/generated/_sign_r4.f90
rename to libgfortran/generated/_sign_r4.F90
index f5fef6a20312dc891b0e25067ad072eb937b77f9..e11f15d093edac30133d2e9484a7269c93517152 100644
--- a/libgfortran/generated/_sign_r4.f90
+++ b/libgfortran/generated/_sign_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+
+
+
 elemental function specific__sign_r4 (p1, p2)
    real (kind=4), intent (in) :: p1, p2
    real (kind=4) :: specific__sign_r4
 
    specific__sign_r4 = sign (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sign_r8.f90 b/libgfortran/generated/_sign_r8.F90
similarity index 93%
rename from libgfortran/generated/_sign_r8.f90
rename to libgfortran/generated/_sign_r8.F90
index b676205d18747630c751aca0ff1d5086b17ddd49..66f8dee53a52e9444c2850487fd405d0c48e8238 100644
--- a/libgfortran/generated/_sign_r8.f90
+++ b/libgfortran/generated/_sign_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+
+
+
 elemental function specific__sign_r8 (p1, p2)
    real (kind=8), intent (in) :: p1, p2
    real (kind=8) :: specific__sign_r8
 
    specific__sign_r8 = sign (p1, p2)
 end function
+
+
+
+#endif
diff --git a/libgfortran/generated/_sin_c10.F90 b/libgfortran/generated/_sin_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2c34b3c931d2f674f67dcf5f4c85d2fd1c6b607e
--- /dev/null
+++ b/libgfortran/generated/_sin_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CSINL
+
+elemental function specific__sin_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__sin_c10
+
+   specific__sin_c10 = sin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_c16.F90 b/libgfortran/generated/_sin_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..75a7108795fe52f868614f30ce2460458a5bb6dd
--- /dev/null
+++ b/libgfortran/generated/_sin_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CSINL
+
+elemental function specific__sin_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__sin_c16
+
+   specific__sin_c16 = sin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_c4.f90 b/libgfortran/generated/_sin_c4.F90
similarity index 92%
rename from libgfortran/generated/_sin_c4.f90
rename to libgfortran/generated/_sin_c4.F90
index 059bd9439812cece8c629fa89dbcbd0f0ab1dd18..0efc127d87f7317035e7f3a6668e817f0ca06c94 100644
--- a/libgfortran/generated/_sin_c4.f90
+++ b/libgfortran/generated/_sin_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CSINF
+
 elemental function specific__sin_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__sin_c4
 
    specific__sin_c4 = sin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_c8.f90 b/libgfortran/generated/_sin_c8.F90
similarity index 92%
rename from libgfortran/generated/_sin_c8.f90
rename to libgfortran/generated/_sin_c8.F90
index 56c4cfa3895707ccffac86afbb8f87b4337b02ff..73a27a42e69c909c858b6cd7fbb19fc6d6230ea8 100644
--- a/libgfortran/generated/_sin_c8.f90
+++ b/libgfortran/generated/_sin_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CSIN
+
 elemental function specific__sin_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__sin_c8
 
    specific__sin_c8 = sin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_r10.F90 b/libgfortran/generated/_sin_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..55f5871fc3decdf47f259bdfd23ad0424da9bf7c
--- /dev/null
+++ b/libgfortran/generated/_sin_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_SINL
+
+elemental function specific__sin_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__sin_r10
+
+   specific__sin_r10 = sin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_r16.F90 b/libgfortran/generated/_sin_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..3757cc0b1f8e5023b08fe478caf9efc53184f470
--- /dev/null
+++ b/libgfortran/generated/_sin_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_SINL
+
+elemental function specific__sin_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__sin_r16
+
+   specific__sin_r16 = sin (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_r4.f90 b/libgfortran/generated/_sin_r4.F90
similarity index 92%
rename from libgfortran/generated/_sin_r4.f90
rename to libgfortran/generated/_sin_r4.F90
index 4520ad7d9efbefcd365813d379ee5bed78b22382..4fea10356e91a19152715f9dc48f9aac82ac9d50 100644
--- a/libgfortran/generated/_sin_r4.f90
+++ b/libgfortran/generated/_sin_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_SINF
+
 elemental function specific__sin_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__sin_r4
 
    specific__sin_r4 = sin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sin_r8.f90 b/libgfortran/generated/_sin_r8.F90
similarity index 92%
rename from libgfortran/generated/_sin_r8.f90
rename to libgfortran/generated/_sin_r8.F90
index 20dd269fef160cfc09f2b3eb8b4fe121c03b4b6c..e35c3d1c25452527a9cb449742350fccfe417963 100644
--- a/libgfortran/generated/_sin_r8.f90
+++ b/libgfortran/generated/_sin_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_SIN
+
 elemental function specific__sin_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__sin_r8
 
    specific__sin_r8 = sin (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sinh_r10.F90 b/libgfortran/generated/_sinh_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..7aa5e98a2f374f7844e9bf38fccb6130a015ab3f
--- /dev/null
+++ b/libgfortran/generated/_sinh_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_SINHL
+
+elemental function specific__sinh_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__sinh_r10
+
+   specific__sinh_r10 = sinh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sinh_r16.F90 b/libgfortran/generated/_sinh_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..6ea69470788b6ac387cab3a55ba014127193f116
--- /dev/null
+++ b/libgfortran/generated/_sinh_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_SINHL
+
+elemental function specific__sinh_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__sinh_r16
+
+   specific__sinh_r16 = sinh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sinh_r4.f90 b/libgfortran/generated/_sinh_r4.F90
similarity index 92%
rename from libgfortran/generated/_sinh_r4.f90
rename to libgfortran/generated/_sinh_r4.F90
index 545d0aa5dedcfeea5163a233119c2e5c51175648..1101debe9025f7eb69782287996efb904620a939 100644
--- a/libgfortran/generated/_sinh_r4.f90
+++ b/libgfortran/generated/_sinh_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_SINHF
+
 elemental function specific__sinh_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__sinh_r4
 
    specific__sinh_r4 = sinh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sinh_r8.f90 b/libgfortran/generated/_sinh_r8.F90
similarity index 92%
rename from libgfortran/generated/_sinh_r8.f90
rename to libgfortran/generated/_sinh_r8.F90
index b3788390148b3756ef1f6553a1f775450f6485e5..63eb8d5c2465a6e5cc7774c06a9e2b315c70d64f 100644
--- a/libgfortran/generated/_sinh_r8.f90
+++ b/libgfortran/generated/_sinh_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_SINH
+
 elemental function specific__sinh_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__sinh_r8
 
    specific__sinh_r8 = sinh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_c10.F90 b/libgfortran/generated/_sqrt_c10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2159a6b93aaa4e0cb5c21982c981796cfc148376
--- /dev/null
+++ b/libgfortran/generated/_sqrt_c10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+#ifdef HAVE_CSQRTL
+
+elemental function specific__sqrt_c10 (parm)
+   complex (kind=10), intent (in) :: parm
+   complex (kind=10) :: specific__sqrt_c10
+
+   specific__sqrt_c10 = sqrt (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_c16.F90 b/libgfortran/generated/_sqrt_c16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2ee9c83a1bbb8e388c3c16d14bdf563532869303
--- /dev/null
+++ b/libgfortran/generated/_sqrt_c16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+#ifdef HAVE_CSQRTL
+
+elemental function specific__sqrt_c16 (parm)
+   complex (kind=16), intent (in) :: parm
+   complex (kind=16) :: specific__sqrt_c16
+
+   specific__sqrt_c16 = sqrt (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_c4.f90 b/libgfortran/generated/_sqrt_c4.F90
similarity index 92%
rename from libgfortran/generated/_sqrt_c4.f90
rename to libgfortran/generated/_sqrt_c4.F90
index 901f2d7e5c1c157c9c6908361da5c592d73f3f8b..1e88a3d6e5db5b04ef8197fd804a293284247e9e 100644
--- a/libgfortran/generated/_sqrt_c4.f90
+++ b/libgfortran/generated/_sqrt_c4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_4)
+#ifdef HAVE_CSQRTF
+
 elemental function specific__sqrt_c4 (parm)
    complex (kind=4), intent (in) :: parm
    complex (kind=4) :: specific__sqrt_c4
 
    specific__sqrt_c4 = sqrt (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_c8.f90 b/libgfortran/generated/_sqrt_c8.F90
similarity index 92%
rename from libgfortran/generated/_sqrt_c8.f90
rename to libgfortran/generated/_sqrt_c8.F90
index 023620f328530c8158b2b3256e85b486d531db4b..edd5e399b0b7ab84258bb642eb47be65445ba57d 100644
--- a/libgfortran/generated/_sqrt_c8.f90
+++ b/libgfortran/generated/_sqrt_c8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_COMPLEX_8)
+#ifdef HAVE_CSQRT
+
 elemental function specific__sqrt_c8 (parm)
    complex (kind=8), intent (in) :: parm
    complex (kind=8) :: specific__sqrt_c8
 
    specific__sqrt_c8 = sqrt (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_r10.F90 b/libgfortran/generated/_sqrt_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..2ea81ba56cbd3b9856d04a7eef845039aa9a60dd
--- /dev/null
+++ b/libgfortran/generated/_sqrt_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_SQRTL
+
+elemental function specific__sqrt_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__sqrt_r10
+
+   specific__sqrt_r10 = sqrt (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_r16.F90 b/libgfortran/generated/_sqrt_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..5ecd027bd1be0416863a16e44345260523e1138d
--- /dev/null
+++ b/libgfortran/generated/_sqrt_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_SQRTL
+
+elemental function specific__sqrt_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__sqrt_r16
+
+   specific__sqrt_r16 = sqrt (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_r4.f90 b/libgfortran/generated/_sqrt_r4.F90
similarity index 92%
rename from libgfortran/generated/_sqrt_r4.f90
rename to libgfortran/generated/_sqrt_r4.F90
index d55cfa723df747df784a18e0abaea312cc99f5b0..43c710f0dd2ef38e84339846e1272005fd9371d5 100644
--- a/libgfortran/generated/_sqrt_r4.f90
+++ b/libgfortran/generated/_sqrt_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_SQRTF
+
 elemental function specific__sqrt_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__sqrt_r4
 
    specific__sqrt_r4 = sqrt (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_sqrt_r8.f90 b/libgfortran/generated/_sqrt_r8.F90
similarity index 92%
rename from libgfortran/generated/_sqrt_r8.f90
rename to libgfortran/generated/_sqrt_r8.F90
index 28c1d5db127c639a475d35f9723d291d80dd6003..2f710962b8f7ee5183e83cc81835e8339321d8e7 100644
--- a/libgfortran/generated/_sqrt_r8.f90
+++ b/libgfortran/generated/_sqrt_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_SQRT
+
 elemental function specific__sqrt_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__sqrt_r8
 
    specific__sqrt_r8 = sqrt (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tan_r10.F90 b/libgfortran/generated/_tan_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..d4c06ae4a86bbe9b5791ac3dde7973d9607ff9db
--- /dev/null
+++ b/libgfortran/generated/_tan_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_TANL
+
+elemental function specific__tan_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__tan_r10
+
+   specific__tan_r10 = tan (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tan_r16.F90 b/libgfortran/generated/_tan_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..5a6f61a3f9dfd2493ad4dda7b1b7025bac5394a0
--- /dev/null
+++ b/libgfortran/generated/_tan_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_TANL
+
+elemental function specific__tan_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__tan_r16
+
+   specific__tan_r16 = tan (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tan_r4.f90 b/libgfortran/generated/_tan_r4.F90
similarity index 92%
rename from libgfortran/generated/_tan_r4.f90
rename to libgfortran/generated/_tan_r4.F90
index 7e0fd5578818ee049a27b72bfea8771e85b59940..ee8f438d7e279d41ba7d6eb339325df3a84ffa5c 100644
--- a/libgfortran/generated/_tan_r4.f90
+++ b/libgfortran/generated/_tan_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_TANF
+
 elemental function specific__tan_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__tan_r4
 
    specific__tan_r4 = tan (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tan_r8.f90 b/libgfortran/generated/_tan_r8.F90
similarity index 92%
rename from libgfortran/generated/_tan_r8.f90
rename to libgfortran/generated/_tan_r8.F90
index 5a8716ea1b65779ad1a06c31ab91fe1f0040feca..f2e357b2dd1e0917268567c48aa0e01ac86fefe3 100644
--- a/libgfortran/generated/_tan_r8.f90
+++ b/libgfortran/generated/_tan_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_TAN
+
 elemental function specific__tan_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__tan_r8
 
    specific__tan_r8 = tan (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tanh_r10.F90 b/libgfortran/generated/_tanh_r10.F90
new file mode 100644
index 0000000000000000000000000000000000000000..5d04f65475da364d8f9a809acde38aaf394be6bd
--- /dev/null
+++ b/libgfortran/generated/_tanh_r10.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_10)
+#ifdef HAVE_TANHL
+
+elemental function specific__tanh_r10 (parm)
+   real (kind=10), intent (in) :: parm
+   real (kind=10) :: specific__tanh_r10
+
+   specific__tanh_r10 = tanh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tanh_r16.F90 b/libgfortran/generated/_tanh_r16.F90
new file mode 100644
index 0000000000000000000000000000000000000000..9a858b5c071ca24a55241d4d469a53d91feba9ab
--- /dev/null
+++ b/libgfortran/generated/_tanh_r16.F90
@@ -0,0 +1,51 @@
+!   Copyright 2002 Free Software Foundation, Inc.
+!   Contributed by Paul Brook <paul@nowt.org>
+!
+!This file is part of the GNU Fortran 95 runtime library (libgfortran).
+!
+!GNU libgfortran is free software; you can redistribute it and/or
+!modify it under the terms of the GNU General Public
+!License as published by the Free Software Foundation; either
+!version 2 of the License, or (at your option) any later version.
+
+!In addition to the permissions in the GNU General Public License, the
+!Free Software Foundation gives you unlimited permission to link the
+!compiled version of this file into combinations with other programs,
+!and to distribute those combinations without any restriction coming
+!from the use of this file.  (The General Public License restrictions
+!do apply in other respects; for example, they cover modification of
+!the file, and distribution when not linked into a combine
+!executable.)
+!
+!GNU libgfortran is distributed in the hope that it will be useful,
+!but WITHOUT ANY WARRANTY; without even the implied warranty of
+!MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+!GNU General Public License for more details.
+!
+!You should have received a copy of the GNU General Public
+!License along with libgfortran; see the file COPYING.  If not,
+!write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+!Boston, MA 02110-1301, USA.
+!
+!This file is machine generated.
+
+
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_16)
+#ifdef HAVE_TANHL
+
+elemental function specific__tanh_r16 (parm)
+   real (kind=16), intent (in) :: parm
+   real (kind=16) :: specific__tanh_r16
+
+   specific__tanh_r16 = tanh (parm)
+end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tanh_r4.f90 b/libgfortran/generated/_tanh_r4.F90
similarity index 92%
rename from libgfortran/generated/_tanh_r4.f90
rename to libgfortran/generated/_tanh_r4.F90
index 0f3174b468aea0a8bbbea6ececa069615ac15349..0872fe66540e54c8394c1505f86e3b8011a9394b 100644
--- a/libgfortran/generated/_tanh_r4.f90
+++ b/libgfortran/generated/_tanh_r4.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_4)
+#ifdef HAVE_TANHF
+
 elemental function specific__tanh_r4 (parm)
    real (kind=4), intent (in) :: parm
    real (kind=4) :: specific__tanh_r4
 
    specific__tanh_r4 = tanh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/_tanh_r8.f90 b/libgfortran/generated/_tanh_r8.F90
similarity index 92%
rename from libgfortran/generated/_tanh_r8.f90
rename to libgfortran/generated/_tanh_r8.F90
index 9d6ed774f05d3673a5b77ff59f0e644cfb1c7dbd..40a6668e403c71890a3f3b4eecb4d4bfcf1d9fc6 100644
--- a/libgfortran/generated/_tanh_r8.f90
+++ b/libgfortran/generated/_tanh_r8.F90
@@ -30,9 +30,22 @@
 !This file is machine generated.
 
 
+
+
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+#if defined (HAVE_GFC_REAL_8)
+#ifdef HAVE_TANH
+
 elemental function specific__tanh_r8 (parm)
    real (kind=8), intent (in) :: parm
    real (kind=8) :: specific__tanh_r8
 
    specific__tanh_r8 = tanh (parm)
 end function
+
+#endif
+#endif
diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..40851eb2c19d763b75c07b4b1d51a380f82789d0
--- /dev/null
+++ b/libgfortran/generated/all_l16.c
@@ -0,0 +1,177 @@
+/* Implementation of the ALL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_LOGICAL_16)
+
+
+extern void all_l16 (gfc_array_l16 *, gfc_array_l16 *, index_type *);
+export_proto(all_l16);
+
+void
+all_l16 (gfc_array_l16 *retarray, gfc_array_l16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_16 *base;
+  GFC_LOGICAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_LOGICAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_16 *src;
+      GFC_LOGICAL_16 result;
+      src = base;
+      {
+
+  /* Return true only if all the elements are set.  */
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (! *src)
+    {
+      result = 0;
+      break;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c
index 82035f19cbee2c2363f91cb92717e789d1c9077a..246ec07a5074b72b6acb8fbbea75370d125361e2 100644
--- a/libgfortran/generated/all_l4.c
+++ b/libgfortran/generated/all_l4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_4) && defined (HAVE_GFC_LOGICAL_4)
+
+
 extern void all_l4 (gfc_array_l4 *, gfc_array_l4 *, index_type *);
 export_proto(all_l4);
 
@@ -171,3 +174,4 @@ all_l4 (gfc_array_l4 *retarray, gfc_array_l4 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c
index 41552d21e67954e27578787a5cd7949c66d090ab..996ce3560bf98f4952c147ee32c72fcdec9a4b38 100644
--- a/libgfortran/generated/all_l8.c
+++ b/libgfortran/generated/all_l8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_8) && defined (HAVE_GFC_LOGICAL_8)
+
+
 extern void all_l8 (gfc_array_l8 *, gfc_array_l8 *, index_type *);
 export_proto(all_l8);
 
@@ -171,3 +174,4 @@ all_l8 (gfc_array_l8 *retarray, gfc_array_l8 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..cf4798e7962bd019fd03bb9dd0711179df7f8314
--- /dev/null
+++ b/libgfortran/generated/any_l16.c
@@ -0,0 +1,177 @@
+/* Implementation of the ANY intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_LOGICAL_16)
+
+
+extern void any_l16 (gfc_array_l16 *, gfc_array_l16 *, index_type *);
+export_proto(any_l16);
+
+void
+any_l16 (gfc_array_l16 *retarray, gfc_array_l16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_16 *base;
+  GFC_LOGICAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_LOGICAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_16 *src;
+      GFC_LOGICAL_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  /* Return true if any of the elements are set.  */
+  if (*src)
+    {
+      result = 1;
+      break;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c
index 4d3153e424312b089ac6f0f9140715f7cd968fad..994014a2cacf1bfeddbfe7ecd913643267ab156a 100644
--- a/libgfortran/generated/any_l4.c
+++ b/libgfortran/generated/any_l4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_4) && defined (HAVE_GFC_LOGICAL_4)
+
+
 extern void any_l4 (gfc_array_l4 *, gfc_array_l4 *, index_type *);
 export_proto(any_l4);
 
@@ -171,3 +174,4 @@ any_l4 (gfc_array_l4 *retarray, gfc_array_l4 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c
index 29fdcd13d78bb0729719c109696c79755cfb6656..9d52b15c509468ec4eeaee4d5d4099ed0ca8a225 100644
--- a/libgfortran/generated/any_l8.c
+++ b/libgfortran/generated/any_l8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_8) && defined (HAVE_GFC_LOGICAL_8)
+
+
 extern void any_l8 (gfc_array_l8 *, gfc_array_l8 *, index_type *);
 export_proto(any_l8);
 
@@ -171,3 +174,4 @@ any_l8 (gfc_array_l8 *retarray, gfc_array_l8 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/count_16_l16.c b/libgfortran/generated/count_16_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..8cb795faf5ebfebc301615b161cf39ff89eac8ae
--- /dev/null
+++ b/libgfortran/generated/count_16_l16.c
@@ -0,0 +1,173 @@
+/* Implementation of the COUNT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void count_16_l16 (gfc_array_i16 *, gfc_array_l16 *, index_type *);
+export_proto(count_16_l16);
+
+void
+count_16_l16 (gfc_array_i16 *retarray, gfc_array_l16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src)
+    result++;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/count_16_l4.c b/libgfortran/generated/count_16_l4.c
new file mode 100644
index 0000000000000000000000000000000000000000..f4af5ba31525d3d2e3370acb60ba03be954c0b7a
--- /dev/null
+++ b/libgfortran/generated/count_16_l4.c
@@ -0,0 +1,173 @@
+/* Implementation of the COUNT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void count_16_l4 (gfc_array_i16 *, gfc_array_l4 *, index_type *);
+export_proto(count_16_l4);
+
+void
+count_16_l4 (gfc_array_i16 *retarray, gfc_array_l4 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_4 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src)
+    result++;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/count_16_l8.c b/libgfortran/generated/count_16_l8.c
new file mode 100644
index 0000000000000000000000000000000000000000..6134f5b13c685969f90c5fc64cf1e7e5d40f7ca9
--- /dev/null
+++ b/libgfortran/generated/count_16_l8.c
@@ -0,0 +1,173 @@
+/* Implementation of the COUNT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void count_16_l8 (gfc_array_i16 *, gfc_array_l8 *, index_type *);
+export_proto(count_16_l8);
+
+void
+count_16_l8 (gfc_array_i16 *retarray, gfc_array_l8 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_8 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src)
+    result++;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/count_4_l16.c b/libgfortran/generated/count_4_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..cbd1717df2550db3d2738f4ec7a7ab1ca167feb6
--- /dev/null
+++ b/libgfortran/generated/count_4_l16.c
@@ -0,0 +1,173 @@
+/* Implementation of the COUNT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void count_4_l16 (gfc_array_i4 *, gfc_array_l16 *, index_type *);
+export_proto(count_4_l16);
+
+void
+count_4_l16 (gfc_array_i4 *retarray, gfc_array_l16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_16 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src)
+    result++;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/count_4_l4.c b/libgfortran/generated/count_4_l4.c
index c2fdbf0b39439f057df295b89d8d0127541037e6..aa98bfc66c1d93f21428a8194689214cc0ceba88 100644
--- a/libgfortran/generated/count_4_l4.c
+++ b/libgfortran/generated/count_4_l4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void count_4_l4 (gfc_array_i4 *, gfc_array_l4 *, index_type *);
 export_proto(count_4_l4);
 
@@ -167,3 +170,4 @@ count_4_l4 (gfc_array_i4 *retarray, gfc_array_l4 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/count_4_l8.c b/libgfortran/generated/count_4_l8.c
index 473483a12f26e81b5de7e5d8491a7577a6ddad73..fe9eae530cf7f9187956248840e71cac47b8bde2 100644
--- a/libgfortran/generated/count_4_l8.c
+++ b/libgfortran/generated/count_4_l8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_8) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void count_4_l8 (gfc_array_i4 *, gfc_array_l8 *, index_type *);
 export_proto(count_4_l8);
 
@@ -167,3 +170,4 @@ count_4_l8 (gfc_array_i4 *retarray, gfc_array_l8 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/count_8_l16.c b/libgfortran/generated/count_8_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..4df2aeb82147368f4aed3c1a1231b2a7433f2afa
--- /dev/null
+++ b/libgfortran/generated/count_8_l16.c
@@ -0,0 +1,173 @@
+/* Implementation of the COUNT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_LOGICAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void count_8_l16 (gfc_array_i8 *, gfc_array_l16 *, index_type *);
+export_proto(count_8_l16);
+
+void
+count_8_l16 (gfc_array_i8 *retarray, gfc_array_l16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_LOGICAL_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_LOGICAL_16 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src)
+    result++;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/count_8_l4.c b/libgfortran/generated/count_8_l4.c
index 595cb40a5a915e879136a0ce898bc3378f67a285..b32b30e173a16b3d807832ce6b1af4a1eff8cc4e 100644
--- a/libgfortran/generated/count_8_l4.c
+++ b/libgfortran/generated/count_8_l4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_4) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void count_8_l4 (gfc_array_i8 *, gfc_array_l4 *, index_type *);
 export_proto(count_8_l4);
 
@@ -167,3 +170,4 @@ count_8_l4 (gfc_array_i8 *retarray, gfc_array_l4 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/count_8_l8.c b/libgfortran/generated/count_8_l8.c
index 1e9bd619f2a882171102cbff2aae0b3d711ac017..670fc1d1cf1aa2d24d323dc772c896ef5838a6e9 100644
--- a/libgfortran/generated/count_8_l8.c
+++ b/libgfortran/generated/count_8_l8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_LOGICAL_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void count_8_l8 (gfc_array_i8 *, gfc_array_l8 *, index_type *);
 export_proto(count_8_l8);
 
@@ -167,3 +170,4 @@ count_8_l8 (gfc_array_i8 *retarray, gfc_array_l8 *array, index_type *pdim)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/cshift1_16.c b/libgfortran/generated/cshift1_16.c
new file mode 100644
index 0000000000000000000000000000000000000000..bff20d3b4be1dae04a2fbbfb7880280a6b5d33aa
--- /dev/null
+++ b/libgfortran/generated/cshift1_16.c
@@ -0,0 +1,225 @@
+/* Implementation of the CSHIFT intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Feng Wang <wf_cs@yahoo.com>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Ligbfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+static void
+cshift1 (gfc_array_char * ret, const gfc_array_char * array,
+	 const gfc_array_i16 * h, const GFC_INTEGER_16 * pwhich, index_type size)
+{
+  /* r.* indicates the return array.  */
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type roffset;
+  char *rptr;
+  char *dest;
+  /* s.* indicates the source array.  */
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type soffset;
+  const char *sptr;
+  const char *src;
+  /* h.* indicates the  array.  */
+  index_type hstride[GFC_MAX_DIMENSIONS];
+  index_type hstride0;
+  const GFC_INTEGER_16 *hptr;
+
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type dim;
+  index_type len;
+  index_type n;
+  int which;
+  GFC_INTEGER_16 sh;
+
+  if (pwhich)
+    which = *pwhich - 1;
+  else
+    which = 0;
+
+  if (which < 0 || (which + 1) > GFC_DESCRIPTOR_RANK (array))
+    runtime_error ("Argument 'DIM' is out of range in call to 'CSHIFT'");
+
+  if (ret->data == NULL)
+    {
+      int i;
+
+      ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+      ret->offset = 0;
+      ret->dtype = array->dtype;
+      for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
+        {
+          ret->dim[i].lbound = 0;
+          ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+
+          if (i == 0)
+            ret->dim[i].stride = 1;
+          else
+            ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+        }
+    }
+
+  extent[0] = 1;
+  count[0] = 0;
+  n = 0;
+
+  /* Initialized for avoiding compiler warnings.  */
+  roffset = size;
+  soffset = size;
+  len = 0;
+
+  for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+    {
+      if (dim == which)
+        {
+          roffset = ret->dim[dim].stride * size;
+          if (roffset == 0)
+            roffset = size;
+          soffset = array->dim[dim].stride * size;
+          if (soffset == 0)
+            soffset = size;
+          len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+        }
+      else
+        {
+          count[n] = 0;
+          extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+          rstride[n] = ret->dim[dim].stride * size;
+          sstride[n] = array->dim[dim].stride * size;
+
+          hstride[n] = h->dim[n].stride;
+          n++;
+        }
+    }
+  if (sstride[0] == 0)
+    sstride[0] = size;
+  if (rstride[0] == 0)
+    rstride[0] = size;
+  if (hstride[0] == 0)
+    hstride[0] = 1;
+
+  dim = GFC_DESCRIPTOR_RANK (array);
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+  hstride0 = hstride[0];
+  rptr = ret->data;
+  sptr = array->data;
+  hptr = h->data;
+
+  while (rptr)
+    {
+      /* Do the  for this dimension.  */
+      sh = *hptr;
+      sh = (div (sh, len)).rem;
+      if (sh < 0)
+        sh += len;
+
+      src = &sptr[sh * soffset];
+      dest = rptr;
+
+      for (n = 0; n < len; n++)
+        {
+          memcpy (dest, src, size);
+          dest += roffset;
+          if (n == len - sh - 1)
+            src = sptr;
+          else
+            src += soffset;
+        }
+
+      /* Advance to the next section.  */
+      rptr += rstride0;
+      sptr += sstride0;
+      hptr += hstride0;
+      count[0]++;
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * extent[n];
+          sptr -= sstride[n] * extent[n];
+	  hptr -= hstride[n] * extent[n];
+          n++;
+          if (n >= dim - 1)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              rptr += rstride[n];
+              sptr += sstride[n];
+	      hptr += hstride[n];
+            }
+        }
+    }
+}
+
+void cshift1_16 (gfc_array_char *, const gfc_array_char *,
+			   const gfc_array_i16 *, const GFC_INTEGER_16 *);
+export_proto(cshift1_16);
+
+void
+cshift1_16 (gfc_array_char * ret,
+		      const gfc_array_char * array,
+		      const gfc_array_i16 * h, const GFC_INTEGER_16 * pwhich)
+{
+  cshift1 (ret, array, h, pwhich, GFC_DESCRIPTOR_SIZE (array));
+}
+
+void cshift1_16_char (gfc_array_char * ret, GFC_INTEGER_4,
+				  const gfc_array_char * array,
+				  const gfc_array_i16 * h, const GFC_INTEGER_16 * pwhich,
+				  GFC_INTEGER_4);
+export_proto(cshift1_16_char);
+
+void
+cshift1_16_char (gfc_array_char * ret,
+			     GFC_INTEGER_4 ret_length __attribute__((unused)),
+			     const gfc_array_char * array,
+			     const gfc_array_i16 * h, const GFC_INTEGER_16 * pwhich,
+			     GFC_INTEGER_4 array_length)
+{
+  cshift1 (ret, array, h, pwhich, array_length);
+}
+
+#endif
diff --git a/libgfortran/generated/cshift1_4.c b/libgfortran/generated/cshift1_4.c
index 1fe0e68139f2efc1ac1b035f355ba6319bc6f712..9f9bea07c1ecc08ff2ebbeff4b294dc8633982be 100644
--- a/libgfortran/generated/cshift1_4.c
+++ b/libgfortran/generated/cshift1_4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 static void
 cshift1 (gfc_array_char * ret, const gfc_array_char * array,
 	 const gfc_array_i4 * h, const GFC_INTEGER_4 * pwhich, index_type size)
@@ -219,3 +221,5 @@ cshift1_4_char (gfc_array_char * ret,
 {
   cshift1 (ret, array, h, pwhich, array_length);
 }
+
+#endif
diff --git a/libgfortran/generated/cshift1_8.c b/libgfortran/generated/cshift1_8.c
index 8b0cb03f1a8659b82764cf937a05fc3962f22e7d..3a7c509b00c2f6cf911c55f0711d73c4e7b8fe68 100644
--- a/libgfortran/generated/cshift1_8.c
+++ b/libgfortran/generated/cshift1_8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 static void
 cshift1 (gfc_array_char * ret, const gfc_array_char * array,
 	 const gfc_array_i8 * h, const GFC_INTEGER_8 * pwhich, index_type size)
@@ -219,3 +221,5 @@ cshift1_8_char (gfc_array_char * ret,
 {
   cshift1 (ret, array, h, pwhich, array_length);
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_c10.c b/libgfortran/generated/dotprod_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..3fa5955e200bf25f318439641dadad6fef5406dd
--- /dev/null
+++ b/libgfortran/generated/dotprod_c10.c
@@ -0,0 +1,82 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+   and Feng Wang <fengwang@nudt.edu.cn>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
+
+extern GFC_COMPLEX_10 dot_product_c10 (gfc_array_c10 * a, gfc_array_c10 * b);
+export_proto(dot_product_c10);
+
+/* Both parameters will already have been converted to the result type.  */
+GFC_COMPLEX_10
+dot_product_c10 (gfc_array_c10 * a, gfc_array_c10 * b)
+{
+  GFC_COMPLEX_10 *pa;
+  GFC_COMPLEX_10 *pb;
+  GFC_COMPLEX_10 res;
+  GFC_COMPLEX_10 conjga;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+  res = 0;
+  pa = a->data;
+  pb = b->data;
+
+  while (count--)
+    {
+      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));
+      res += conjga * *pb;
+      pa += astride;
+      pb += bstride;
+    }
+
+  return res;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_c16.c b/libgfortran/generated/dotprod_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..a526b533d4401e1f89dcc191f191654e2d3eab89
--- /dev/null
+++ b/libgfortran/generated/dotprod_c16.c
@@ -0,0 +1,82 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+   and Feng Wang <fengwang@nudt.edu.cn>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
+
+extern GFC_COMPLEX_16 dot_product_c16 (gfc_array_c16 * a, gfc_array_c16 * b);
+export_proto(dot_product_c16);
+
+/* Both parameters will already have been converted to the result type.  */
+GFC_COMPLEX_16
+dot_product_c16 (gfc_array_c16 * a, gfc_array_c16 * b)
+{
+  GFC_COMPLEX_16 *pa;
+  GFC_COMPLEX_16 *pb;
+  GFC_COMPLEX_16 res;
+  GFC_COMPLEX_16 conjga;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+  res = 0;
+  pa = a->data;
+  pb = b->data;
+
+  while (count--)
+    {
+      COMPLEX_ASSIGN(conjga, REALPART (*pa), -IMAGPART (*pa));
+      res += conjga * *pb;
+      pa += astride;
+      pb += bstride;
+    }
+
+  return res;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_c4.c b/libgfortran/generated/dotprod_c4.c
index e047a90c2aae8061f0bbe26348aea57ee8ef6e89..ea27dd8457e8cd048c22f12d82a635befd343103 100644
--- a/libgfortran/generated/dotprod_c4.c
+++ b/libgfortran/generated/dotprod_c4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_COMPLEX_4 dot_product_c4 (gfc_array_c4 * a, gfc_array_c4 * b);
@@ -76,3 +78,5 @@ dot_product_c4 (gfc_array_c4 * a, gfc_array_c4 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_c8.c b/libgfortran/generated/dotprod_c8.c
index 747d3a1b24586fb2d5f42285d16fd9735d40552e..aec5fb5a3bce8da36b01dfc15b7307d9d0e41a4a 100644
--- a/libgfortran/generated/dotprod_c8.c
+++ b/libgfortran/generated/dotprod_c8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_COMPLEX_8 dot_product_c8 (gfc_array_c8 * a, gfc_array_c8 * b);
@@ -76,3 +78,5 @@ dot_product_c8 (gfc_array_c8 * a, gfc_array_c8 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_i16.c b/libgfortran/generated/dotprod_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..1c3e5825d0e6506a3f83a3078a76746b850cfc5f
--- /dev/null
+++ b/libgfortran/generated/dotprod_i16.c
@@ -0,0 +1,79 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
+
+extern GFC_INTEGER_16 dot_product_i16 (gfc_array_i16 * a, gfc_array_i16 * b);
+export_proto(dot_product_i16);
+
+/* Both parameters will already have been converted to the result type.  */
+GFC_INTEGER_16
+dot_product_i16 (gfc_array_i16 * a, gfc_array_i16 * b)
+{
+  GFC_INTEGER_16 *pa;
+  GFC_INTEGER_16 *pb;
+  GFC_INTEGER_16 res;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+  res = 0;
+  pa = a->data;
+  pb = b->data;
+
+  while (count--)
+    {
+      res += *pa * *pb;
+      pa += astride;
+      pb += bstride;
+    }
+
+  return res;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_i4.c b/libgfortran/generated/dotprod_i4.c
index 65245ab4de7ed04094540f9b23abe73bd46685d9..aaf8b8d4efa1f78cd7fc40330954d586f52abc40 100644
--- a/libgfortran/generated/dotprod_i4.c
+++ b/libgfortran/generated/dotprod_i4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_INTEGER_4 dot_product_i4 (gfc_array_i4 * a, gfc_array_i4 * b);
@@ -73,3 +75,5 @@ dot_product_i4 (gfc_array_i4 * a, gfc_array_i4 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_i8.c b/libgfortran/generated/dotprod_i8.c
index 3c857e2c39f562812b8ff73b59718f0657b6380d..44af1f15954acc7bce39a7c83485be645d43a020 100644
--- a/libgfortran/generated/dotprod_i8.c
+++ b/libgfortran/generated/dotprod_i8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_INTEGER_8 dot_product_i8 (gfc_array_i8 * a, gfc_array_i8 * b);
@@ -73,3 +75,5 @@ dot_product_i8 (gfc_array_i8 * a, gfc_array_i8 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_l16.c b/libgfortran/generated/dotprod_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..977eb4a3915659ef1b0bf0f936719a7269a24995
--- /dev/null
+++ b/libgfortran/generated/dotprod_l16.c
@@ -0,0 +1,89 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_LOGICAL_16)
+
+extern GFC_LOGICAL_16 dot_product_l16 (gfc_array_l4 *, gfc_array_l4 *);
+export_proto(dot_product_l16);
+
+GFC_LOGICAL_16
+dot_product_l16 (gfc_array_l4 * a, gfc_array_l4 * b)
+{
+  GFC_LOGICAL_4 *pa;
+  GFC_LOGICAL_4 *pb;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+
+  pa = a->data;
+  if (GFC_DESCRIPTOR_SIZE (a) != 4)
+    {
+      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
+      pa = GFOR_POINTER_L8_TO_L4 (pa);
+      astride <<= 1;
+    }
+  pb = b->data;
+  if (GFC_DESCRIPTOR_SIZE (b) != 4)
+    {
+      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
+      pb = GFOR_POINTER_L8_TO_L4 (pb);
+      bstride <<= 1;
+    }
+
+  while (count--)
+    {
+      if (*pa && *pb)
+        return 1;
+
+      pa += astride;
+      pb += bstride;
+    }
+
+  return 0;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_l4.c b/libgfortran/generated/dotprod_l4.c
index a8fdf951072f427b424aa4450d3610e4a7df0c28..50db3981285395e4ed3296da92b0ce3833bf6db3 100644
--- a/libgfortran/generated/dotprod_l4.c
+++ b/libgfortran/generated/dotprod_l4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_LOGICAL_4)
+
 extern GFC_LOGICAL_4 dot_product_l4 (gfc_array_l4 *, gfc_array_l4 *);
 export_proto(dot_product_l4);
 
@@ -83,3 +85,5 @@ dot_product_l4 (gfc_array_l4 * a, gfc_array_l4 * b)
 
   return 0;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_l8.c b/libgfortran/generated/dotprod_l8.c
index cbb2961199acedef6aa4337d97ca426aacb2e90e..f857d08ecd56890cae87d256586cfc9cc70a2ecd 100644
--- a/libgfortran/generated/dotprod_l8.c
+++ b/libgfortran/generated/dotprod_l8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_LOGICAL_8)
+
 extern GFC_LOGICAL_8 dot_product_l8 (gfc_array_l4 *, gfc_array_l4 *);
 export_proto(dot_product_l8);
 
@@ -83,3 +85,5 @@ dot_product_l8 (gfc_array_l4 * a, gfc_array_l4 * b)
 
   return 0;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_r10.c b/libgfortran/generated/dotprod_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..055c28837c4ad489fdeec4c47b2c076b18d73eca
--- /dev/null
+++ b/libgfortran/generated/dotprod_r10.c
@@ -0,0 +1,79 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_REAL_10)
+
+typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
+
+extern GFC_REAL_10 dot_product_r10 (gfc_array_r10 * a, gfc_array_r10 * b);
+export_proto(dot_product_r10);
+
+/* Both parameters will already have been converted to the result type.  */
+GFC_REAL_10
+dot_product_r10 (gfc_array_r10 * a, gfc_array_r10 * b)
+{
+  GFC_REAL_10 *pa;
+  GFC_REAL_10 *pb;
+  GFC_REAL_10 res;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+  res = 0;
+  pa = a->data;
+  pb = b->data;
+
+  while (count--)
+    {
+      res += *pa * *pb;
+      pa += astride;
+      pb += bstride;
+    }
+
+  return res;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_r16.c b/libgfortran/generated/dotprod_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..e14eaac4208e08a83c3e40d00a2635c40ec21c5c
--- /dev/null
+++ b/libgfortran/generated/dotprod_r16.c
@@ -0,0 +1,79 @@
+/* Implementation of the DOT_PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_REAL_16)
+
+typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
+
+extern GFC_REAL_16 dot_product_r16 (gfc_array_r16 * a, gfc_array_r16 * b);
+export_proto(dot_product_r16);
+
+/* Both parameters will already have been converted to the result type.  */
+GFC_REAL_16
+dot_product_r16 (gfc_array_r16 * a, gfc_array_r16 * b)
+{
+  GFC_REAL_16 *pa;
+  GFC_REAL_16 *pb;
+  GFC_REAL_16 res;
+  index_type count;
+  index_type astride;
+  index_type bstride;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 1
+          && GFC_DESCRIPTOR_RANK (b) == 1);
+
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+  astride = a->dim[0].stride;
+  bstride = b->dim[0].stride;
+  count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+  res = 0;
+  pa = a->data;
+  pb = b->data;
+
+  while (count--)
+    {
+      res += *pa * *pb;
+      pa += astride;
+      pb += bstride;
+    }
+
+  return res;
+}
+
+#endif
diff --git a/libgfortran/generated/dotprod_r4.c b/libgfortran/generated/dotprod_r4.c
index 28f8fcdb6b51c4534cd8a2923aad3c15d93e3018..bae99ab3f3664de4c535358dc7ea28c378113233 100644
--- a/libgfortran/generated/dotprod_r4.c
+++ b/libgfortran/generated/dotprod_r4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_REAL_4)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_REAL_4 dot_product_r4 (gfc_array_r4 * a, gfc_array_r4 * b);
@@ -73,3 +75,5 @@ dot_product_r4 (gfc_array_r4 * a, gfc_array_r4 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/dotprod_r8.c b/libgfortran/generated/dotprod_r8.c
index b0e704e306d9bf841db0058ffcc79ef961231093..84a6aaa011093ec6d470afefb3a5510d64bc52f4 100644
--- a/libgfortran/generated/dotprod_r8.c
+++ b/libgfortran/generated/dotprod_r8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_REAL_8)
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern GFC_REAL_8 dot_product_r8 (gfc_array_r8 * a, gfc_array_r8 * b);
@@ -73,3 +75,5 @@ dot_product_r8 (gfc_array_r8 * a, gfc_array_r8 * b)
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/generated/eoshift1_16.c b/libgfortran/generated/eoshift1_16.c
new file mode 100644
index 0000000000000000000000000000000000000000..c548fef3ae47e53a441b776222d44763e03f5d3e
--- /dev/null
+++ b/libgfortran/generated/eoshift1_16.c
@@ -0,0 +1,251 @@
+/* Implementation of the EOSHIFT intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+static void
+eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i16 *h,
+	  const char *pbound, const GFC_INTEGER_16 *pwhich, index_type size,
+	  char filler)
+{
+  /* r.* indicates the return array.  */
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type roffset;
+  char *rptr;
+  char *dest;
+  /* s.* indicates the source array.  */
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type soffset;
+  const char *sptr;
+  const char *src;
+  /* h.* indicates the shift array.  */
+  index_type hstride[GFC_MAX_DIMENSIONS];
+  index_type hstride0;
+  const GFC_INTEGER_16 *hptr;
+
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type dim;
+  index_type len;
+  index_type n;
+  int which;
+  GFC_INTEGER_16 sh;
+  GFC_INTEGER_16 delta;
+
+  /* The compiler cannot figure out that these are set, initialize
+     them to avoid warnings.  */
+  len = 0;
+  soffset = 0;
+  roffset = 0;
+
+  if (pwhich)
+    which = *pwhich - 1;
+  else
+    which = 0;
+
+  extent[0] = 1;
+  count[0] = 0;
+
+  if (ret->data == NULL)
+    {
+      int i;
+
+      ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+      ret->offset = 0;
+      ret->dtype = array->dtype;
+      for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
+        {
+          ret->dim[i].lbound = 0;
+          ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+
+          if (i == 0)
+            ret->dim[i].stride = 1;
+          else
+            ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+        }
+    }
+
+  n = 0;
+  for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+    {
+      if (dim == which)
+        {
+          roffset = ret->dim[dim].stride * size;
+          if (roffset == 0)
+            roffset = size;
+          soffset = array->dim[dim].stride * size;
+          if (soffset == 0)
+            soffset = size;
+          len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+        }
+      else
+        {
+          count[n] = 0;
+          extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+          rstride[n] = ret->dim[dim].stride * size;
+          sstride[n] = array->dim[dim].stride * size;
+
+          hstride[n] = h->dim[n].stride;
+          n++;
+        }
+    }
+  if (sstride[0] == 0)
+    sstride[0] = size;
+  if (rstride[0] == 0)
+    rstride[0] = size;
+  if (hstride[0] == 0)
+    hstride[0] = 1;
+
+  dim = GFC_DESCRIPTOR_RANK (array);
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+  hstride0 = hstride[0];
+  rptr = ret->data;
+  sptr = array->data;
+  hptr = h->data;
+
+  while (rptr)
+    {
+      /* Do the shift for this dimension.  */
+      sh = *hptr;
+      if (( sh >= 0 ? sh : -sh ) > len)
+	{
+	  delta = len;
+	  sh = len;
+	}
+      else
+	delta = (sh >= 0) ? sh: -sh;
+
+      if (sh > 0)
+        {
+          src = &sptr[delta * soffset];
+          dest = rptr;
+        }
+      else
+        {
+          src = sptr;
+          dest = &rptr[delta * roffset];
+        }
+      for (n = 0; n < len - delta; n++)
+        {
+          memcpy (dest, src, size);
+          dest += roffset;
+          src += soffset;
+        }
+      if (sh < 0)
+        dest = rptr;
+      n = delta;
+
+      if (pbound)
+	while (n--)
+	  {
+	    memcpy (dest, pbound, size);
+	    dest += roffset;
+	  }
+      else
+	while (n--)
+	  {
+	    memset (dest, filler, size);
+	    dest += roffset;
+	  }
+
+      /* Advance to the next section.  */
+      rptr += rstride0;
+      sptr += sstride0;
+      hptr += hstride0;
+      count[0]++;
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * extent[n];
+          sptr -= sstride[n] * extent[n];
+	  hptr -= hstride[n] * extent[n];
+          n++;
+          if (n >= dim - 1)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              rptr += rstride[n];
+              sptr += sstride[n];
+	      hptr += hstride[n];
+            }
+        }
+    }
+}
+
+void eoshift1_16 (gfc_array_char *, const gfc_array_char *,
+			    const gfc_array_i16 *, const char *, const GFC_INTEGER_16 *);
+export_proto(eoshift1_16);
+
+void
+eoshift1_16 (gfc_array_char *ret, const gfc_array_char *array,
+		       const gfc_array_i16 *h, const char *pbound,
+		       const GFC_INTEGER_16 *pwhich)
+{
+  eoshift1 (ret, array, h, pbound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0);
+}
+
+void eoshift1_16_char (gfc_array_char *, GFC_INTEGER_4,
+				   const gfc_array_char *, const gfc_array_i16 *,
+				   const char *, const GFC_INTEGER_16 *,
+				   GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(eoshift1_16_char);
+
+void
+eoshift1_16_char (gfc_array_char *ret,
+			      GFC_INTEGER_4 ret_length __attribute__((unused)),
+			      const gfc_array_char *array, const gfc_array_i16 *h,
+			      const char *pbound, const GFC_INTEGER_16 *pwhich,
+			      GFC_INTEGER_4 array_length,
+			      GFC_INTEGER_4 bound_length
+				__attribute__((unused)))
+{
+  eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
+}
+
+#endif
diff --git a/libgfortran/generated/eoshift1_4.c b/libgfortran/generated/eoshift1_4.c
index e08042ac37def7ebea58c42dd33cb0a0e95eab8d..8045679ce921fb12b261c823f0e0ef408a1d393b 100644
--- a/libgfortran/generated/eoshift1_4.c
+++ b/libgfortran/generated/eoshift1_4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 static void
 eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i4 *h,
 	  const char *pbound, const GFC_INTEGER_4 *pwhich, index_type size,
@@ -245,3 +247,5 @@ eoshift1_4_char (gfc_array_char *ret,
 {
   eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/generated/eoshift1_8.c b/libgfortran/generated/eoshift1_8.c
index f375a825113b26b01ee50d606938178d9c2c366b..bcc53ab705461b4599f562319ba55bc17e71aaab 100644
--- a/libgfortran/generated/eoshift1_8.c
+++ b/libgfortran/generated/eoshift1_8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 static void
 eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i8 *h,
 	  const char *pbound, const GFC_INTEGER_8 *pwhich, index_type size,
@@ -245,3 +247,5 @@ eoshift1_8_char (gfc_array_char *ret,
 {
   eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/generated/eoshift3_16.c b/libgfortran/generated/eoshift3_16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d03c1c7f1c9ee00c25dff6b0e7d895c9b23d2bc0
--- /dev/null
+++ b/libgfortran/generated/eoshift3_16.c
@@ -0,0 +1,273 @@
+/* Implementation of the EOSHIFT intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+static void
+eoshift3 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i16 *h,
+	  const gfc_array_char *bound, const GFC_INTEGER_16 *pwhich,
+	  index_type size, char filler)
+{
+  /* r.* indicates the return array.  */
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type roffset;
+  char *rptr;
+  char *dest;
+  /* s.* indicates the source array.  */
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type soffset;
+  const char *sptr;
+  const char *src;
+  /* h.* indicates the shift array.  */
+  index_type hstride[GFC_MAX_DIMENSIONS];
+  index_type hstride0;
+  const GFC_INTEGER_16 *hptr;
+  /* b.* indicates the bound array.  */
+  index_type bstride[GFC_MAX_DIMENSIONS];
+  index_type bstride0;
+  const char *bptr;
+
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type dim;
+  index_type len;
+  index_type n;
+  int which;
+  GFC_INTEGER_16 sh;
+  GFC_INTEGER_16 delta;
+
+  /* The compiler cannot figure out that these are set, initialize
+     them to avoid warnings.  */
+  len = 0;
+  soffset = 0;
+  roffset = 0;
+
+  if (pwhich)
+    which = *pwhich - 1;
+  else
+    which = 0;
+
+  if (ret->data == NULL)
+    {
+      int i;
+
+      ret->data = internal_malloc_size (size * size0 ((array_t *)array));
+      ret->offset = 0;
+      ret->dtype = array->dtype;
+      for (i = 0; i < GFC_DESCRIPTOR_RANK (array); i++)
+        {
+          ret->dim[i].lbound = 0;
+          ret->dim[i].ubound = array->dim[i].ubound - array->dim[i].lbound;
+
+          if (i == 0)
+            ret->dim[i].stride = 1;
+          else
+            ret->dim[i].stride = (ret->dim[i-1].ubound + 1) * ret->dim[i-1].stride;
+        }
+    }
+
+
+  extent[0] = 1;
+  count[0] = 0;
+  n = 0;
+  for (dim = 0; dim < GFC_DESCRIPTOR_RANK (array); dim++)
+    {
+      if (dim == which)
+        {
+          roffset = ret->dim[dim].stride * size;
+          if (roffset == 0)
+            roffset = size;
+          soffset = array->dim[dim].stride * size;
+          if (soffset == 0)
+            soffset = size;
+          len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+        }
+      else
+        {
+          count[n] = 0;
+          extent[n] = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+          rstride[n] = ret->dim[dim].stride * size;
+          sstride[n] = array->dim[dim].stride * size;
+
+          hstride[n] = h->dim[n].stride;
+          if (bound)
+            bstride[n] = bound->dim[n].stride * size;
+          else
+            bstride[n] = 0;
+          n++;
+        }
+    }
+  if (sstride[0] == 0)
+    sstride[0] = size;
+  if (rstride[0] == 0)
+    rstride[0] = size;
+  if (hstride[0] == 0)
+    hstride[0] = 1;
+  if (bound && bstride[0] == 0)
+    bstride[0] = size;
+
+  dim = GFC_DESCRIPTOR_RANK (array);
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+  hstride0 = hstride[0];
+  bstride0 = bstride[0];
+  rptr = ret->data;
+  sptr = array->data;
+  hptr = h->data;
+  if (bound)
+    bptr = bound->data;
+  else
+    bptr = NULL;
+
+  while (rptr)
+    {
+      /* Do the shift for this dimension.  */
+      sh = *hptr;
+      if (( sh >= 0 ? sh : -sh ) > len)
+	{
+	  delta = len;
+	  sh = len;
+	}
+      else
+	delta = (sh >= 0) ? sh: -sh;
+
+      if (sh > 0)
+        {
+          src = &sptr[delta * soffset];
+          dest = rptr;
+        }
+      else
+        {
+          src = sptr;
+          dest = &rptr[delta * roffset];
+        }
+      for (n = 0; n < len - delta; n++)
+        {
+          memcpy (dest, src, size);
+          dest += roffset;
+          src += soffset;
+        }
+      if (sh < 0)
+        dest = rptr;
+      n = delta;
+
+      if (bptr)
+	while (n--)
+	  {
+	    memcpy (dest, bptr, size);
+	    dest += roffset;
+	  }
+      else
+	while (n--)
+	  {
+	    memset (dest, filler, size);
+	    dest += roffset;
+	  }
+
+      /* Advance to the next section.  */
+      rptr += rstride0;
+      sptr += sstride0;
+      hptr += hstride0;
+      bptr += bstride0;
+      count[0]++;
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * extent[n];
+          sptr -= sstride[n] * extent[n];
+	  hptr -= hstride[n] * extent[n];
+          bptr -= bstride[n] * extent[n];
+          n++;
+          if (n >= dim - 1)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              rptr += rstride[n];
+              sptr += sstride[n];
+	      hptr += hstride[n];
+              bptr += bstride[n];
+            }
+        }
+    }
+}
+
+extern void eoshift3_16 (gfc_array_char *, const gfc_array_char *,
+				   const gfc_array_i16 *, const gfc_array_char *,
+				   const GFC_INTEGER_16 *);
+export_proto(eoshift3_16);
+
+void
+eoshift3_16 (gfc_array_char *ret, const gfc_array_char *array,
+		       const gfc_array_i16 *h, const gfc_array_char *bound,
+		       const GFC_INTEGER_16 *pwhich)
+{
+  eoshift3 (ret, array, h, bound, pwhich, GFC_DESCRIPTOR_SIZE (array), 0);
+}
+
+extern void eoshift3_16_char (gfc_array_char *, GFC_INTEGER_4,
+					  const gfc_array_char *,
+					  const gfc_array_i16 *,
+					  const gfc_array_char *,
+					  const GFC_INTEGER_16 *, GFC_INTEGER_4,
+					  GFC_INTEGER_4);
+export_proto(eoshift3_16_char);
+
+void
+eoshift3_16_char (gfc_array_char *ret,
+			      GFC_INTEGER_4 ret_length __attribute__((unused)),
+			      const gfc_array_char *array, const gfc_array_i16 *h,
+			      const gfc_array_char *bound,
+			      const GFC_INTEGER_16 *pwhich,
+			      GFC_INTEGER_4 array_length,
+			      GFC_INTEGER_4 bound_length
+				__attribute__((unused)))
+{
+  eoshift3 (ret, array, h, bound, pwhich, array_length, ' ');
+}
+
+#endif
diff --git a/libgfortran/generated/eoshift3_4.c b/libgfortran/generated/eoshift3_4.c
index 09e0207cef9da643f5ff0bb857cd98fe2380a8ed..2b84ece377cc0f0e47291c43321398214d37b2c1 100644
--- a/libgfortran/generated/eoshift3_4.c
+++ b/libgfortran/generated/eoshift3_4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 static void
 eoshift3 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i4 *h,
 	  const gfc_array_char *bound, const GFC_INTEGER_4 *pwhich,
@@ -267,3 +269,5 @@ eoshift3_4_char (gfc_array_char *ret,
 {
   eoshift3 (ret, array, h, bound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/generated/eoshift3_8.c b/libgfortran/generated/eoshift3_8.c
index c652d98d01865d05a46a17dd5837c3aaa18b2cca..ba2ef1faa339337b5c536bff68f9b8901a42a61a 100644
--- a/libgfortran/generated/eoshift3_8.c
+++ b/libgfortran/generated/eoshift3_8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 static void
 eoshift3 (gfc_array_char *ret, const gfc_array_char *array, const gfc_array_i8 *h,
 	  const gfc_array_char *bound, const GFC_INTEGER_8 *pwhich,
@@ -267,3 +269,5 @@ eoshift3_8_char (gfc_array_char *ret,
 {
   eoshift3 (ret, array, h, bound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/generated/exponent_r10.c b/libgfortran/generated/exponent_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..da2d33b12620501d5668b048893dabe88d500dee
--- /dev/null
+++ b/libgfortran/generated/exponent_r10.c
@@ -0,0 +1,49 @@
+/* Implementation of the EXPONENT intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
+
+extern GFC_INTEGER_4 exponent_r10 (GFC_REAL_10 s);
+export_proto(exponent_r10);
+
+GFC_INTEGER_4
+exponent_r10 (GFC_REAL_10 s)
+{
+  int ret;
+  frexpl (s, &ret);
+  return ret;
+}
+
+#endif
diff --git a/libgfortran/generated/exponent_r16.c b/libgfortran/generated/exponent_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..de1769e3144391e43a6fa735661bd0bf4687bc44
--- /dev/null
+++ b/libgfortran/generated/exponent_r16.c
@@ -0,0 +1,49 @@
+/* Implementation of the EXPONENT intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
+
+extern GFC_INTEGER_4 exponent_r16 (GFC_REAL_16 s);
+export_proto(exponent_r16);
+
+GFC_INTEGER_4
+exponent_r16 (GFC_REAL_16 s)
+{
+  int ret;
+  frexpl (s, &ret);
+  return ret;
+}
+
+#endif
diff --git a/libgfortran/generated/exponent_r4.c b/libgfortran/generated/exponent_r4.c
index 3d0ffb370d925f8ed518bf85bedc3949ea20e601..9a9c7ebfcfeb5f18caf351740b0feae269952836 100644
--- a/libgfortran/generated/exponent_r4.c
+++ b/libgfortran/generated/exponent_r4.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
+
 extern GFC_INTEGER_4 exponent_r4 (GFC_REAL_4 s);
 export_proto(exponent_r4);
 
@@ -41,3 +45,5 @@ exponent_r4 (GFC_REAL_4 s)
   frexpf (s, &ret);
   return ret;
 }
+
+#endif
diff --git a/libgfortran/generated/exponent_r8.c b/libgfortran/generated/exponent_r8.c
index 9fc8bff27b1dcf5cf9055f367b819bb8985135b5..d41bf9a44c023813a2cd8b16d963aa8f1bb68a9f 100644
--- a/libgfortran/generated/exponent_r8.c
+++ b/libgfortran/generated/exponent_r8.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
+
 extern GFC_INTEGER_4 exponent_r8 (GFC_REAL_8 s);
 export_proto(exponent_r8);
 
@@ -41,3 +45,5 @@ exponent_r8 (GFC_REAL_8 s)
   frexp (s, &ret);
   return ret;
 }
+
+#endif
diff --git a/libgfortran/generated/fraction_r10.c b/libgfortran/generated/fraction_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..aac9811af5e49b357f48f0774a18741518fa98bd
--- /dev/null
+++ b/libgfortran/generated/fraction_r10.c
@@ -0,0 +1,48 @@
+/* Implementation of the FRACTION intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
+
+extern GFC_REAL_10 fraction_r10 (GFC_REAL_10 s);
+export_proto(fraction_r10);
+
+GFC_REAL_10
+fraction_r10 (GFC_REAL_10 s)
+{
+  int dummy_exp;
+  return frexpl (s, &dummy_exp);
+}
+
+#endif
diff --git a/libgfortran/generated/fraction_r16.c b/libgfortran/generated/fraction_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..399682a8344a0c93167063f2d438997798ecedcf
--- /dev/null
+++ b/libgfortran/generated/fraction_r16.c
@@ -0,0 +1,48 @@
+/* Implementation of the FRACTION intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
+
+extern GFC_REAL_16 fraction_r16 (GFC_REAL_16 s);
+export_proto(fraction_r16);
+
+GFC_REAL_16
+fraction_r16 (GFC_REAL_16 s)
+{
+  int dummy_exp;
+  return frexpl (s, &dummy_exp);
+}
+
+#endif
diff --git a/libgfortran/generated/fraction_r4.c b/libgfortran/generated/fraction_r4.c
index d7ca25f0d35b47b909d7bfa4041475764f051e28..252335041d158517389668880295fc9b97a4ea1e 100644
--- a/libgfortran/generated/fraction_r4.c
+++ b/libgfortran/generated/fraction_r4.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
+
 extern GFC_REAL_4 fraction_r4 (GFC_REAL_4 s);
 export_proto(fraction_r4);
 
@@ -40,3 +44,5 @@ fraction_r4 (GFC_REAL_4 s)
   int dummy_exp;
   return frexpf (s, &dummy_exp);
 }
+
+#endif
diff --git a/libgfortran/generated/fraction_r8.c b/libgfortran/generated/fraction_r8.c
index d9b6c44ac7088ed557cd893e604d8e5f43fe9858..492e4540a81472493fd26c04af0ef5e038332201 100644
--- a/libgfortran/generated/fraction_r8.c
+++ b/libgfortran/generated/fraction_r8.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
+
 extern GFC_REAL_8 fraction_r8 (GFC_REAL_8 s);
 export_proto(fraction_r8);
 
@@ -40,3 +44,5 @@ fraction_r8 (GFC_REAL_8 s)
   int dummy_exp;
   return frexp (s, &dummy_exp);
 }
+
+#endif
diff --git a/libgfortran/generated/in_pack_c10.c b/libgfortran/generated/in_pack_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..5a91d9765bc07b017f99eb0a9331ba546b17cec2
--- /dev/null
+++ b/libgfortran/generated/in_pack_c10.c
@@ -0,0 +1,126 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+/* Allocates a block of memory with internal_malloc if the array needs
+   repacking.  */
+
+GFC_COMPLEX_10 *
+internal_pack_c10 (gfc_array_c10 * source)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type ssize;
+  const GFC_COMPLEX_10 *src;
+  GFC_COMPLEX_10 *dest;
+  GFC_COMPLEX_10 *destptr;
+  int n;
+  int packed;
+
+  if (source->dim[0].stride == 0)
+    {
+      source->dim[0].stride = 1;
+      return source->data;
+    }
+
+  dim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  packed = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = source->dim[n].stride;
+      extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (extent[n] <= 0)
+        {
+          /* Do nothing.  */
+          packed = 1;
+          break;
+        }
+
+      if (ssize != stride[n])
+        packed = 0;
+
+      ssize *= extent[n];
+    }
+
+  if (packed)
+    return source->data;
+
+  /* Allocate storage for the destination.  */
+  destptr = (GFC_COMPLEX_10 *)internal_malloc_size (ssize * sizeof (GFC_COMPLEX_10));
+  dest = destptr;
+  src = source->data;
+  stride0 = stride[0];
+
+
+  while (src)
+    {
+      /* Copy the data.  */
+      *(dest++) = *src;
+      /* Advance to the next element.  */
+      src += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              src = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              src += stride[n];
+            }
+        }
+    }
+  return destptr;
+}
+
+#endif
diff --git a/libgfortran/generated/in_pack_c16.c b/libgfortran/generated/in_pack_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d52249b648f5b611898d28f9e63f313dee1364e6
--- /dev/null
+++ b/libgfortran/generated/in_pack_c16.c
@@ -0,0 +1,126 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+/* Allocates a block of memory with internal_malloc if the array needs
+   repacking.  */
+
+GFC_COMPLEX_16 *
+internal_pack_c16 (gfc_array_c16 * source)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type ssize;
+  const GFC_COMPLEX_16 *src;
+  GFC_COMPLEX_16 *dest;
+  GFC_COMPLEX_16 *destptr;
+  int n;
+  int packed;
+
+  if (source->dim[0].stride == 0)
+    {
+      source->dim[0].stride = 1;
+      return source->data;
+    }
+
+  dim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  packed = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = source->dim[n].stride;
+      extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (extent[n] <= 0)
+        {
+          /* Do nothing.  */
+          packed = 1;
+          break;
+        }
+
+      if (ssize != stride[n])
+        packed = 0;
+
+      ssize *= extent[n];
+    }
+
+  if (packed)
+    return source->data;
+
+  /* Allocate storage for the destination.  */
+  destptr = (GFC_COMPLEX_16 *)internal_malloc_size (ssize * sizeof (GFC_COMPLEX_16));
+  dest = destptr;
+  src = source->data;
+  stride0 = stride[0];
+
+
+  while (src)
+    {
+      /* Copy the data.  */
+      *(dest++) = *src;
+      /* Advance to the next element.  */
+      src += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              src = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              src += stride[n];
+            }
+        }
+    }
+  return destptr;
+}
+
+#endif
diff --git a/libgfortran/generated/in_pack_c4.c b/libgfortran/generated/in_pack_c4.c
index c1446ad02b332f8ce2116179a0e90a1929faa7a1..a4fd70909d598711c90c32cd738426bdedf6713c 100644
--- a/libgfortran/generated/in_pack_c4.c
+++ b/libgfortran/generated/in_pack_c4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 /* Allocates a block of memory with internal_malloc if the array needs
    repacking.  */
 
@@ -121,3 +123,4 @@ internal_pack_c4 (gfc_array_c4 * source)
   return destptr;
 }
 
+#endif
diff --git a/libgfortran/generated/in_pack_c8.c b/libgfortran/generated/in_pack_c8.c
index 666585960c38149595aa155649cb7b5447b9562c..a3c6214026ef085f6285a72cb24e067869172fd0 100644
--- a/libgfortran/generated/in_pack_c8.c
+++ b/libgfortran/generated/in_pack_c8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 /* Allocates a block of memory with internal_malloc if the array needs
    repacking.  */
 
@@ -121,3 +123,4 @@ internal_pack_c8 (gfc_array_c8 * source)
   return destptr;
 }
 
+#endif
diff --git a/libgfortran/generated/in_pack_i16.c b/libgfortran/generated/in_pack_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..b8c6c29d6f7cea86ebcdbe9ded091e694beec1f4
--- /dev/null
+++ b/libgfortran/generated/in_pack_i16.c
@@ -0,0 +1,126 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+/* Allocates a block of memory with internal_malloc if the array needs
+   repacking.  */
+
+GFC_INTEGER_16 *
+internal_pack_16 (gfc_array_i16 * source)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type ssize;
+  const GFC_INTEGER_16 *src;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *destptr;
+  int n;
+  int packed;
+
+  if (source->dim[0].stride == 0)
+    {
+      source->dim[0].stride = 1;
+      return source->data;
+    }
+
+  dim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  packed = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = source->dim[n].stride;
+      extent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (extent[n] <= 0)
+        {
+          /* Do nothing.  */
+          packed = 1;
+          break;
+        }
+
+      if (ssize != stride[n])
+        packed = 0;
+
+      ssize *= extent[n];
+    }
+
+  if (packed)
+    return source->data;
+
+  /* Allocate storage for the destination.  */
+  destptr = (GFC_INTEGER_16 *)internal_malloc_size (ssize * sizeof (GFC_INTEGER_16));
+  dest = destptr;
+  src = source->data;
+  stride0 = stride[0];
+
+
+  while (src)
+    {
+      /* Copy the data.  */
+      *(dest++) = *src;
+      /* Advance to the next element.  */
+      src += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              src = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              src += stride[n];
+            }
+        }
+    }
+  return destptr;
+}
+
+#endif
diff --git a/libgfortran/generated/in_pack_i4.c b/libgfortran/generated/in_pack_i4.c
index 1034bde0e89560c17114316421276540232f767b..4452c644d715ea664324edcbc8b423014a2974d9 100644
--- a/libgfortran/generated/in_pack_i4.c
+++ b/libgfortran/generated/in_pack_i4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 /* Allocates a block of memory with internal_malloc if the array needs
    repacking.  */
 
@@ -121,3 +123,4 @@ internal_pack_4 (gfc_array_i4 * source)
   return destptr;
 }
 
+#endif
diff --git a/libgfortran/generated/in_pack_i8.c b/libgfortran/generated/in_pack_i8.c
index aa7e98c38c59cf0614ec165c8d62c6fbd5f2e51e..35e48422897b52367b19511eec13df745f5b970a 100644
--- a/libgfortran/generated/in_pack_i8.c
+++ b/libgfortran/generated/in_pack_i8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 /* Allocates a block of memory with internal_malloc if the array needs
    repacking.  */
 
@@ -121,3 +123,4 @@ internal_pack_8 (gfc_array_i8 * source)
   return destptr;
 }
 
+#endif
diff --git a/libgfortran/generated/in_unpack_c10.c b/libgfortran/generated/in_unpack_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..d7983f96ce657857f79f349dc9d6bbbfc7828218
--- /dev/null
+++ b/libgfortran/generated/in_unpack_c10.c
@@ -0,0 +1,114 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+void
+internal_unpack_c10 (gfc_array_c10 * d, const GFC_COMPLEX_10 * src)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type dsize;
+  GFC_COMPLEX_10 *dest;
+  int n;
+
+  dest = d->data;
+  if (src == dest || !src)
+    return;
+
+  if (d->dim[0].stride == 0)
+    d->dim[0].stride = 1;
+
+  dim = GFC_DESCRIPTOR_RANK (d);
+  dsize = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = d->dim[n].stride;
+      extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound;
+      if (extent[n] <= 0)
+        abort ();
+
+      if (dsize == stride[n])
+        dsize *= extent[n];
+      else
+        dsize = 0;
+    }
+
+  if (dsize != 0)
+    {
+      memcpy (dest, src, dsize * sizeof (GFC_COMPLEX_10));
+      return;
+    }
+
+  stride0 = stride[0];
+
+  while (dest)
+    {
+      /* Copy the data.  */
+      *dest = *(src++);
+      /* Advance to the next element.  */
+      dest += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          dest -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              dest = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              dest += stride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/in_unpack_c16.c b/libgfortran/generated/in_unpack_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..9f1baf279113c5088d921f213592f49b35ca4c3a
--- /dev/null
+++ b/libgfortran/generated/in_unpack_c16.c
@@ -0,0 +1,114 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+void
+internal_unpack_c16 (gfc_array_c16 * d, const GFC_COMPLEX_16 * src)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type dsize;
+  GFC_COMPLEX_16 *dest;
+  int n;
+
+  dest = d->data;
+  if (src == dest || !src)
+    return;
+
+  if (d->dim[0].stride == 0)
+    d->dim[0].stride = 1;
+
+  dim = GFC_DESCRIPTOR_RANK (d);
+  dsize = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = d->dim[n].stride;
+      extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound;
+      if (extent[n] <= 0)
+        abort ();
+
+      if (dsize == stride[n])
+        dsize *= extent[n];
+      else
+        dsize = 0;
+    }
+
+  if (dsize != 0)
+    {
+      memcpy (dest, src, dsize * sizeof (GFC_COMPLEX_16));
+      return;
+    }
+
+  stride0 = stride[0];
+
+  while (dest)
+    {
+      /* Copy the data.  */
+      *dest = *(src++);
+      /* Advance to the next element.  */
+      dest += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          dest -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              dest = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              dest += stride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/in_unpack_c4.c b/libgfortran/generated/in_unpack_c4.c
index 7388ec9d1daca6e8677c73e7f56e60410f56d5eb..965b53a9c70e6261a3940943e1b5992e13a9f62a 100644
--- a/libgfortran/generated/in_unpack_c4.c
+++ b/libgfortran/generated/in_unpack_c4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 void
 internal_unpack_c4 (gfc_array_c4 * d, const GFC_COMPLEX_4 * src)
 {
@@ -109,3 +111,4 @@ internal_unpack_c4 (gfc_array_c4 * d, const GFC_COMPLEX_4 * src)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/in_unpack_c8.c b/libgfortran/generated/in_unpack_c8.c
index dc0e20dc7f4a5c680ef653b6c0cd196f169e87ff..b5d747a7a99baf360d020f9d7f286853bde55ad0 100644
--- a/libgfortran/generated/in_unpack_c8.c
+++ b/libgfortran/generated/in_unpack_c8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 void
 internal_unpack_c8 (gfc_array_c8 * d, const GFC_COMPLEX_8 * src)
 {
@@ -109,3 +111,4 @@ internal_unpack_c8 (gfc_array_c8 * d, const GFC_COMPLEX_8 * src)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/in_unpack_i16.c b/libgfortran/generated/in_unpack_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..680b5dd2b59bafe8d5f09797f1d6a195094bb8e9
--- /dev/null
+++ b/libgfortran/generated/in_unpack_i16.c
@@ -0,0 +1,114 @@
+/* Helper function for repacking arrays.
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <string.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+void
+internal_unpack_16 (gfc_array_i16 * d, const GFC_INTEGER_16 * src)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type stride[GFC_MAX_DIMENSIONS];
+  index_type stride0;
+  index_type dim;
+  index_type dsize;
+  GFC_INTEGER_16 *dest;
+  int n;
+
+  dest = d->data;
+  if (src == dest || !src)
+    return;
+
+  if (d->dim[0].stride == 0)
+    d->dim[0].stride = 1;
+
+  dim = GFC_DESCRIPTOR_RANK (d);
+  dsize = 1;
+  for (n = 0; n < dim; n++)
+    {
+      count[n] = 0;
+      stride[n] = d->dim[n].stride;
+      extent[n] = d->dim[n].ubound + 1 - d->dim[n].lbound;
+      if (extent[n] <= 0)
+        abort ();
+
+      if (dsize == stride[n])
+        dsize *= extent[n];
+      else
+        dsize = 0;
+    }
+
+  if (dsize != 0)
+    {
+      memcpy (dest, src, dsize * sizeof (GFC_INTEGER_16));
+      return;
+    }
+
+  stride0 = stride[0];
+
+  while (dest)
+    {
+      /* Copy the data.  */
+      *dest = *(src++);
+      /* Advance to the next element.  */
+      dest += stride0;
+      count[0]++;
+      /* Advance to the next source element.  */
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          dest -= stride[n] * extent[n];
+          n++;
+          if (n == dim)
+            {
+              dest = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              dest += stride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/in_unpack_i4.c b/libgfortran/generated/in_unpack_i4.c
index 8664b8c9925a196b4e37c2cf3f477655b2f0ed8b..6cf7bd2f273008fd7990e26ea3d6d48a46d00f65 100644
--- a/libgfortran/generated/in_unpack_i4.c
+++ b/libgfortran/generated/in_unpack_i4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 void
 internal_unpack_4 (gfc_array_i4 * d, const GFC_INTEGER_4 * src)
 {
@@ -109,3 +111,4 @@ internal_unpack_4 (gfc_array_i4 * d, const GFC_INTEGER_4 * src)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/in_unpack_i8.c b/libgfortran/generated/in_unpack_i8.c
index 8117c2ce8cbbeea3ddb451b326f7732a257a9e9a..1d4f0e459ab86ab8afd73af5e8c68da75eceadee 100644
--- a/libgfortran/generated/in_unpack_i8.c
+++ b/libgfortran/generated/in_unpack_i8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <string.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 void
 internal_unpack_8 (gfc_array_i8 * d, const GFC_INTEGER_8 * src)
 {
@@ -109,3 +111,4 @@ internal_unpack_8 (gfc_array_i8 * d, const GFC_INTEGER_8 * src)
     }
 }
 
+#endif
diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..801649aa29de5f915f7a2b1524f01636d36df51b
--- /dev/null
+++ b/libgfortran/generated/matmul_c10.c
@@ -0,0 +1,221 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+/* This is a C version of the following fortran pseudo-code. The key
+   point is the loop order -- we access all arrays column-first, which
+   improves the performance enough to boost galgel spec score by 50%.
+
+   DIMENSION A(M,COUNT), B(COUNT,N), C(M,N)
+   C = 0
+   DO J=1,N
+     DO K=1,COUNT
+       DO I=1,M
+         C(I,J) = C(I,J)+A(I,K)*B(K,J)
+*/
+
+extern void matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b);
+export_proto(matmul_c10);
+
+void
+matmul_c10 (gfc_array_c10 * retarray, gfc_array_c10 * a, gfc_array_c10 * b)
+{
+  GFC_COMPLEX_10 *abase;
+  GFC_COMPLEX_10 *bbase;
+  GFC_COMPLEX_10 *dest;
+
+  index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
+  index_type x, y, n, count, xcount, ycount;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+/* C[xcount,ycount] = A[xcount, count] * B[count,ycount]
+
+   Either A or B (but not both) can be rank 1:
+
+   o One-dimensional argument A is implicitly treated as a row matrix
+     dimensioned [1,count], so xcount=1.
+
+   o One-dimensional argument B is implicitly treated as a column matrix
+     dimensioned [count, 1], so ycount=1.
+  */
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      /* One-dimensional result may be addressed in the code below
+	 either as a row or a column matrix. We want both cases to
+	 work. */
+      rxstride = rystride = retarray->dim[0].stride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      /* Treat it as a a row matrix A[1,count]. */
+      axstride = a->dim[0].stride;
+      aystride = 1;
+
+      xcount = 1;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  else
+    {
+      axstride = a->dim[0].stride;
+      aystride = a->dim[1].stride;
+
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+
+  assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      /* Treat it as a column matrix B[count,1] */
+      bxstride = b->dim[0].stride;
+
+      /* bystride should never be used for 1-dimensional b.
+	 in case it is we want it to cause a segfault, rather than
+	 an incorrect result. */
+      bystride = 0xDEADBEEF;
+      ycount = 1;
+    }
+  else
+    {
+      bxstride = b->dim[0].stride;
+      bystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (rxstride == 1 && axstride == 1 && bxstride == 1)
+    {
+      GFC_COMPLEX_10 *bbase_y;
+      GFC_COMPLEX_10 *dest_y;
+      GFC_COMPLEX_10 *abase_n;
+      GFC_COMPLEX_10 bbase_yn;
+
+      if (rystride == ycount)
+	memset (dest, 0, (sizeof (GFC_COMPLEX_10) * size0((array_t *) retarray)));
+      else
+	{
+	  for (y = 0; y < ycount; y++)
+	    for (x = 0; x < xcount; x++)
+	      dest[x + y*rystride] = (GFC_COMPLEX_10)0;
+	}
+
+      for (y = 0; y < ycount; y++)
+	{
+	  bbase_y = bbase + y*bystride;
+	  dest_y = dest + y*rystride;
+	  for (n = 0; n < count; n++)
+	    {
+	      abase_n = abase + n*aystride;
+	      bbase_yn = bbase_y[n];
+	      for (x = 0; x < xcount; x++)
+		{
+		  dest_y[x] += abase_n[x] * bbase_yn;
+		}
+	    }
+	}
+    }
+  else
+    {
+      for (y = 0; y < ycount; y++)
+	for (x = 0; x < xcount; x++)
+	  dest[x*rxstride + y*rystride] = (GFC_COMPLEX_10)0;
+
+      for (y = 0; y < ycount; y++)
+	for (n = 0; n < count; n++)
+	  for (x = 0; x < xcount; x++)
+	    /* dest[x,y] += a[x,n] * b[n,y] */
+	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..fb4870cba39c65d6f0795ddc50e86d9a7527d018
--- /dev/null
+++ b/libgfortran/generated/matmul_c16.c
@@ -0,0 +1,221 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+/* This is a C version of the following fortran pseudo-code. The key
+   point is the loop order -- we access all arrays column-first, which
+   improves the performance enough to boost galgel spec score by 50%.
+
+   DIMENSION A(M,COUNT), B(COUNT,N), C(M,N)
+   C = 0
+   DO J=1,N
+     DO K=1,COUNT
+       DO I=1,M
+         C(I,J) = C(I,J)+A(I,K)*B(K,J)
+*/
+
+extern void matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b);
+export_proto(matmul_c16);
+
+void
+matmul_c16 (gfc_array_c16 * retarray, gfc_array_c16 * a, gfc_array_c16 * b)
+{
+  GFC_COMPLEX_16 *abase;
+  GFC_COMPLEX_16 *bbase;
+  GFC_COMPLEX_16 *dest;
+
+  index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
+  index_type x, y, n, count, xcount, ycount;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+/* C[xcount,ycount] = A[xcount, count] * B[count,ycount]
+
+   Either A or B (but not both) can be rank 1:
+
+   o One-dimensional argument A is implicitly treated as a row matrix
+     dimensioned [1,count], so xcount=1.
+
+   o One-dimensional argument B is implicitly treated as a column matrix
+     dimensioned [count, 1], so ycount=1.
+  */
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      /* One-dimensional result may be addressed in the code below
+	 either as a row or a column matrix. We want both cases to
+	 work. */
+      rxstride = rystride = retarray->dim[0].stride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      /* Treat it as a a row matrix A[1,count]. */
+      axstride = a->dim[0].stride;
+      aystride = 1;
+
+      xcount = 1;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  else
+    {
+      axstride = a->dim[0].stride;
+      aystride = a->dim[1].stride;
+
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+
+  assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      /* Treat it as a column matrix B[count,1] */
+      bxstride = b->dim[0].stride;
+
+      /* bystride should never be used for 1-dimensional b.
+	 in case it is we want it to cause a segfault, rather than
+	 an incorrect result. */
+      bystride = 0xDEADBEEF;
+      ycount = 1;
+    }
+  else
+    {
+      bxstride = b->dim[0].stride;
+      bystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (rxstride == 1 && axstride == 1 && bxstride == 1)
+    {
+      GFC_COMPLEX_16 *bbase_y;
+      GFC_COMPLEX_16 *dest_y;
+      GFC_COMPLEX_16 *abase_n;
+      GFC_COMPLEX_16 bbase_yn;
+
+      if (rystride == ycount)
+	memset (dest, 0, (sizeof (GFC_COMPLEX_16) * size0((array_t *) retarray)));
+      else
+	{
+	  for (y = 0; y < ycount; y++)
+	    for (x = 0; x < xcount; x++)
+	      dest[x + y*rystride] = (GFC_COMPLEX_16)0;
+	}
+
+      for (y = 0; y < ycount; y++)
+	{
+	  bbase_y = bbase + y*bystride;
+	  dest_y = dest + y*rystride;
+	  for (n = 0; n < count; n++)
+	    {
+	      abase_n = abase + n*aystride;
+	      bbase_yn = bbase_y[n];
+	      for (x = 0; x < xcount; x++)
+		{
+		  dest_y[x] += abase_n[x] * bbase_yn;
+		}
+	    }
+	}
+    }
+  else
+    {
+      for (y = 0; y < ycount; y++)
+	for (x = 0; x < xcount; x++)
+	  dest[x*rxstride + y*rystride] = (GFC_COMPLEX_16)0;
+
+      for (y = 0; y < ycount; y++)
+	for (n = 0; n < count; n++)
+	  for (x = 0; x < xcount; x++)
+	    /* dest[x,y] += a[x,n] * b[n,y] */
+	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index 8d13bb91625883efd9d14acac727aebc5543198a..8c9a7104ca8490eab70454d6d026f998a2636dec 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_c4 (gfc_array_c4 * retarray, gfc_array_c4 * a, gfc_array_c4 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index ada73eb44b006b2bc402adf3c7089a5492cd288f..7b713f1343ab5fc4a2aba36fbc0b41c84fc0fa21 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_c8 (gfc_array_c8 * retarray, gfc_array_c8 * a, gfc_array_c8 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..adbfbedaeb2e5ba9341c056e0fe4e229d038c73a
--- /dev/null
+++ b/libgfortran/generated/matmul_i16.c
@@ -0,0 +1,221 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+/* This is a C version of the following fortran pseudo-code. The key
+   point is the loop order -- we access all arrays column-first, which
+   improves the performance enough to boost galgel spec score by 50%.
+
+   DIMENSION A(M,COUNT), B(COUNT,N), C(M,N)
+   C = 0
+   DO J=1,N
+     DO K=1,COUNT
+       DO I=1,M
+         C(I,J) = C(I,J)+A(I,K)*B(K,J)
+*/
+
+extern void matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b);
+export_proto(matmul_i16);
+
+void
+matmul_i16 (gfc_array_i16 * retarray, gfc_array_i16 * a, gfc_array_i16 * b)
+{
+  GFC_INTEGER_16 *abase;
+  GFC_INTEGER_16 *bbase;
+  GFC_INTEGER_16 *dest;
+
+  index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
+  index_type x, y, n, count, xcount, ycount;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+/* C[xcount,ycount] = A[xcount, count] * B[count,ycount]
+
+   Either A or B (but not both) can be rank 1:
+
+   o One-dimensional argument A is implicitly treated as a row matrix
+     dimensioned [1,count], so xcount=1.
+
+   o One-dimensional argument B is implicitly treated as a column matrix
+     dimensioned [count, 1], so ycount=1.
+  */
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_INTEGER_16) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      /* One-dimensional result may be addressed in the code below
+	 either as a row or a column matrix. We want both cases to
+	 work. */
+      rxstride = rystride = retarray->dim[0].stride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      /* Treat it as a a row matrix A[1,count]. */
+      axstride = a->dim[0].stride;
+      aystride = 1;
+
+      xcount = 1;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  else
+    {
+      axstride = a->dim[0].stride;
+      aystride = a->dim[1].stride;
+
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+
+  assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      /* Treat it as a column matrix B[count,1] */
+      bxstride = b->dim[0].stride;
+
+      /* bystride should never be used for 1-dimensional b.
+	 in case it is we want it to cause a segfault, rather than
+	 an incorrect result. */
+      bystride = 0xDEADBEEF;
+      ycount = 1;
+    }
+  else
+    {
+      bxstride = b->dim[0].stride;
+      bystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (rxstride == 1 && axstride == 1 && bxstride == 1)
+    {
+      GFC_INTEGER_16 *bbase_y;
+      GFC_INTEGER_16 *dest_y;
+      GFC_INTEGER_16 *abase_n;
+      GFC_INTEGER_16 bbase_yn;
+
+      if (rystride == ycount)
+	memset (dest, 0, (sizeof (GFC_INTEGER_16) * size0((array_t *) retarray)));
+      else
+	{
+	  for (y = 0; y < ycount; y++)
+	    for (x = 0; x < xcount; x++)
+	      dest[x + y*rystride] = (GFC_INTEGER_16)0;
+	}
+
+      for (y = 0; y < ycount; y++)
+	{
+	  bbase_y = bbase + y*bystride;
+	  dest_y = dest + y*rystride;
+	  for (n = 0; n < count; n++)
+	    {
+	      abase_n = abase + n*aystride;
+	      bbase_yn = bbase_y[n];
+	      for (x = 0; x < xcount; x++)
+		{
+		  dest_y[x] += abase_n[x] * bbase_yn;
+		}
+	    }
+	}
+    }
+  else
+    {
+      for (y = 0; y < ycount; y++)
+	for (x = 0; x < xcount; x++)
+	  dest[x*rxstride + y*rystride] = (GFC_INTEGER_16)0;
+
+      for (y = 0; y < ycount; y++)
+	for (n = 0; n < count; n++)
+	  for (x = 0; x < xcount; x++)
+	    /* dest[x,y] += a[x,n] * b[n,y] */
+	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index 16c376f21851ded48b304b5f398d30712f7fce5e..abace324d95da63419276e9a21aac575d6822bac 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_i4 (gfc_array_i4 * retarray, gfc_array_i4 * a, gfc_array_i4 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index 0e29d078fa5a276da43f0deefa54b4aee2e6d239..9820e405cd0472b935456ebeac4fa093654fca2d 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_i8 (gfc_array_i8 * retarray, gfc_array_i8 * a, gfc_array_i8 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_l16.c b/libgfortran/generated/matmul_l16.c
new file mode 100644
index 0000000000000000000000000000000000000000..28dce3a242253bc45bb01604db2163ff596a50fc
--- /dev/null
+++ b/libgfortran/generated/matmul_l16.c
@@ -0,0 +1,196 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_LOGICAL_16)
+
+/* Dimensions: retarray(x,y) a(x, count) b(count,y).
+   Either a or b can be rank 1.  In this case x or y is 1.  */
+
+extern void matmul_l16 (gfc_array_l16 *, gfc_array_l4 *, gfc_array_l4 *);
+export_proto(matmul_l16);
+
+void
+matmul_l16 (gfc_array_l16 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
+{
+  GFC_INTEGER_4 *abase;
+  GFC_INTEGER_4 *bbase;
+  GFC_LOGICAL_16 *dest;
+  index_type rxstride;
+  index_type rystride;
+  index_type xcount;
+  index_type ycount;
+  index_type xstride;
+  index_type ystride;
+  index_type x;
+  index_type y;
+
+  GFC_INTEGER_4 *pa;
+  GFC_INTEGER_4 *pb;
+  index_type astride;
+  index_type bstride;
+  index_type count;
+  index_type n;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+          
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+          
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_LOGICAL_16) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  if (GFC_DESCRIPTOR_SIZE (a) != 4)
+    {
+      assert (GFC_DESCRIPTOR_SIZE (a) == 8);
+      abase = GFOR_POINTER_L8_TO_L4 (abase);
+    }
+  bbase = b->data;
+  if (GFC_DESCRIPTOR_SIZE (b) != 4)
+    {
+      assert (GFC_DESCRIPTOR_SIZE (b) == 8);
+      bbase = GFOR_POINTER_L8_TO_L4 (bbase);
+    }
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = rxstride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+  /* If we have rank 1 parameters, zero the absent stride, and set the size to
+     one.  */
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      astride = a->dim[0].stride;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+      xstride = 0;
+      rxstride = 0;
+      xcount = 1;
+    }
+  else
+    {
+      astride = a->dim[1].stride;
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xstride = a->dim[0].stride;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      bstride = b->dim[0].stride;
+      assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+      ystride = 0;
+      rystride = 0;
+      ycount = 1;
+    }
+  else
+    {
+      bstride = b->dim[0].stride;
+      assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+      ystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  for (y = 0; y < ycount; y++)
+    {
+      for (x = 0; x < xcount; x++)
+        {
+          /* Do the summation for this element.  For real and integer types
+             this is the same as DOT_PRODUCT.  For complex types we use do
+             a*b, not conjg(a)*b.  */
+          pa = abase;
+          pb = bbase;
+          *dest = 0;
+
+          for (n = 0; n < count; n++)
+            {
+              if (*pa && *pb)
+                {
+                  *dest = 1;
+                  break;
+                }
+              pa += astride;
+              pb += bstride;
+            }
+
+          dest += rxstride;
+          abase += xstride;
+        }
+      abase -= xstride * xcount;
+      bbase += ystride;
+      dest += rystride - (rxstride * xcount);
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_l4.c b/libgfortran/generated/matmul_l4.c
index ff32eb44fd78e0b13305738b86012ae19d47d596..da6681479a50e5d9d226b8cc65ded96092df29c6 100644
--- a/libgfortran/generated/matmul_l4.c
+++ b/libgfortran/generated/matmul_l4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_LOGICAL_4)
+
 /* Dimensions: retarray(x,y) a(x, count) b(count,y).
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
@@ -190,3 +192,5 @@ matmul_l4 (gfc_array_l4 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
       dest += rystride - (rxstride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_l8.c b/libgfortran/generated/matmul_l8.c
index b726a70d5dcf5c2ccad0ea29e3432d821bfba5d1..22c1a660941cf5d6eda45d3c4b27a89f45bd6d6a 100644
--- a/libgfortran/generated/matmul_l8.c
+++ b/libgfortran/generated/matmul_l8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_LOGICAL_8)
+
 /* Dimensions: retarray(x,y) a(x, count) b(count,y).
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
@@ -190,3 +192,5 @@ matmul_l8 (gfc_array_l8 * retarray, gfc_array_l4 * a, gfc_array_l4 * b)
       dest += rystride - (rxstride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..8aa342da2f4a69fcd9bcaf3e50f667c1c072465d
--- /dev/null
+++ b/libgfortran/generated/matmul_r10.c
@@ -0,0 +1,221 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_REAL_10)
+
+/* This is a C version of the following fortran pseudo-code. The key
+   point is the loop order -- we access all arrays column-first, which
+   improves the performance enough to boost galgel spec score by 50%.
+
+   DIMENSION A(M,COUNT), B(COUNT,N), C(M,N)
+   C = 0
+   DO J=1,N
+     DO K=1,COUNT
+       DO I=1,M
+         C(I,J) = C(I,J)+A(I,K)*B(K,J)
+*/
+
+extern void matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b);
+export_proto(matmul_r10);
+
+void
+matmul_r10 (gfc_array_r10 * retarray, gfc_array_r10 * a, gfc_array_r10 * b)
+{
+  GFC_REAL_10 *abase;
+  GFC_REAL_10 *bbase;
+  GFC_REAL_10 *dest;
+
+  index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
+  index_type x, y, n, count, xcount, ycount;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+/* C[xcount,ycount] = A[xcount, count] * B[count,ycount]
+
+   Either A or B (but not both) can be rank 1:
+
+   o One-dimensional argument A is implicitly treated as a row matrix
+     dimensioned [1,count], so xcount=1.
+
+   o One-dimensional argument B is implicitly treated as a column matrix
+     dimensioned [count, 1], so ycount=1.
+  */
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_REAL_10) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      /* One-dimensional result may be addressed in the code below
+	 either as a row or a column matrix. We want both cases to
+	 work. */
+      rxstride = rystride = retarray->dim[0].stride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      /* Treat it as a a row matrix A[1,count]. */
+      axstride = a->dim[0].stride;
+      aystride = 1;
+
+      xcount = 1;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  else
+    {
+      axstride = a->dim[0].stride;
+      aystride = a->dim[1].stride;
+
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+
+  assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      /* Treat it as a column matrix B[count,1] */
+      bxstride = b->dim[0].stride;
+
+      /* bystride should never be used for 1-dimensional b.
+	 in case it is we want it to cause a segfault, rather than
+	 an incorrect result. */
+      bystride = 0xDEADBEEF;
+      ycount = 1;
+    }
+  else
+    {
+      bxstride = b->dim[0].stride;
+      bystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (rxstride == 1 && axstride == 1 && bxstride == 1)
+    {
+      GFC_REAL_10 *bbase_y;
+      GFC_REAL_10 *dest_y;
+      GFC_REAL_10 *abase_n;
+      GFC_REAL_10 bbase_yn;
+
+      if (rystride == ycount)
+	memset (dest, 0, (sizeof (GFC_REAL_10) * size0((array_t *) retarray)));
+      else
+	{
+	  for (y = 0; y < ycount; y++)
+	    for (x = 0; x < xcount; x++)
+	      dest[x + y*rystride] = (GFC_REAL_10)0;
+	}
+
+      for (y = 0; y < ycount; y++)
+	{
+	  bbase_y = bbase + y*bystride;
+	  dest_y = dest + y*rystride;
+	  for (n = 0; n < count; n++)
+	    {
+	      abase_n = abase + n*aystride;
+	      bbase_yn = bbase_y[n];
+	      for (x = 0; x < xcount; x++)
+		{
+		  dest_y[x] += abase_n[x] * bbase_yn;
+		}
+	    }
+	}
+    }
+  else
+    {
+      for (y = 0; y < ycount; y++)
+	for (x = 0; x < xcount; x++)
+	  dest[x*rxstride + y*rystride] = (GFC_REAL_10)0;
+
+      for (y = 0; y < ycount; y++)
+	for (n = 0; n < count; n++)
+	  for (x = 0; x < xcount; x++)
+	    /* dest[x,y] += a[x,n] * b[n,y] */
+	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..549f39ea6ca1d036adb3e52e1cd9823eeca06210
--- /dev/null
+++ b/libgfortran/generated/matmul_r16.c
@@ -0,0 +1,221 @@
+/* Implementation of the MATMUL intrinsic
+   Copyright 2002, 2005 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_REAL_16)
+
+/* This is a C version of the following fortran pseudo-code. The key
+   point is the loop order -- we access all arrays column-first, which
+   improves the performance enough to boost galgel spec score by 50%.
+
+   DIMENSION A(M,COUNT), B(COUNT,N), C(M,N)
+   C = 0
+   DO J=1,N
+     DO K=1,COUNT
+       DO I=1,M
+         C(I,J) = C(I,J)+A(I,K)*B(K,J)
+*/
+
+extern void matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b);
+export_proto(matmul_r16);
+
+void
+matmul_r16 (gfc_array_r16 * retarray, gfc_array_r16 * a, gfc_array_r16 * b)
+{
+  GFC_REAL_16 *abase;
+  GFC_REAL_16 *bbase;
+  GFC_REAL_16 *dest;
+
+  index_type rxstride, rystride, axstride, aystride, bxstride, bystride;
+  index_type x, y, n, count, xcount, ycount;
+
+  assert (GFC_DESCRIPTOR_RANK (a) == 2
+          || GFC_DESCRIPTOR_RANK (b) == 2);
+
+/* C[xcount,ycount] = A[xcount, count] * B[count,ycount]
+
+   Either A or B (but not both) can be rank 1:
+
+   o One-dimensional argument A is implicitly treated as a row matrix
+     dimensioned [1,count], so xcount=1.
+
+   o One-dimensional argument B is implicitly treated as a column matrix
+     dimensioned [count, 1], so ycount=1.
+  */
+
+  if (retarray->data == NULL)
+    {
+      if (GFC_DESCRIPTOR_RANK (a) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else if (GFC_DESCRIPTOR_RANK (b) == 1)
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+        }
+      else
+        {
+          retarray->dim[0].lbound = 0;
+          retarray->dim[0].ubound = a->dim[0].ubound - a->dim[0].lbound;
+          retarray->dim[0].stride = 1;
+
+          retarray->dim[1].lbound = 0;
+          retarray->dim[1].ubound = b->dim[1].ubound - b->dim[1].lbound;
+          retarray->dim[1].stride = retarray->dim[0].ubound+1;
+        }
+
+      retarray->data
+	= internal_malloc_size (sizeof (GFC_REAL_16) * size0 ((array_t *) retarray));
+      retarray->offset = 0;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (retarray->dim[0].stride == 0)
+    retarray->dim[0].stride = 1;
+  if (a->dim[0].stride == 0)
+    a->dim[0].stride = 1;
+  if (b->dim[0].stride == 0)
+    b->dim[0].stride = 1;
+
+
+  if (GFC_DESCRIPTOR_RANK (retarray) == 1)
+    {
+      /* One-dimensional result may be addressed in the code below
+	 either as a row or a column matrix. We want both cases to
+	 work. */
+      rxstride = rystride = retarray->dim[0].stride;
+    }
+  else
+    {
+      rxstride = retarray->dim[0].stride;
+      rystride = retarray->dim[1].stride;
+    }
+
+
+  if (GFC_DESCRIPTOR_RANK (a) == 1)
+    {
+      /* Treat it as a a row matrix A[1,count]. */
+      axstride = a->dim[0].stride;
+      aystride = 1;
+
+      xcount = 1;
+      count = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+  else
+    {
+      axstride = a->dim[0].stride;
+      aystride = a->dim[1].stride;
+
+      count = a->dim[1].ubound + 1 - a->dim[1].lbound;
+      xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
+    }
+
+  assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+
+  if (GFC_DESCRIPTOR_RANK (b) == 1)
+    {
+      /* Treat it as a column matrix B[count,1] */
+      bxstride = b->dim[0].stride;
+
+      /* bystride should never be used for 1-dimensional b.
+	 in case it is we want it to cause a segfault, rather than
+	 an incorrect result. */
+      bystride = 0xDEADBEEF;
+      ycount = 1;
+    }
+  else
+    {
+      bxstride = b->dim[0].stride;
+      bystride = b->dim[1].stride;
+      ycount = b->dim[1].ubound + 1 - b->dim[1].lbound;
+    }
+
+  abase = a->data;
+  bbase = b->data;
+  dest = retarray->data;
+
+  if (rxstride == 1 && axstride == 1 && bxstride == 1)
+    {
+      GFC_REAL_16 *bbase_y;
+      GFC_REAL_16 *dest_y;
+      GFC_REAL_16 *abase_n;
+      GFC_REAL_16 bbase_yn;
+
+      if (rystride == ycount)
+	memset (dest, 0, (sizeof (GFC_REAL_16) * size0((array_t *) retarray)));
+      else
+	{
+	  for (y = 0; y < ycount; y++)
+	    for (x = 0; x < xcount; x++)
+	      dest[x + y*rystride] = (GFC_REAL_16)0;
+	}
+
+      for (y = 0; y < ycount; y++)
+	{
+	  bbase_y = bbase + y*bystride;
+	  dest_y = dest + y*rystride;
+	  for (n = 0; n < count; n++)
+	    {
+	      abase_n = abase + n*aystride;
+	      bbase_yn = bbase_y[n];
+	      for (x = 0; x < xcount; x++)
+		{
+		  dest_y[x] += abase_n[x] * bbase_yn;
+		}
+	    }
+	}
+    }
+  else
+    {
+      for (y = 0; y < ycount; y++)
+	for (x = 0; x < xcount; x++)
+	  dest[x*rxstride + y*rystride] = (GFC_REAL_16)0;
+
+      for (y = 0; y < ycount; y++)
+	for (n = 0; n < count; n++)
+	  for (x = 0; x < xcount; x++)
+	    /* dest[x,y] += a[x,n] * b[n,y] */
+	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index 91311ceedc822434bf7127f56d3b5d88d0cee159..b1d3eb77c9d464bfce60eb4aa07c7150cff072c7 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_REAL_4)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_r4 (gfc_array_r4 * retarray, gfc_array_r4 * a, gfc_array_r4 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index 3748731a20fb6b114234d5207544c93e030b44e8..df9fc3e6a0ead568afc0a5247aba13f151cfe8ed 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_REAL_8)
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -215,3 +217,5 @@ matmul_r8 (gfc_array_r8 * retarray, gfc_array_r8 * a, gfc_array_r8 * b)
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_i16.c b/libgfortran/generated/maxloc0_16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..ca934a14d7007f08a846a75da8fcffa2df6106bd
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array);
+export_proto(maxloc0_16_i16);
+
+void
+maxloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_i16 (gfc_array_i16 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_i16);
+
+void
+mmaxloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_i4.c b/libgfortran/generated/maxloc0_16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..9dcd7b48a50cda3bb58a9797fab42cfd2a84e20e
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_i4.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array);
+export_proto(maxloc0_16_i4);
+
+void
+maxloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_4 maxval;
+
+  maxval = -GFC_INTEGER_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_i4 (gfc_array_i16 *, gfc_array_i4 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_i4);
+
+void
+mmaxloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_4 maxval;
+
+  maxval = -GFC_INTEGER_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_i8.c b/libgfortran/generated/maxloc0_16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..d8a6261ea4457c626aae10c638d80b41fdcea838
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_i8.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array);
+export_proto(maxloc0_16_i8);
+
+void
+maxloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_8 maxval;
+
+  maxval = -GFC_INTEGER_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_i8 (gfc_array_i16 *, gfc_array_i8 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_i8);
+
+void
+mmaxloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_8 maxval;
+
+  maxval = -GFC_INTEGER_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_r10.c b/libgfortran/generated/maxloc0_16_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..1f0dfb0383e9bbf7ae67f623008a78c0cb261b3b
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array);
+export_proto(maxloc0_16_r10);
+
+void
+maxloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_r10 (gfc_array_i16 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_r10);
+
+void
+mmaxloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_r16.c b/libgfortran/generated/maxloc0_16_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d9e3780470cb8134f4306909608cc5662306f598
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array);
+export_proto(maxloc0_16_r16);
+
+void
+maxloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_r16 (gfc_array_i16 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_r16);
+
+void
+mmaxloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_r4.c b/libgfortran/generated/maxloc0_16_r4.c
new file mode 100644
index 0000000000000000000000000000000000000000..6e0e92aa372cebbe7a4f6b2a505df7e083dc0992
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_r4.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array);
+export_proto(maxloc0_16_r4);
+
+void
+maxloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_4 maxval;
+
+  maxval = -GFC_REAL_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_r4 (gfc_array_i16 *, gfc_array_r4 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_r4);
+
+void
+mmaxloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_4 maxval;
+
+  maxval = -GFC_REAL_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_16_r8.c b/libgfortran/generated/maxloc0_16_r8.c
new file mode 100644
index 0000000000000000000000000000000000000000..878e21e1e16f0718d6081afec2bfef5ae35f1fcc
--- /dev/null
+++ b/libgfortran/generated/maxloc0_16_r8.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array);
+export_proto(maxloc0_16_r8);
+
+void
+maxloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_8 maxval;
+
+  maxval = -GFC_REAL_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_16_r8 (gfc_array_i16 *, gfc_array_r8 *, gfc_array_l4 *);
+export_proto(mmaxloc0_16_r8);
+
+void
+mmaxloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_8 maxval;
+
+  maxval = -GFC_REAL_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_i16.c b/libgfortran/generated/maxloc0_4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..e41953010aa5b18fc00b95f3541df2516878b5a0
--- /dev/null
+++ b/libgfortran/generated/maxloc0_4_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array);
+export_proto(maxloc0_4_i16);
+
+void
+maxloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_4_i16 (gfc_array_i4 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_4_i16);
+
+void
+mmaxloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_i4.c b/libgfortran/generated/maxloc0_4_i4.c
index 5821e38ef22a3b7303f36f69d878c9e176edf3fc..d88212411cf18ac6b75b7fb52cdaa2a7cc96b5d6 100644
--- a/libgfortran/generated/maxloc0_4_i4.c
+++ b/libgfortran/generated/maxloc0_4_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void maxloc0_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 *array);
 export_proto(maxloc0_4_i4);
@@ -286,3 +288,5 @@ mmaxloc0_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_i8.c b/libgfortran/generated/maxloc0_4_i8.c
index ae935666d189316fae2e127c6802cfaf6b575aa8..e709d8308f131e4fa3accd041792a0ea1b28d1e2 100644
--- a/libgfortran/generated/maxloc0_4_i8.c
+++ b/libgfortran/generated/maxloc0_4_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void maxloc0_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 *array);
 export_proto(maxloc0_4_i8);
@@ -286,3 +288,5 @@ mmaxloc0_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_r10.c b/libgfortran/generated/maxloc0_4_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..63b4ab3b3456ccf64476eac7ac1f511108fa969f
--- /dev/null
+++ b/libgfortran/generated/maxloc0_4_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array);
+export_proto(maxloc0_4_r10);
+
+void
+maxloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_4_r10 (gfc_array_i4 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mmaxloc0_4_r10);
+
+void
+mmaxloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_r16.c b/libgfortran/generated/maxloc0_4_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..41cecafe38a4f9d9452c8c050dbcf138ca86b666
--- /dev/null
+++ b/libgfortran/generated/maxloc0_4_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array);
+export_proto(maxloc0_4_r16);
+
+void
+maxloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_4_r16 (gfc_array_i4 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_4_r16);
+
+void
+mmaxloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_r4.c b/libgfortran/generated/maxloc0_4_r4.c
index a5e8c741e0d4fb3584866e67c95273102f7bb52f..3eba4f2cc24dc0a2a4e68a5bf57b874b00f68b29 100644
--- a/libgfortran/generated/maxloc0_4_r4.c
+++ b/libgfortran/generated/maxloc0_4_r4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void maxloc0_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 *array);
 export_proto(maxloc0_4_r4);
@@ -286,3 +288,5 @@ mmaxloc0_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_4_r8.c b/libgfortran/generated/maxloc0_4_r8.c
index e1ac5d7b9f6cb5cdd7827b6ca881fc2676c927c5..3a5f3f2d38a894bee608bf76327aa20fa3c25718 100644
--- a/libgfortran/generated/maxloc0_4_r8.c
+++ b/libgfortran/generated/maxloc0_4_r8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void maxloc0_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 *array);
 export_proto(maxloc0_4_r8);
@@ -286,3 +288,5 @@ mmaxloc0_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_i16.c b/libgfortran/generated/maxloc0_8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..52316ed08502ca30a71dd8309102fad84f33ad88
--- /dev/null
+++ b/libgfortran/generated/maxloc0_8_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array);
+export_proto(maxloc0_8_i16);
+
+void
+maxloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_8_i16 (gfc_array_i8 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_8_i16);
+
+void
+mmaxloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 maxval;
+
+  maxval = -GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_i4.c b/libgfortran/generated/maxloc0_8_i4.c
index 13720778c6ddfdf74126c202ad6987c08e588111..aa37b6d1f38bfc14a54c25cc3f9017b13030635e 100644
--- a/libgfortran/generated/maxloc0_8_i4.c
+++ b/libgfortran/generated/maxloc0_8_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void maxloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array);
 export_proto(maxloc0_8_i4);
@@ -286,3 +288,5 @@ mmaxloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_i8.c b/libgfortran/generated/maxloc0_8_i8.c
index 83d17cc3d02071958a947b3d220381809abdf530..8c825c4a45aaaff06048c8f0f99890859c54490a 100644
--- a/libgfortran/generated/maxloc0_8_i8.c
+++ b/libgfortran/generated/maxloc0_8_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void maxloc0_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 *array);
 export_proto(maxloc0_8_i8);
@@ -286,3 +288,5 @@ mmaxloc0_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_r10.c b/libgfortran/generated/maxloc0_8_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..6add1779ef1868c4ce042df68d20c07431d542ee
--- /dev/null
+++ b/libgfortran/generated/maxloc0_8_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array);
+export_proto(maxloc0_8_r10);
+
+void
+maxloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_8_r10 (gfc_array_i8 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mmaxloc0_8_r10);
+
+void
+mmaxloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 maxval;
+
+  maxval = -GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_r16.c b/libgfortran/generated/maxloc0_8_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..92f0884f7a5fe727dc3ce058efb85c702f9620dd
--- /dev/null
+++ b/libgfortran/generated/maxloc0_8_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array);
+export_proto(maxloc0_8_r16);
+
+void
+maxloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mmaxloc0_8_r16 (gfc_array_i8 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mmaxloc0_8_r16);
+
+void
+mmaxloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 maxval;
+
+  maxval = -GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base > maxval)
+    {
+      maxval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_r4.c b/libgfortran/generated/maxloc0_8_r4.c
index 8eede406215937ba1baa04352c49e658fbd0a999..07cebb377027415714c449b82f4c4c4d28654e25 100644
--- a/libgfortran/generated/maxloc0_8_r4.c
+++ b/libgfortran/generated/maxloc0_8_r4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void maxloc0_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 *array);
 export_proto(maxloc0_8_r4);
@@ -286,3 +288,5 @@ mmaxloc0_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc0_8_r8.c b/libgfortran/generated/maxloc0_8_r8.c
index 55ed45fe513e4b7314271c4d436699300dad0984..92f2805a5b2431d1f5d310a9802cfecf28f8fedf 100644
--- a/libgfortran/generated/maxloc0_8_r8.c
+++ b/libgfortran/generated/maxloc0_8_r8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void maxloc0_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 *array);
 export_proto(maxloc0_8_r8);
@@ -286,3 +288,5 @@ mmaxloc0_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d9666bdbe1b6ea89a08663097001a807e3524707
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(maxloc1_16_i16);
+
+void
+maxloc1_16_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_i16);
+
+void
+mmaxloc1_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..9df85ec107a67b44051d2c1a981391b8c772cfcd
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_i4.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_i4 (gfc_array_i16 *, gfc_array_i4 *, index_type *);
+export_proto(maxloc1_16_i4);
+
+void
+maxloc1_16_i4 (gfc_array_i16 *retarray, gfc_array_i4 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_4 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_4 maxval;
+  maxval = -GFC_INTEGER_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_i4 (gfc_array_i16 *, gfc_array_i4 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_i4);
+
+void
+mmaxloc1_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_4 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_4 maxval;
+  maxval = -GFC_INTEGER_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..8d6e003f38365a635983ce1c4426b922d6e5a071
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_i8.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_i8 (gfc_array_i16 *, gfc_array_i8 *, index_type *);
+export_proto(maxloc1_16_i8);
+
+void
+maxloc1_16_i8 (gfc_array_i16 *retarray, gfc_array_i8 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_8 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_8 maxval;
+  maxval = -GFC_INTEGER_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_i8 (gfc_array_i16 *, gfc_array_i8 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_i8);
+
+void
+mmaxloc1_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_8 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_8 maxval;
+  maxval = -GFC_INTEGER_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..64b277005acab24f92f7b45d1435624068384f50
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_r10 (gfc_array_i16 *, gfc_array_r10 *, index_type *);
+export_proto(maxloc1_16_r10);
+
+void
+maxloc1_16_r10 (gfc_array_i16 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_r10 (gfc_array_i16 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_r10);
+
+void
+mmaxloc1_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..f6718083f5cf3923d30093a77110382eca494e81
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_r16 (gfc_array_i16 *, gfc_array_r16 *, index_type *);
+export_proto(maxloc1_16_r16);
+
+void
+maxloc1_16_r16 (gfc_array_i16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_r16 (gfc_array_i16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_r16);
+
+void
+mmaxloc1_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c
new file mode 100644
index 0000000000000000000000000000000000000000..902e97c994e928c3c70a1d87f53a7e9fbbc9d82e
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_r4.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_r4 (gfc_array_i16 *, gfc_array_r4 *, index_type *);
+export_proto(maxloc1_16_r4);
+
+void
+maxloc1_16_r4 (gfc_array_i16 *retarray, gfc_array_r4 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_4 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_4 maxval;
+  maxval = -GFC_REAL_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_r4 (gfc_array_i16 *, gfc_array_r4 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_r4);
+
+void
+mmaxloc1_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_4 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_4 maxval;
+  maxval = -GFC_REAL_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c
new file mode 100644
index 0000000000000000000000000000000000000000..3e28d6706e28b0dfc780b0dfa6e461177bc5186e
--- /dev/null
+++ b/libgfortran/generated/maxloc1_16_r8.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxloc1_16_r8 (gfc_array_i16 *, gfc_array_r8 *, index_type *);
+export_proto(maxloc1_16_r8);
+
+void
+maxloc1_16_r8 (gfc_array_i16 *retarray, gfc_array_r8 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_8 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_8 maxval;
+  maxval = -GFC_REAL_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_16_r8 (gfc_array_i16 *, gfc_array_r8 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_16_r8);
+
+void
+mmaxloc1_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_8 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_8 maxval;
+  maxval = -GFC_REAL_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..8ca2cf1195be633e301e962ec01cf4c32a5e8913
--- /dev/null
+++ b/libgfortran/generated/maxloc1_4_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc1_4_i16 (gfc_array_i4 *, gfc_array_i16 *, index_type *);
+export_proto(maxloc1_4_i16);
+
+void
+maxloc1_4_i16 (gfc_array_i4 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_4_i16 (gfc_array_i4 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_4_i16);
+
+void
+mmaxloc1_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c
index bfa721d4da2070b648c6c439897e37b548ebee2c..06a657cca4e9644ae8f55a74f5e9c37e9c760339 100644
--- a/libgfortran/generated/maxloc1_4_i4.c
+++ b/libgfortran/generated/maxloc1_4_i4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void maxloc1_4_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(maxloc1_4_i4);
 
@@ -341,3 +344,4 @@ mmaxloc1_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c
index 81a09ba6b4478518e46f1bb76bc102aa2537cae5..f03b36ca6a671148f09ee122a63c887fdb576bd3 100644
--- a/libgfortran/generated/maxloc1_4_i8.c
+++ b/libgfortran/generated/maxloc1_4_i8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void maxloc1_4_i8 (gfc_array_i4 *, gfc_array_i8 *, index_type *);
 export_proto(maxloc1_4_i8);
 
@@ -341,3 +344,4 @@ mmaxloc1_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..854b0b8042e5ced5cbf3c7cec890049021c27c13
--- /dev/null
+++ b/libgfortran/generated/maxloc1_4_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc1_4_r10 (gfc_array_i4 *, gfc_array_r10 *, index_type *);
+export_proto(maxloc1_4_r10);
+
+void
+maxloc1_4_r10 (gfc_array_i4 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_4_r10 (gfc_array_i4 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_4_r10);
+
+void
+mmaxloc1_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..fdabd1ae4f25cda7c66e30f7321e4594b052690f
--- /dev/null
+++ b/libgfortran/generated/maxloc1_4_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void maxloc1_4_r16 (gfc_array_i4 *, gfc_array_r16 *, index_type *);
+export_proto(maxloc1_4_r16);
+
+void
+maxloc1_4_r16 (gfc_array_i4 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_4_r16 (gfc_array_i4 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_4_r16);
+
+void
+mmaxloc1_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c
index d955b7756a019928ea378018fbd4dcfa2d04a4f1..34510e7de1a1454dde7393cbffdde35b0c109c46 100644
--- a/libgfortran/generated/maxloc1_4_r4.c
+++ b/libgfortran/generated/maxloc1_4_r4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void maxloc1_4_r4 (gfc_array_i4 *, gfc_array_r4 *, index_type *);
 export_proto(maxloc1_4_r4);
 
@@ -341,3 +344,4 @@ mmaxloc1_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c
index c2a2ec4df8f3a5381ce00c64dc9b662992515964..ea67079c6c0e3aeb6c3cfb45a925e878122ab1e7 100644
--- a/libgfortran/generated/maxloc1_4_r8.c
+++ b/libgfortran/generated/maxloc1_4_r8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void maxloc1_4_r8 (gfc_array_i4 *, gfc_array_r8 *, index_type *);
 export_proto(maxloc1_4_r8);
 
@@ -341,3 +344,4 @@ mmaxloc1_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..f3ba50b32c3fe5b058f84a6127f01aae976fa60c
--- /dev/null
+++ b/libgfortran/generated/maxloc1_8_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc1_8_i16 (gfc_array_i8 *, gfc_array_i16 *, index_type *);
+export_proto(maxloc1_8_i16);
+
+void
+maxloc1_8_i16 (gfc_array_i8 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_8_i16 (gfc_array_i8 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_8_i16);
+
+void
+mmaxloc1_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 maxval;
+  maxval = -GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c
index 344c13b2fbe2a8a0a7bd1b7d17693079dac3c6b3..1c095ff7bb97c90d0c13cf07d2723c232593f5ef 100644
--- a/libgfortran/generated/maxloc1_8_i4.c
+++ b/libgfortran/generated/maxloc1_8_i4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void maxloc1_8_i4 (gfc_array_i8 *, gfc_array_i4 *, index_type *);
 export_proto(maxloc1_8_i4);
 
@@ -341,3 +344,4 @@ mmaxloc1_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c
index 763667bb3ab508c6bd21b3dc05b5ed660f98c00d..ee6d269f3070aa121dd7c62b6686943a0ccd61f3 100644
--- a/libgfortran/generated/maxloc1_8_i8.c
+++ b/libgfortran/generated/maxloc1_8_i8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void maxloc1_8_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(maxloc1_8_i8);
 
@@ -341,3 +344,4 @@ mmaxloc1_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..67c77330142a6b170439ad92f615ea2e668992e8
--- /dev/null
+++ b/libgfortran/generated/maxloc1_8_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc1_8_r10 (gfc_array_i8 *, gfc_array_r10 *, index_type *);
+export_proto(maxloc1_8_r10);
+
+void
+maxloc1_8_r10 (gfc_array_i8 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_8_r10 (gfc_array_i8 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_8_r10);
+
+void
+mmaxloc1_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 maxval;
+  maxval = -GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d0b607f25dc32b735b17984a89effb6f7f8951c2
--- /dev/null
+++ b/libgfortran/generated/maxloc1_8_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MAXLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void maxloc1_8_r16 (gfc_array_i8 *, gfc_array_r16 *, index_type *);
+export_proto(maxloc1_8_r16);
+
+void
+maxloc1_8_r16 (gfc_array_i8 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxloc1_8_r16 (gfc_array_i8 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxloc1_8_r16);
+
+void
+mmaxloc1_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 maxval;
+  maxval = -GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > maxval)
+    {
+      maxval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c
index 8de42dfed95cba21ea3740d2d988a469096ad2b8..a7dd5ca1c0e65ab728e9b95c3a21b235b362982d 100644
--- a/libgfortran/generated/maxloc1_8_r4.c
+++ b/libgfortran/generated/maxloc1_8_r4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void maxloc1_8_r4 (gfc_array_i8 *, gfc_array_r4 *, index_type *);
 export_proto(maxloc1_8_r4);
 
@@ -341,3 +344,4 @@ mmaxloc1_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c
index 8b22fdb7cbcd240d7cf01468066050f3c20e61eb..188a4105a5c0a897fc112186fc19580de45f284d 100644
--- a/libgfortran/generated/maxloc1_8_r8.c
+++ b/libgfortran/generated/maxloc1_8_r8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void maxloc1_8_r8 (gfc_array_i8 *, gfc_array_r8 *, index_type *);
 export_proto(maxloc1_8_r8);
 
@@ -341,3 +344,4 @@ mmaxloc1_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..cdcfe0207274feaa4c665c800a4585dbe59d34d3
--- /dev/null
+++ b/libgfortran/generated/maxval_i16.c
@@ -0,0 +1,336 @@
+/* Implementation of the MAXVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void maxval_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(maxval_i16);
+
+void
+maxval_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = -GFC_INTEGER_16_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_INTEGER_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxval_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxval_i16);
+
+void
+mmaxval_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = -GFC_INTEGER_16_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_INTEGER_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c
index 2c82e335fa0d5b7ce1ab620960eb85dfee33591d..5f1ba4d65b1516e5f226eef7e2ce43dd5dacdfda 100644
--- a/libgfortran/generated/maxval_i4.c
+++ b/libgfortran/generated/maxval_i4.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void maxval_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(maxval_i4);
 
@@ -330,3 +333,4 @@ mmaxval_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c
index 941032611140bd3c9ac4cdb1d9eef2cd3ea63607..f1d16f3b389870efc57b28fba08e42e7ea475652 100644
--- a/libgfortran/generated/maxval_i8.c
+++ b/libgfortran/generated/maxval_i8.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void maxval_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(maxval_i8);
 
@@ -330,3 +333,4 @@ mmaxval_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..07c7d7d462a4b066156df3ac06f1fcd24593955e
--- /dev/null
+++ b/libgfortran/generated/maxval_r10.c
@@ -0,0 +1,336 @@
+/* Implementation of the MAXVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10)
+
+
+extern void maxval_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *);
+export_proto(maxval_r10);
+
+void
+maxval_r10 (gfc_array_r10 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_REAL_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_REAL_10 result;
+      src = base;
+      {
+
+  result = -GFC_REAL_10_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_REAL_10_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxval_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxval_r10);
+
+void
+mmaxval_r10 (gfc_array_r10 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = -GFC_REAL_10_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_REAL_10_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..0f8f246fb176d75131b645d75dfffe51d3333ffd
--- /dev/null
+++ b/libgfortran/generated/maxval_r16.c
@@ -0,0 +1,336 @@
+/* Implementation of the MAXVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16)
+
+
+extern void maxval_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *);
+export_proto(maxval_r16);
+
+void
+maxval_r16 (gfc_array_r16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_REAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_REAL_16 result;
+      src = base;
+      {
+
+  result = -GFC_REAL_16_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_REAL_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src > result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mmaxval_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mmaxval_r16);
+
+void
+mmaxval_r16 (gfc_array_r16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = -GFC_REAL_16_HUGE;
+        if (len <= 0)
+	  *dest = -GFC_REAL_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src > result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c
index 6e4236caebd60afbc5370f3977289ddf23487f2b..4d56bbf5b163f90f073ed2f31e6dcb42890f56cd 100644
--- a/libgfortran/generated/maxval_r4.c
+++ b/libgfortran/generated/maxval_r4.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)
+
+
 extern void maxval_r4 (gfc_array_r4 *, gfc_array_r4 *, index_type *);
 export_proto(maxval_r4);
 
@@ -330,3 +333,4 @@ mmaxval_r4 (gfc_array_r4 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c
index 2d8eb2d62999bbc04455d93196411bd0070ba4ff..d84e18ccd0cfeeead8ff29263040b5b4cf7938c4 100644
--- a/libgfortran/generated/maxval_r8.c
+++ b/libgfortran/generated/maxval_r8.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8)
+
+
 extern void maxval_r8 (gfc_array_r8 *, gfc_array_r8 *, index_type *);
 export_proto(maxval_r8);
 
@@ -330,3 +333,4 @@ mmaxval_r8 (gfc_array_r8 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc0_16_i16.c b/libgfortran/generated/minloc0_16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..af097faad01d325be74af66428d611ac0bdb8f1f
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array);
+export_proto(minloc0_16_i16);
+
+void
+minloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_i16 (gfc_array_i16 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mminloc0_16_i16);
+
+void
+mminloc0_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_i4.c b/libgfortran/generated/minloc0_16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..156938158fe6b6864882c472a95111d20d6f59a9
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_i4.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array);
+export_proto(minloc0_16_i4);
+
+void
+minloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_4 minval;
+
+  minval = GFC_INTEGER_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_i4 (gfc_array_i16 *, gfc_array_i4 *, gfc_array_l4 *);
+export_proto(mminloc0_16_i4);
+
+void
+mminloc0_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_4 minval;
+
+  minval = GFC_INTEGER_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_i8.c b/libgfortran/generated/minloc0_16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..57af8927c5b9c92c5424dd4ae552a66b53b5b438
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_i8.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array);
+export_proto(minloc0_16_i8);
+
+void
+minloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_8 minval;
+
+  minval = GFC_INTEGER_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_i8 (gfc_array_i16 *, gfc_array_i8 *, gfc_array_l4 *);
+export_proto(mminloc0_16_i8);
+
+void
+mminloc0_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_8 minval;
+
+  minval = GFC_INTEGER_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_r10.c b/libgfortran/generated/minloc0_16_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..58ed79d5fef92055b3ca4521dabfa8c142f4fe4e
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array);
+export_proto(minloc0_16_r10);
+
+void
+minloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_r10 (gfc_array_i16 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mminloc0_16_r10);
+
+void
+mminloc0_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_r16.c b/libgfortran/generated/minloc0_16_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..90c8c311df779b086824a2e7257572eeb19f6bd3
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array);
+export_proto(minloc0_16_r16);
+
+void
+minloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_r16 (gfc_array_i16 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mminloc0_16_r16);
+
+void
+mminloc0_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_r4.c b/libgfortran/generated/minloc0_16_r4.c
new file mode 100644
index 0000000000000000000000000000000000000000..6fba3ddd12b6071017a915dcbe92460ede3646de
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_r4.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array);
+export_proto(minloc0_16_r4);
+
+void
+minloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_4 minval;
+
+  minval = GFC_REAL_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_r4 (gfc_array_i16 *, gfc_array_r4 *, gfc_array_l4 *);
+export_proto(mminloc0_16_r4);
+
+void
+mminloc0_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_4 minval;
+
+  minval = GFC_REAL_4_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_16_r8.c b/libgfortran/generated/minloc0_16_r8.c
new file mode 100644
index 0000000000000000000000000000000000000000..37b9e178e1129a477f1ee851b49a9bfd96f1a01c
--- /dev/null
+++ b/libgfortran/generated/minloc0_16_r8.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array);
+export_proto(minloc0_16_r8);
+
+void
+minloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_8 minval;
+
+  minval = GFC_REAL_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_16_r8 (gfc_array_i16 *, gfc_array_r8 *, gfc_array_l4 *);
+export_proto(mminloc0_16_r8);
+
+void
+mminloc0_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_8 minval;
+
+  minval = GFC_REAL_8_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_i16.c b/libgfortran/generated/minloc0_4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..068bbd5137c80abd863615b86a95cf7828895d41
--- /dev/null
+++ b/libgfortran/generated/minloc0_4_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array);
+export_proto(minloc0_4_i16);
+
+void
+minloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_4_i16 (gfc_array_i4 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mminloc0_4_i16);
+
+void
+mminloc0_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_i4.c b/libgfortran/generated/minloc0_4_i4.c
index 3b82c89a573f18cdc054c90195d04e05631be092..e3b15ae895b804f04992dcf492493754bf278e27 100644
--- a/libgfortran/generated/minloc0_4_i4.c
+++ b/libgfortran/generated/minloc0_4_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void minloc0_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 *array);
 export_proto(minloc0_4_i4);
@@ -286,3 +288,5 @@ mminloc0_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_i8.c b/libgfortran/generated/minloc0_4_i8.c
index 98c56499f225ebc7baae40ca0c1fca843244e7e4..a0214913eb19450f9bc86e3d739ae68afd8534a6 100644
--- a/libgfortran/generated/minloc0_4_i8.c
+++ b/libgfortran/generated/minloc0_4_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void minloc0_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 *array);
 export_proto(minloc0_4_i8);
@@ -286,3 +288,5 @@ mminloc0_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_r10.c b/libgfortran/generated/minloc0_4_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..3f5ddd95d2e117a2e11c54e5e64a56e8acbb6d02
--- /dev/null
+++ b/libgfortran/generated/minloc0_4_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array);
+export_proto(minloc0_4_r10);
+
+void
+minloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_4_r10 (gfc_array_i4 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mminloc0_4_r10);
+
+void
+mminloc0_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_r16.c b/libgfortran/generated/minloc0_4_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..82c5f6a01b26bf4ccbd88e781d2d7f52195671ad
--- /dev/null
+++ b/libgfortran/generated/minloc0_4_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array);
+export_proto(minloc0_4_r16);
+
+void
+minloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_4_r16 (gfc_array_i4 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mminloc0_4_r16);
+
+void
+mminloc0_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_4) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_r4.c b/libgfortran/generated/minloc0_4_r4.c
index c5f9a3796ee590551fe953e5a75c240184a0cc91..f8cce29a119f2b404a7b428586d1945b01cc4eb4 100644
--- a/libgfortran/generated/minloc0_4_r4.c
+++ b/libgfortran/generated/minloc0_4_r4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void minloc0_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 *array);
 export_proto(minloc0_4_r4);
@@ -286,3 +288,5 @@ mminloc0_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_4_r8.c b/libgfortran/generated/minloc0_4_r8.c
index d9d51b2beffc49fa14079bc6004b523099c2f70c..dbfa667abad6749c1d00cdd9812a5dd94bf1f0e9 100644
--- a/libgfortran/generated/minloc0_4_r8.c
+++ b/libgfortran/generated/minloc0_4_r8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_4)
+
 
 extern void minloc0_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 *array);
 export_proto(minloc0_4_r8);
@@ -286,3 +288,5 @@ mminloc0_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_i16.c b/libgfortran/generated/minloc0_8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..8fabf52e46e5958315a094be7247e16762960f65
--- /dev/null
+++ b/libgfortran/generated/minloc0_8_i16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array);
+export_proto(minloc0_8_i16);
+
+void
+minloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_8_i16 (gfc_array_i8 *, gfc_array_i16 *, gfc_array_l4 *);
+export_proto(mminloc0_8_i16);
+
+void
+mminloc0_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_INTEGER_16 minval;
+
+  minval = GFC_INTEGER_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_i4.c b/libgfortran/generated/minloc0_8_i4.c
index 9d7abfa4fd92094ba2c39c4e07d9e17e07d13821..49fe0f4b36e6e8d6307ae2ed51b8d3fc29e5db7b 100644
--- a/libgfortran/generated/minloc0_8_i4.c
+++ b/libgfortran/generated/minloc0_8_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void minloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array);
 export_proto(minloc0_8_i4);
@@ -286,3 +288,5 @@ mminloc0_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_i8.c b/libgfortran/generated/minloc0_8_i8.c
index bfeda2625274519897e8dd60911ad610cf56c70d..d4327f05546fa045126b93b6963bb4c571cf79be 100644
--- a/libgfortran/generated/minloc0_8_i8.c
+++ b/libgfortran/generated/minloc0_8_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void minloc0_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 *array);
 export_proto(minloc0_8_i8);
@@ -286,3 +288,5 @@ mminloc0_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_r10.c b/libgfortran/generated/minloc0_8_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..2cd231b387a7036ae56f6043d4a4ff9ddc569613
--- /dev/null
+++ b/libgfortran/generated/minloc0_8_r10.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array);
+export_proto(minloc0_8_r10);
+
+void
+minloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_10 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_8_r10 (gfc_array_i8 *, gfc_array_r10 *, gfc_array_l4 *);
+export_proto(mminloc0_8_r10);
+
+void
+mminloc0_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_10 minval;
+
+  minval = GFC_REAL_10_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_r16.c b/libgfortran/generated/minloc0_8_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..ff5925bd8eb58806ff71daf171f428973ebf9891
--- /dev/null
+++ b/libgfortran/generated/minloc0_8_r16.c
@@ -0,0 +1,292 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array);
+export_proto(minloc0_8_r16);
+
+void
+minloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_REAL_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+            }
+        }
+    }
+  }
+}
+
+
+extern void mminloc0_8_r16 (gfc_array_i8 *, gfc_array_r16 *, gfc_array_l4 *);
+export_proto(mminloc0_8_r16);
+
+void
+mminloc0_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 *array,
+				  gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  index_type dstride;
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  index_type n;
+
+  rank = GFC_DESCRIPTOR_RANK (array);
+  if (rank <= 0)
+    runtime_error ("Rank of array needs to be > 0");
+
+  if (retarray->data == NULL)
+    {
+      retarray->dim[0].lbound = 0;
+      retarray->dim[0].ubound = rank-1;
+      retarray->dim[0].stride = 1;
+      retarray->dtype = (retarray->dtype & ~GFC_DTYPE_RANK_MASK) | 1;
+      retarray->offset = 0;
+      retarray->data = internal_malloc_size (sizeof (GFC_INTEGER_8) * rank);
+    }
+  else
+    {
+      if (GFC_DESCRIPTOR_RANK (retarray) != 1)
+	runtime_error ("rank of return array does not equal 1");
+
+      if (retarray->dim[0].ubound + 1 - retarray->dim[0].lbound != rank)
+        runtime_error ("dimension of return array incorrect");
+
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+    }
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  dstride = retarray->dim[0].stride;
+  dest = retarray->data;
+  for (n = 0; n < rank; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+      count[n] = 0;
+      if (extent[n] <= 0)
+	{
+	  /* Set the return value.  */
+	  for (n = 0; n < rank; n++)
+	    dest[n * dstride] = 0;
+	  return;
+	}
+    }
+
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+
+  /* Initialize the return value.  */
+  for (n = 0; n < rank; n++)
+    dest[n * dstride] = 1;
+  {
+
+  GFC_REAL_16 minval;
+
+  minval = GFC_REAL_16_HUGE;
+
+  while (base)
+    {
+      {
+        /* Implementation start.  */
+
+  if (*mbase && *base < minval)
+    {
+      minval = *base;
+      for (n = 0; n < rank; n++)
+        dest[n * dstride] = count[n] + 1;
+    }
+        /* Implementation end.  */
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the loop.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+            }
+        }
+    }
+  }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_r4.c b/libgfortran/generated/minloc0_8_r4.c
index 1b1d57bc9f05d9ebb045999b5993f1d0d6f7e147..a522c75516252f847809c34f3f29cfe3cefc5540 100644
--- a/libgfortran/generated/minloc0_8_r4.c
+++ b/libgfortran/generated/minloc0_8_r4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void minloc0_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 *array);
 export_proto(minloc0_8_r4);
@@ -286,3 +288,5 @@ mminloc0_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc0_8_r8.c b/libgfortran/generated/minloc0_8_r8.c
index c7a276979db2e7284f69d72ad3a243aaeb5f80a5..ba3cfe625ee36f7546526e028f854ab80902bfce 100644
--- a/libgfortran/generated/minloc0_8_r8.c
+++ b/libgfortran/generated/minloc0_8_r8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_8)
+
 
 extern void minloc0_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 *array);
 export_proto(minloc0_8_r8);
@@ -286,3 +288,5 @@ mminloc0_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 *array,
     }
   }
 }
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..906030c9b6dbc74f16b481f7ffa07ede8dfd5c33
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(minloc1_16_i16);
+
+void
+minloc1_16_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_i16);
+
+void
+mminloc1_16_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..b7fe1a0843f7f535f7989ab9f839a60839964800
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_i4.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_i4 (gfc_array_i16 *, gfc_array_i4 *, index_type *);
+export_proto(minloc1_16_i4);
+
+void
+minloc1_16_i4 (gfc_array_i16 *retarray, gfc_array_i4 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_4 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_4 minval;
+  minval = GFC_INTEGER_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_i4 (gfc_array_i16 *, gfc_array_i4 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_i4);
+
+void
+mminloc1_16_i4 (gfc_array_i16 * retarray, gfc_array_i4 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_4 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_4 minval;
+  minval = GFC_INTEGER_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..20c17f2a9cbd8880f9601ffdb03b5e878cc7ca4a
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_i8.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_i8 (gfc_array_i16 *, gfc_array_i8 *, index_type *);
+export_proto(minloc1_16_i8);
+
+void
+minloc1_16_i8 (gfc_array_i16 *retarray, gfc_array_i8 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_8 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_INTEGER_8 minval;
+  minval = GFC_INTEGER_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_i8 (gfc_array_i16 *, gfc_array_i8 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_i8);
+
+void
+mminloc1_16_i8 (gfc_array_i16 * retarray, gfc_array_i8 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_8 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_8 minval;
+  minval = GFC_INTEGER_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..48519c2697e8074bce113d37453ff03a5f37d9e8
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_r10 (gfc_array_i16 *, gfc_array_r10 *, index_type *);
+export_proto(minloc1_16_r10);
+
+void
+minloc1_16_r10 (gfc_array_i16 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_r10 (gfc_array_i16 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_r10);
+
+void
+mminloc1_16_r10 (gfc_array_i16 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..41fed8a3067a4bb496bdd9a1bdc61e3b1f1455fa
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_r16 (gfc_array_i16 *, gfc_array_r16 *, index_type *);
+export_proto(minloc1_16_r16);
+
+void
+minloc1_16_r16 (gfc_array_i16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_r16 (gfc_array_i16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_r16);
+
+void
+mminloc1_16_r16 (gfc_array_i16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c
new file mode 100644
index 0000000000000000000000000000000000000000..b3a4017a9f77b8baadf90fb07d0f7f1765f74cec
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_r4.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_r4 (gfc_array_i16 *, gfc_array_r4 *, index_type *);
+export_proto(minloc1_16_r4);
+
+void
+minloc1_16_r4 (gfc_array_i16 *retarray, gfc_array_r4 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_4 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_4 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_4 minval;
+  minval = GFC_REAL_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_r4 (gfc_array_i16 *, gfc_array_r4 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_r4);
+
+void
+mminloc1_16_r4 (gfc_array_i16 * retarray, gfc_array_r4 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_4 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_4 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_4 minval;
+  minval = GFC_REAL_4_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c
new file mode 100644
index 0000000000000000000000000000000000000000..a9a0267aa5abe5e5e216ea0a589124a7278848de
--- /dev/null
+++ b/libgfortran/generated/minloc1_16_r8.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minloc1_16_r8 (gfc_array_i16 *, gfc_array_r8 *, index_type *);
+export_proto(minloc1_16_r8);
+
+void
+minloc1_16_r8 (gfc_array_i16 *retarray, gfc_array_r8 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_8 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_8 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  GFC_REAL_8 minval;
+  minval = GFC_REAL_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_16_r8 (gfc_array_i16 *, gfc_array_r8 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_16_r8);
+
+void
+mminloc1_16_r8 (gfc_array_i16 * retarray, gfc_array_r8 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_REAL_8 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_8 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_8 minval;
+  minval = GFC_REAL_8_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_16)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..3446a1a585c16ed161c58d7cfcd12dfdd756cb07
--- /dev/null
+++ b/libgfortran/generated/minloc1_4_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc1_4_i16 (gfc_array_i4 *, gfc_array_i16 *, index_type *);
+export_proto(minloc1_4_i16);
+
+void
+minloc1_4_i16 (gfc_array_i4 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_4_i16 (gfc_array_i4 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_4_i16);
+
+void
+mminloc1_4_i16 (gfc_array_i4 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c
index 2aa1d4d057b3379f0c66a8a30b4ffcac1284ffbe..f7207192b1c2396a714c0e9f4d32acf7d8c6e775 100644
--- a/libgfortran/generated/minloc1_4_i4.c
+++ b/libgfortran/generated/minloc1_4_i4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void minloc1_4_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(minloc1_4_i4);
 
@@ -341,3 +344,4 @@ mminloc1_4_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c
index 08a74c7e60fc1e49f8fe01391f0a5857774faa98..b049b19d755994599f60001c96e28de2f68cbd5b 100644
--- a/libgfortran/generated/minloc1_4_i8.c
+++ b/libgfortran/generated/minloc1_4_i8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void minloc1_4_i8 (gfc_array_i4 *, gfc_array_i8 *, index_type *);
 export_proto(minloc1_4_i8);
 
@@ -341,3 +344,4 @@ mminloc1_4_i8 (gfc_array_i4 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..983db754f5f637988d0007b90a4478ae8da3257e
--- /dev/null
+++ b/libgfortran/generated/minloc1_4_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc1_4_r10 (gfc_array_i4 *, gfc_array_r10 *, index_type *);
+export_proto(minloc1_4_r10);
+
+void
+minloc1_4_r10 (gfc_array_i4 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_4_r10 (gfc_array_i4 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_4_r10);
+
+void
+mminloc1_4_r10 (gfc_array_i4 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..68f142125c9136ece42acb9121eb0e4ef91f1409
--- /dev/null
+++ b/libgfortran/generated/minloc1_4_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+
+extern void minloc1_4_r16 (gfc_array_i4 *, gfc_array_r16 *, index_type *);
+export_proto(minloc1_4_r16);
+
+void
+minloc1_4_r16 (gfc_array_i4 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_4 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_4 result;
+      src = base;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_4_r16 (gfc_array_i4 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_4_r16);
+
+void
+mminloc1_4_r16 (gfc_array_i4 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_4 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_4)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_4 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_4)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c
index 9d0af3bc4be2cb17cf773730d75ea53c36280304..e7191fd4de48564370ac7be102b9eb17a5ae1662 100644
--- a/libgfortran/generated/minloc1_4_r4.c
+++ b/libgfortran/generated/minloc1_4_r4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void minloc1_4_r4 (gfc_array_i4 *, gfc_array_r4 *, index_type *);
 export_proto(minloc1_4_r4);
 
@@ -341,3 +344,4 @@ mminloc1_4_r4 (gfc_array_i4 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c
index de5440b61654cb5d9dec5f17611c908fdf9e7d3b..9d4c981cdc78ba5e3f05595116312af06db49122 100644
--- a/libgfortran/generated/minloc1_4_r8.c
+++ b/libgfortran/generated/minloc1_4_r8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void minloc1_4_r8 (gfc_array_i4 *, gfc_array_r8 *, index_type *);
 export_proto(minloc1_4_r8);
 
@@ -341,3 +344,4 @@ mminloc1_4_r8 (gfc_array_i4 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..13c2cb74a42aee8f259e638f8fb308646f38c562
--- /dev/null
+++ b/libgfortran/generated/minloc1_8_i16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc1_8_i16 (gfc_array_i8 *, gfc_array_i16 *, index_type *);
+export_proto(minloc1_8_i16);
+
+void
+minloc1_8_i16 (gfc_array_i8 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_8_i16 (gfc_array_i8 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_8_i16);
+
+void
+mminloc1_8_i16 (gfc_array_i8 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_INTEGER_16 minval;
+  minval = GFC_INTEGER_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c
index 66699886d74ca6832350d690986ae6a0ba898ec8..f682c10936c3dbe11fccb6f3c72075a338d73068 100644
--- a/libgfortran/generated/minloc1_8_i4.c
+++ b/libgfortran/generated/minloc1_8_i4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void minloc1_8_i4 (gfc_array_i8 *, gfc_array_i4 *, index_type *);
 export_proto(minloc1_8_i4);
 
@@ -341,3 +344,4 @@ mminloc1_8_i4 (gfc_array_i8 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c
index 4adb1492d98c8275fb563a38e02156894dab851b..9a2a5231b5a29cd2982a4cca48ec2d3a5ed0cf97 100644
--- a/libgfortran/generated/minloc1_8_i8.c
+++ b/libgfortran/generated/minloc1_8_i8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void minloc1_8_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(minloc1_8_i8);
 
@@ -341,3 +344,4 @@ mminloc1_8_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..2058453584adb2aa7ccb4fcb28fccd6e2b0eb9a5
--- /dev/null
+++ b/libgfortran/generated/minloc1_8_r10.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc1_8_r10 (gfc_array_i8 *, gfc_array_r10 *, index_type *);
+export_proto(minloc1_8_r10);
+
+void
+minloc1_8_r10 (gfc_array_i8 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_8_r10 (gfc_array_i8 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_8_r10);
+
+void
+mminloc1_8_r10 (gfc_array_i8 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_10 minval;
+  minval = GFC_REAL_10_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..e417f620ba657a4fa8a46e917eabd743f00aad28
--- /dev/null
+++ b/libgfortran/generated/minloc1_8_r16.c
@@ -0,0 +1,347 @@
+/* Implementation of the MINLOC intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include <limits.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+
+extern void minloc1_8_r16 (gfc_array_i8 *, gfc_array_r16 *, index_type *);
+export_proto(minloc1_8_r16);
+
+void
+minloc1_8_r16 (gfc_array_i8 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_INTEGER_8 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_INTEGER_8 result;
+      src = base;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminloc1_8_r16 (gfc_array_i8 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminloc1_8_r16);
+
+void
+mminloc1_8_r16 (gfc_array_i8 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_8 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_8)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_8 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  GFC_REAL_16 minval;
+  minval = GFC_REAL_16_HUGE;
+  result = 1;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < minval)
+    {
+      minval = *src;
+      result = (GFC_INTEGER_8)n + 1;
+    }
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c
index 45cb8343eefcea9006c647dc73bf2c1b95f76889..8f154dce2756d63350fcadbcac34d4e1ab8b4cca 100644
--- a/libgfortran/generated/minloc1_8_r4.c
+++ b/libgfortran/generated/minloc1_8_r4.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void minloc1_8_r4 (gfc_array_i8 *, gfc_array_r4 *, index_type *);
 export_proto(minloc1_8_r4);
 
@@ -341,3 +344,4 @@ mminloc1_8_r4 (gfc_array_i8 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c
index f6c72e49837e70801582c54a9285cc4f7ecc62d8..20a757a9217f4962f97d20ff79f1bb027d90a8e0 100644
--- a/libgfortran/generated/minloc1_8_r8.c
+++ b/libgfortran/generated/minloc1_8_r8.c
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void minloc1_8_r8 (gfc_array_i8 *, gfc_array_r8 *, index_type *);
 export_proto(minloc1_8_r8);
 
@@ -341,3 +344,4 @@ mminloc1_8_r8 (gfc_array_i8 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..34963ae9725b7fb96933d911929f7a8c0eb8b8df
--- /dev/null
+++ b/libgfortran/generated/minval_i16.c
@@ -0,0 +1,336 @@
+/* Implementation of the MINVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void minval_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(minval_i16);
+
+void
+minval_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = GFC_INTEGER_16_HUGE;
+        if (len <= 0)
+	  *dest = GFC_INTEGER_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminval_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminval_i16);
+
+void
+mminval_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = GFC_INTEGER_16_HUGE;
+        if (len <= 0)
+	  *dest = GFC_INTEGER_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c
index 01ef0236efba6d0911b81b376cfb068e856284f2..826d2e902e26485b85bf56deea178455096d680f 100644
--- a/libgfortran/generated/minval_i4.c
+++ b/libgfortran/generated/minval_i4.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void minval_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(minval_i4);
 
@@ -330,3 +333,4 @@ mminval_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c
index 1d7690306256173d073c48cfb801b519589608d5..e58a97ba90d35575758165d811498ba951125913 100644
--- a/libgfortran/generated/minval_i8.c
+++ b/libgfortran/generated/minval_i8.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void minval_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(minval_i8);
 
@@ -330,3 +333,4 @@ mminval_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..ec494fba168272c8441f9b6858d4f9a6cf786b84
--- /dev/null
+++ b/libgfortran/generated/minval_r10.c
@@ -0,0 +1,336 @@
+/* Implementation of the MINVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10)
+
+
+extern void minval_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *);
+export_proto(minval_r10);
+
+void
+minval_r10 (gfc_array_r10 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_REAL_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_REAL_10 result;
+      src = base;
+      {
+
+  result = GFC_REAL_10_HUGE;
+        if (len <= 0)
+	  *dest = GFC_REAL_10_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminval_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminval_r10);
+
+void
+mminval_r10 (gfc_array_r10 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = GFC_REAL_10_HUGE;
+        if (len <= 0)
+	  *dest = GFC_REAL_10_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..d71b00756de39e9ba593393c7caf6c3b16aff1c7
--- /dev/null
+++ b/libgfortran/generated/minval_r16.c
@@ -0,0 +1,336 @@
+/* Implementation of the MINVAL intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16)
+
+
+extern void minval_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *);
+export_proto(minval_r16);
+
+void
+minval_r16 (gfc_array_r16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_REAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_REAL_16 result;
+      src = base;
+      {
+
+  result = GFC_REAL_16_HUGE;
+        if (len <= 0)
+	  *dest = GFC_REAL_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  if (*src < result)
+    result = *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mminval_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mminval_r16);
+
+void
+mminval_r16 (gfc_array_r16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = GFC_REAL_16_HUGE;
+        if (len <= 0)
+	  *dest = GFC_REAL_16_HUGE;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc && *src < result)
+    result = *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c
index c4e303921669f585c1e7e1bd408eb0f1f4ea5951..8228f991fcb7d71edb8ba38b195826282666900b 100644
--- a/libgfortran/generated/minval_r4.c
+++ b/libgfortran/generated/minval_r4.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)
+
+
 extern void minval_r4 (gfc_array_r4 *, gfc_array_r4 *, index_type *);
 export_proto(minval_r4);
 
@@ -330,3 +333,4 @@ mminval_r4 (gfc_array_r4 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c
index de6eea1cd53ee0faa53312a3d2da9701e6b85406..81a8b2127e81100d60c00a50bfc715aeb3b159de 100644
--- a/libgfortran/generated/minval_r8.c
+++ b/libgfortran/generated/minval_r8.c
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8)
+
+
 extern void minval_r8 (gfc_array_r8 *, gfc_array_r8 *, index_type *);
 export_proto(minval_r8);
 
@@ -330,3 +333,4 @@ mminval_r8 (gfc_array_r8 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/nearest_r10.c b/libgfortran/generated/nearest_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..5a02d74a2ed3061c2764522f69d2b170d53f4a32
--- /dev/null
+++ b/libgfortran/generated/nearest_r10.c
@@ -0,0 +1,56 @@
+/* Implementation of the NEAREST intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_COPYSIGNL) && defined (HAVE_NEXTAFTERL)
+
+extern GFC_REAL_10 nearest_r10 (GFC_REAL_10 s, GFC_REAL_10 dir);
+export_proto(nearest_r10);
+
+GFC_REAL_10
+nearest_r10 (GFC_REAL_10 s, GFC_REAL_10 dir)
+{
+  dir = copysignl (__builtin_infl (), dir);
+  if (FLT_EVAL_METHOD != 0)
+    {
+      /* ??? Work around glibc bug on x86.  */
+      volatile GFC_REAL_10 r = nextafterl (s, dir);
+      return r;
+    }
+  else
+    return nextafterl (s, dir);
+}
+
+#endif
diff --git a/libgfortran/generated/nearest_r16.c b/libgfortran/generated/nearest_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..eeb532a52308f082e47fb1e51037df1dd6d71301
--- /dev/null
+++ b/libgfortran/generated/nearest_r16.c
@@ -0,0 +1,56 @@
+/* Implementation of the NEAREST intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include <float.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_COPYSIGNL) && defined (HAVE_NEXTAFTERL)
+
+extern GFC_REAL_16 nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir);
+export_proto(nearest_r16);
+
+GFC_REAL_16
+nearest_r16 (GFC_REAL_16 s, GFC_REAL_16 dir)
+{
+  dir = copysignl (__builtin_infl (), dir);
+  if (FLT_EVAL_METHOD != 0)
+    {
+      /* ??? Work around glibc bug on x86.  */
+      volatile GFC_REAL_16 r = nextafterl (s, dir);
+      return r;
+    }
+  else
+    return nextafterl (s, dir);
+}
+
+#endif
diff --git a/libgfortran/generated/nearest_r4.c b/libgfortran/generated/nearest_r4.c
index 265b6493c78b6bce59adb5bd13e32abd3e3ce0e9..02fd6aa5cb7ff079c699f75951247cb197a07866 100644
--- a/libgfortran/generated/nearest_r4.c
+++ b/libgfortran/generated/nearest_r4.c
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include <float.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_COPYSIGNF) && defined (HAVE_NEXTAFTERF)
+
 extern GFC_REAL_4 nearest_r4 (GFC_REAL_4 s, GFC_REAL_4 dir);
 export_proto(nearest_r4);
 
@@ -48,3 +52,5 @@ nearest_r4 (GFC_REAL_4 s, GFC_REAL_4 dir)
   else
     return nextafterf (s, dir);
 }
+
+#endif
diff --git a/libgfortran/generated/nearest_r8.c b/libgfortran/generated/nearest_r8.c
index 337cce6cae5696d7a0e936f2fafb4f623c6e9dee..e050f74077f7ea3d84ff2fb4e5e0bcbac0d9e088 100644
--- a/libgfortran/generated/nearest_r8.c
+++ b/libgfortran/generated/nearest_r8.c
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include <float.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_COPYSIGN) && defined (HAVE_NEXTAFTER)
+
 extern GFC_REAL_8 nearest_r8 (GFC_REAL_8 s, GFC_REAL_8 dir);
 export_proto(nearest_r8);
 
@@ -48,3 +52,5 @@ nearest_r8 (GFC_REAL_8 s, GFC_REAL_8 dir)
   else
     return nextafter (s, dir);
 }
+
+#endif
diff --git a/libgfortran/generated/pow_c10_i16.c b/libgfortran/generated/pow_c10_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..6332013bdbc59ff77d39e989371931248157f6be
--- /dev/null
+++ b/libgfortran/generated/pow_c10_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_10) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_COMPLEX_10 pow_c10_i16 (GFC_COMPLEX_10 a, GFC_INTEGER_16 b);
+export_proto(pow_c10_i16);
+
+GFC_COMPLEX_10
+pow_c10_i16 (GFC_COMPLEX_10 a, GFC_INTEGER_16 b)
+{
+  GFC_COMPLEX_10 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c10_i4.c b/libgfortran/generated/pow_c10_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..ccb1a0c6a2bdf46ceed39ef570f865ef3efcf0c3
--- /dev/null
+++ b/libgfortran/generated/pow_c10_i4.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_10) && defined (HAVE_GFC_INTEGER_4)
+
+GFC_COMPLEX_10 pow_c10_i4 (GFC_COMPLEX_10 a, GFC_INTEGER_4 b);
+export_proto(pow_c10_i4);
+
+GFC_COMPLEX_10
+pow_c10_i4 (GFC_COMPLEX_10 a, GFC_INTEGER_4 b)
+{
+  GFC_COMPLEX_10 pow, x;
+  GFC_INTEGER_4 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c10_i8.c b/libgfortran/generated/pow_c10_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..0f2b242648112dc5bd0033b5aa701808415e46f2
--- /dev/null
+++ b/libgfortran/generated/pow_c10_i8.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_10) && defined (HAVE_GFC_INTEGER_8)
+
+GFC_COMPLEX_10 pow_c10_i8 (GFC_COMPLEX_10 a, GFC_INTEGER_8 b);
+export_proto(pow_c10_i8);
+
+GFC_COMPLEX_10
+pow_c10_i8 (GFC_COMPLEX_10 a, GFC_INTEGER_8 b)
+{
+  GFC_COMPLEX_10 pow, x;
+  GFC_INTEGER_8 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c16_i16.c b/libgfortran/generated/pow_c16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..a6d888369b2b8f8cca7b6c7b93d5011f71e54c21
--- /dev/null
+++ b/libgfortran/generated/pow_c16_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_16) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_COMPLEX_16 pow_c16_i16 (GFC_COMPLEX_16 a, GFC_INTEGER_16 b);
+export_proto(pow_c16_i16);
+
+GFC_COMPLEX_16
+pow_c16_i16 (GFC_COMPLEX_16 a, GFC_INTEGER_16 b)
+{
+  GFC_COMPLEX_16 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c16_i4.c b/libgfortran/generated/pow_c16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..d3960520cf99b2751f6abc842d686e22a876293a
--- /dev/null
+++ b/libgfortran/generated/pow_c16_i4.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_16) && defined (HAVE_GFC_INTEGER_4)
+
+GFC_COMPLEX_16 pow_c16_i4 (GFC_COMPLEX_16 a, GFC_INTEGER_4 b);
+export_proto(pow_c16_i4);
+
+GFC_COMPLEX_16
+pow_c16_i4 (GFC_COMPLEX_16 a, GFC_INTEGER_4 b)
+{
+  GFC_COMPLEX_16 pow, x;
+  GFC_INTEGER_4 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c16_i8.c b/libgfortran/generated/pow_c16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..0a0e94d061313802ec6a99b41dd9a6e769c70fbb
--- /dev/null
+++ b/libgfortran/generated/pow_c16_i8.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_16) && defined (HAVE_GFC_INTEGER_8)
+
+GFC_COMPLEX_16 pow_c16_i8 (GFC_COMPLEX_16 a, GFC_INTEGER_8 b);
+export_proto(pow_c16_i8);
+
+GFC_COMPLEX_16
+pow_c16_i8 (GFC_COMPLEX_16 a, GFC_INTEGER_8 b)
+{
+  GFC_COMPLEX_16 pow, x;
+  GFC_INTEGER_8 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c4_i16.c b/libgfortran/generated/pow_c4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..1085ad21caf9cc9c93e9298dc44545fb9a455dcd
--- /dev/null
+++ b/libgfortran/generated/pow_c4_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_4) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_COMPLEX_4 pow_c4_i16 (GFC_COMPLEX_4 a, GFC_INTEGER_16 b);
+export_proto(pow_c4_i16);
+
+GFC_COMPLEX_4
+pow_c4_i16 (GFC_COMPLEX_4 a, GFC_INTEGER_16 b)
+{
+  GFC_COMPLEX_4 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c4_i4.c b/libgfortran/generated/pow_c4_i4.c
index a25607e570b2282719a39c4b30518fdafdb244c2..ca376710fba8555076b1cbd2c7d5bcef7837510d 100644
--- a/libgfortran/generated/pow_c4_i4.c
+++ b/libgfortran/generated/pow_c4_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_COMPLEX_4) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_COMPLEX_4 pow_c4_i4 (GFC_COMPLEX_4 a, GFC_INTEGER_4 b);
 export_proto(pow_c4_i4);
 
@@ -70,3 +72,5 @@ pow_c4_i4 (GFC_COMPLEX_4 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_c4_i8.c b/libgfortran/generated/pow_c4_i8.c
index a6098365d298e2b936ff8ba6ad28c59137b26d62..f9fc849ca19d05287aa7f4b819b53b7d70a82245 100644
--- a/libgfortran/generated/pow_c4_i8.c
+++ b/libgfortran/generated/pow_c4_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_COMPLEX_4) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_COMPLEX_4 pow_c4_i8 (GFC_COMPLEX_4 a, GFC_INTEGER_8 b);
 export_proto(pow_c4_i8);
 
@@ -70,3 +72,5 @@ pow_c4_i8 (GFC_COMPLEX_4 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_c8_i16.c b/libgfortran/generated/pow_c8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..0fc162b5014b99df66cae80d18aab6df8813e221
--- /dev/null
+++ b/libgfortran/generated/pow_c8_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_COMPLEX_8) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_COMPLEX_8 pow_c8_i16 (GFC_COMPLEX_8 a, GFC_INTEGER_16 b);
+export_proto(pow_c8_i16);
+
+GFC_COMPLEX_8
+pow_c8_i16 (GFC_COMPLEX_8 a, GFC_INTEGER_16 b)
+{
+  GFC_COMPLEX_8 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_c8_i4.c b/libgfortran/generated/pow_c8_i4.c
index e205998b57edf648842fcffd468bc2894b19f54a..64b4b3c5b698dbe4c47d88e46981fe9a71787d3a 100644
--- a/libgfortran/generated/pow_c8_i4.c
+++ b/libgfortran/generated/pow_c8_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_COMPLEX_8) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_COMPLEX_8 pow_c8_i4 (GFC_COMPLEX_8 a, GFC_INTEGER_4 b);
 export_proto(pow_c8_i4);
 
@@ -70,3 +72,5 @@ pow_c8_i4 (GFC_COMPLEX_8 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_c8_i8.c b/libgfortran/generated/pow_c8_i8.c
index 922fbffdb29281e00720fba6c80fc0868ace3d22..39a5d6b71e0ba8608387499a0ffefcfb5b5c8917 100644
--- a/libgfortran/generated/pow_c8_i8.c
+++ b/libgfortran/generated/pow_c8_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_COMPLEX_8) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_COMPLEX_8 pow_c8_i8 (GFC_COMPLEX_8 a, GFC_INTEGER_8 b);
 export_proto(pow_c8_i8);
 
@@ -70,3 +72,5 @@ pow_c8_i8 (GFC_COMPLEX_8 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_i16_i16.c b/libgfortran/generated/pow_i16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..eda2fb6dc7c87119778891f20f48272afc73fcd7
--- /dev/null
+++ b/libgfortran/generated/pow_i16_i16.c
@@ -0,0 +1,78 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_INTEGER_16 pow_i16_i16 (GFC_INTEGER_16 a, GFC_INTEGER_16 b);
+export_proto(pow_i16_i16);
+
+GFC_INTEGER_16
+pow_i16_i16 (GFC_INTEGER_16 a, GFC_INTEGER_16 b)
+{
+  GFC_INTEGER_16 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+	  if (x == 1)
+	    return 1;
+	  if (x == -1)
+	    return (n & 1) ? -1 : 1;
+	  return (x == 0) ? 1 / x : 0;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_i16_i4.c b/libgfortran/generated/pow_i16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..6e4d65c35c4306b294b6b2b1893c6c5bab0efe88
--- /dev/null
+++ b/libgfortran/generated/pow_i16_i4.c
@@ -0,0 +1,78 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_4)
+
+GFC_INTEGER_16 pow_i16_i4 (GFC_INTEGER_16 a, GFC_INTEGER_4 b);
+export_proto(pow_i16_i4);
+
+GFC_INTEGER_16
+pow_i16_i4 (GFC_INTEGER_16 a, GFC_INTEGER_4 b)
+{
+  GFC_INTEGER_16 pow, x;
+  GFC_INTEGER_4 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+	  if (x == 1)
+	    return 1;
+	  if (x == -1)
+	    return (n & 1) ? -1 : 1;
+	  return (x == 0) ? 1 / x : 0;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_i16_i8.c b/libgfortran/generated/pow_i16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..d1849511a2971a393d4b731bb1d23e73ef014591
--- /dev/null
+++ b/libgfortran/generated/pow_i16_i8.c
@@ -0,0 +1,78 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_8)
+
+GFC_INTEGER_16 pow_i16_i8 (GFC_INTEGER_16 a, GFC_INTEGER_8 b);
+export_proto(pow_i16_i8);
+
+GFC_INTEGER_16
+pow_i16_i8 (GFC_INTEGER_16 a, GFC_INTEGER_8 b)
+{
+  GFC_INTEGER_16 pow, x;
+  GFC_INTEGER_8 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+	  if (x == 1)
+	    return 1;
+	  if (x == -1)
+	    return (n & 1) ? -1 : 1;
+	  return (x == 0) ? 1 / x : 0;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_i4_i16.c b/libgfortran/generated/pow_i4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..f515f80359eaaaf3af477bf180caab9dafb7c895
--- /dev/null
+++ b/libgfortran/generated/pow_i4_i16.c
@@ -0,0 +1,78 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_INTEGER_4 pow_i4_i16 (GFC_INTEGER_4 a, GFC_INTEGER_16 b);
+export_proto(pow_i4_i16);
+
+GFC_INTEGER_4
+pow_i4_i16 (GFC_INTEGER_4 a, GFC_INTEGER_16 b)
+{
+  GFC_INTEGER_4 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+	  if (x == 1)
+	    return 1;
+	  if (x == -1)
+	    return (n & 1) ? -1 : 1;
+	  return (x == 0) ? 1 / x : 0;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_i4_i4.c b/libgfortran/generated/pow_i4_i4.c
index 86b49f7f3e08bdd7596e69fe78209d0d8ca895eb..184fe6d986e2e41c96fc864c400e0e316e2851f8 100644
--- a/libgfortran/generated/pow_i4_i4.c
+++ b/libgfortran/generated/pow_i4_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_INTEGER_4 pow_i4_i4 (GFC_INTEGER_4 a, GFC_INTEGER_4 b);
 export_proto(pow_i4_i4);
 
@@ -72,3 +74,5 @@ pow_i4_i4 (GFC_INTEGER_4 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_i4_i8.c b/libgfortran/generated/pow_i4_i8.c
index 5353f78a23a154feba08d97b32db3bb21f17103f..ae24ceb54c2b8de6ed712df2ab8013f6bfb3ca7b 100644
--- a/libgfortran/generated/pow_i4_i8.c
+++ b/libgfortran/generated/pow_i4_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_INTEGER_4 pow_i4_i8 (GFC_INTEGER_4 a, GFC_INTEGER_8 b);
 export_proto(pow_i4_i8);
 
@@ -72,3 +74,5 @@ pow_i4_i8 (GFC_INTEGER_4 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_i8_i16.c b/libgfortran/generated/pow_i8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..456c28a95bdfb581eafa620d05bb5499b8173955
--- /dev/null
+++ b/libgfortran/generated/pow_i8_i16.c
@@ -0,0 +1,78 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_INTEGER_8 pow_i8_i16 (GFC_INTEGER_8 a, GFC_INTEGER_16 b);
+export_proto(pow_i8_i16);
+
+GFC_INTEGER_8
+pow_i8_i16 (GFC_INTEGER_8 a, GFC_INTEGER_16 b)
+{
+  GFC_INTEGER_8 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+	  if (x == 1)
+	    return 1;
+	  if (x == -1)
+	    return (n & 1) ? -1 : 1;
+	  return (x == 0) ? 1 / x : 0;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_i8_i4.c b/libgfortran/generated/pow_i8_i4.c
index e0b6320be013f8c1da5641a47844d1c48497a6dd..8f85a80c81cbbf6ad84fe2a2b0652c8a048f9d2c 100644
--- a/libgfortran/generated/pow_i8_i4.c
+++ b/libgfortran/generated/pow_i8_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_INTEGER_8 pow_i8_i4 (GFC_INTEGER_8 a, GFC_INTEGER_4 b);
 export_proto(pow_i8_i4);
 
@@ -72,3 +74,5 @@ pow_i8_i4 (GFC_INTEGER_8 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_i8_i8.c b/libgfortran/generated/pow_i8_i8.c
index 5468259a7678217838360559bfd7d685afa76789..8c8f52e541219bc28ce7979a947553399d7e83da 100644
--- a/libgfortran/generated/pow_i8_i8.c
+++ b/libgfortran/generated/pow_i8_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_INTEGER_8 pow_i8_i8 (GFC_INTEGER_8 a, GFC_INTEGER_8 b);
 export_proto(pow_i8_i8);
 
@@ -72,3 +74,5 @@ pow_i8_i8 (GFC_INTEGER_8 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_r10_i16.c b/libgfortran/generated/pow_r10_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..ad736641adc9694bf653fae859b859b8aa7aee97
--- /dev/null
+++ b/libgfortran/generated/pow_r10_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_REAL_10 pow_r10_i16 (GFC_REAL_10 a, GFC_INTEGER_16 b);
+export_proto(pow_r10_i16);
+
+GFC_REAL_10
+pow_r10_i16 (GFC_REAL_10 a, GFC_INTEGER_16 b)
+{
+  GFC_REAL_10 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r10_i4.c b/libgfortran/generated/pow_r10_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..3f2373243b446a5c5a4f530c664ced53e3a8d5cd
--- /dev/null
+++ b/libgfortran/generated/pow_r10_i4.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_4)
+
+GFC_REAL_10 pow_r10_i4 (GFC_REAL_10 a, GFC_INTEGER_4 b);
+export_proto(pow_r10_i4);
+
+GFC_REAL_10
+pow_r10_i4 (GFC_REAL_10 a, GFC_INTEGER_4 b)
+{
+  GFC_REAL_10 pow, x;
+  GFC_INTEGER_4 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r10_i8.c b/libgfortran/generated/pow_r10_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..2e99c600bea822861794338f71aadf03d703c5dd
--- /dev/null
+++ b/libgfortran/generated/pow_r10_i8.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_INTEGER_8)
+
+GFC_REAL_10 pow_r10_i8 (GFC_REAL_10 a, GFC_INTEGER_8 b);
+export_proto(pow_r10_i8);
+
+GFC_REAL_10
+pow_r10_i8 (GFC_REAL_10 a, GFC_INTEGER_8 b)
+{
+  GFC_REAL_10 pow, x;
+  GFC_INTEGER_8 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r16_i16.c b/libgfortran/generated/pow_r16_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..63d6fa886f215a7c0163f340231ce18e5e5c6545
--- /dev/null
+++ b/libgfortran/generated/pow_r16_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_REAL_16 pow_r16_i16 (GFC_REAL_16 a, GFC_INTEGER_16 b);
+export_proto(pow_r16_i16);
+
+GFC_REAL_16
+pow_r16_i16 (GFC_REAL_16 a, GFC_INTEGER_16 b)
+{
+  GFC_REAL_16 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r16_i4.c b/libgfortran/generated/pow_r16_i4.c
new file mode 100644
index 0000000000000000000000000000000000000000..949f23717491804c8a09d6511554a68759922996
--- /dev/null
+++ b/libgfortran/generated/pow_r16_i4.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_4)
+
+GFC_REAL_16 pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b);
+export_proto(pow_r16_i4);
+
+GFC_REAL_16
+pow_r16_i4 (GFC_REAL_16 a, GFC_INTEGER_4 b)
+{
+  GFC_REAL_16 pow, x;
+  GFC_INTEGER_4 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r16_i8.c b/libgfortran/generated/pow_r16_i8.c
new file mode 100644
index 0000000000000000000000000000000000000000..37649d82cb18988cb4ec4fb96ecf79eeb42e9313
--- /dev/null
+++ b/libgfortran/generated/pow_r16_i8.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_INTEGER_8)
+
+GFC_REAL_16 pow_r16_i8 (GFC_REAL_16 a, GFC_INTEGER_8 b);
+export_proto(pow_r16_i8);
+
+GFC_REAL_16
+pow_r16_i8 (GFC_REAL_16 a, GFC_INTEGER_8 b)
+{
+  GFC_REAL_16 pow, x;
+  GFC_INTEGER_8 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r4_i16.c b/libgfortran/generated/pow_r4_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..635e627e9d64892de6bca1c3a6e6be2b0a05c4b1
--- /dev/null
+++ b/libgfortran/generated/pow_r4_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_REAL_4 pow_r4_i16 (GFC_REAL_4 a, GFC_INTEGER_16 b);
+export_proto(pow_r4_i16);
+
+GFC_REAL_4
+pow_r4_i16 (GFC_REAL_4 a, GFC_INTEGER_16 b)
+{
+  GFC_REAL_4 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r4_i4.c b/libgfortran/generated/pow_r4_i4.c
index 48c4f42530030cb1d4ef6953717060faf4a148f4..ff0045f913ba66bd378db4cd82befd98b47cdb42 100644
--- a/libgfortran/generated/pow_r4_i4.c
+++ b/libgfortran/generated/pow_r4_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_REAL_4 pow_r4_i4 (GFC_REAL_4 a, GFC_INTEGER_4 b);
 export_proto(pow_r4_i4);
 
@@ -70,3 +72,5 @@ pow_r4_i4 (GFC_REAL_4 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_r4_i8.c b/libgfortran/generated/pow_r4_i8.c
index f5a8ba27fad7967c737ca284fc52c097a7996576..8c6b2ba285f8b3b0df5b3fec3ffb6cd0245f2658 100644
--- a/libgfortran/generated/pow_r4_i8.c
+++ b/libgfortran/generated/pow_r4_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_REAL_4 pow_r4_i8 (GFC_REAL_4 a, GFC_INTEGER_8 b);
 export_proto(pow_r4_i8);
 
@@ -70,3 +72,5 @@ pow_r4_i8 (GFC_REAL_4 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_r8_i16.c b/libgfortran/generated/pow_r8_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..9fdcf7592e4e6bef507191a04e58aa2c9bfd6c0b
--- /dev/null
+++ b/libgfortran/generated/pow_r8_i16.c
@@ -0,0 +1,76 @@
+/* Support routines for the intrinsic power (**) operator.
+   Copyright 2004 Free Software Foundation, Inc.
+   Contributed by Paul Brook
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include "libgfortran.h"
+
+/* Use Binary Method to calculate the powi. This is not an optimal but
+   a simple and reasonable arithmetic. See section 4.6.3, "Evaluation of
+   Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
+   of Computer Programming", 3rd Edition, 1998.  */
+
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_16)
+
+GFC_REAL_8 pow_r8_i16 (GFC_REAL_8 a, GFC_INTEGER_16 b);
+export_proto(pow_r8_i16);
+
+GFC_REAL_8
+pow_r8_i16 (GFC_REAL_8 a, GFC_INTEGER_16 b)
+{
+  GFC_REAL_8 pow, x;
+  GFC_INTEGER_16 n, u;
+  
+  n = b;
+  x = a;
+  pow = 1;
+  if (n != 0)
+    {
+      if (n < 0)
+	{
+
+	  n = -n;
+	  x = pow / x;
+	}
+      u = n;
+      for (;;)
+	{
+	  if (u & 1)
+	    pow *= x;
+	  u >>= 1;
+	  if (u)
+	    x *= x;
+	  else
+	    break;
+	}
+    }
+  return pow;
+}
+
+#endif
diff --git a/libgfortran/generated/pow_r8_i4.c b/libgfortran/generated/pow_r8_i4.c
index 20622c6bc65bfb203e550b6f26cc70dba167e77f..a6afcbe6eb42f0a08dc1404dfa857ab8c88410a9 100644
--- a/libgfortran/generated/pow_r8_i4.c
+++ b/libgfortran/generated/pow_r8_i4.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_4)
+
 GFC_REAL_8 pow_r8_i4 (GFC_REAL_8 a, GFC_INTEGER_4 b);
 export_proto(pow_r8_i4);
 
@@ -70,3 +72,5 @@ pow_r8_i4 (GFC_REAL_8 a, GFC_INTEGER_4 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/pow_r8_i8.c b/libgfortran/generated/pow_r8_i8.c
index 3f6002d82c9f93217edcbcf695d28dd8b99b3e20..3b650f2f0735f22ac49a4e451e59fc0a2af3d1e5 100644
--- a/libgfortran/generated/pow_r8_i8.c
+++ b/libgfortran/generated/pow_r8_i8.c
@@ -36,6 +36,8 @@ Boston, MA 02110-1301, USA.  */
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_INTEGER_8)
+
 GFC_REAL_8 pow_r8_i8 (GFC_REAL_8 a, GFC_INTEGER_8 b);
 export_proto(pow_r8_i8);
 
@@ -70,3 +72,5 @@ pow_r8_i8 (GFC_REAL_8 a, GFC_INTEGER_8 b)
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..0313c712626d0b08be4f589a105745c6d3d2918b
--- /dev/null
+++ b/libgfortran/generated/product_c10.c
@@ -0,0 +1,334 @@
+/* Implementation of the PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_COMPLEX_10) && defined (HAVE_GFC_COMPLEX_10)
+
+
+extern void product_c10 (gfc_array_c10 *, gfc_array_c10 *, index_type *);
+export_proto(product_c10);
+
+void
+product_c10 (gfc_array_c10 *retarray, gfc_array_c10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_10 *base;
+  GFC_COMPLEX_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_COMPLEX_10 *src;
+      GFC_COMPLEX_10 result;
+      src = base;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result *= *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mproduct_c10 (gfc_array_c10 *, gfc_array_c10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mproduct_c10);
+
+void
+mproduct_c10 (gfc_array_c10 * retarray, gfc_array_c10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_10 *dest;
+  GFC_COMPLEX_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_COMPLEX_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_COMPLEX_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result *= *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..866ed451134ce8651e9b1d29d88bf1bbf283ae4b
--- /dev/null
+++ b/libgfortran/generated/product_c16.c
@@ -0,0 +1,334 @@
+/* Implementation of the PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_COMPLEX_16) && defined (HAVE_GFC_COMPLEX_16)
+
+
+extern void product_c16 (gfc_array_c16 *, gfc_array_c16 *, index_type *);
+export_proto(product_c16);
+
+void
+product_c16 (gfc_array_c16 *retarray, gfc_array_c16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_16 *base;
+  GFC_COMPLEX_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_COMPLEX_16 *src;
+      GFC_COMPLEX_16 result;
+      src = base;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result *= *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mproduct_c16 (gfc_array_c16 *, gfc_array_c16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mproduct_c16);
+
+void
+mproduct_c16 (gfc_array_c16 * retarray, gfc_array_c16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_16 *dest;
+  GFC_COMPLEX_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_COMPLEX_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_COMPLEX_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result *= *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c
index e2bae080abadf49c5f6244702d55890f0ec4116a..42fb1ed2c6c2e7ddfeeeea8647d51a6861b15cfd 100644
--- a/libgfortran/generated/product_c4.c
+++ b/libgfortran/generated/product_c4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_COMPLEX_4) && defined (HAVE_GFC_COMPLEX_4)
+
+
 extern void product_c4 (gfc_array_c4 *, gfc_array_c4 *, index_type *);
 export_proto(product_c4);
 
@@ -328,3 +331,4 @@ mproduct_c4 (gfc_array_c4 * retarray, gfc_array_c4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c
index a5dee48e78c4958abb818b3851dec3d2eec39090..c554c513fb97c93e508288a4e81c6d96989e4f96 100644
--- a/libgfortran/generated/product_c8.c
+++ b/libgfortran/generated/product_c8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_COMPLEX_8) && defined (HAVE_GFC_COMPLEX_8)
+
+
 extern void product_c8 (gfc_array_c8 *, gfc_array_c8 *, index_type *);
 export_proto(product_c8);
 
@@ -328,3 +331,4 @@ mproduct_c8 (gfc_array_c8 * retarray, gfc_array_c8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..3c2aa9e4fba70ea589cf99a5ebc6aad05a4ab3d5
--- /dev/null
+++ b/libgfortran/generated/product_i16.c
@@ -0,0 +1,334 @@
+/* Implementation of the PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void product_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(product_i16);
+
+void
+product_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result *= *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mproduct_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mproduct_i16);
+
+void
+mproduct_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result *= *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c
index acc6886e0c767ac36ee6f9d54f687f0a95a4b3ec..3620d8da20379f7aac054d8d8168982727cc0093 100644
--- a/libgfortran/generated/product_i4.c
+++ b/libgfortran/generated/product_i4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void product_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(product_i4);
 
@@ -328,3 +331,4 @@ mproduct_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c
index d41269b7ee55cc0db76057d703da4cb986eb2c01..65b0bb0fc42d084581e2f68e0b1152daafcd103e 100644
--- a/libgfortran/generated/product_i8.c
+++ b/libgfortran/generated/product_i8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void product_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(product_i8);
 
@@ -328,3 +331,4 @@ mproduct_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..292bbaa972665ec899914e4b23b8eb05ab2e2695
--- /dev/null
+++ b/libgfortran/generated/product_r10.c
@@ -0,0 +1,334 @@
+/* Implementation of the PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10)
+
+
+extern void product_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *);
+export_proto(product_r10);
+
+void
+product_r10 (gfc_array_r10 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_REAL_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_REAL_10 result;
+      src = base;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result *= *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mproduct_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mproduct_r10);
+
+void
+mproduct_r10 (gfc_array_r10 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result *= *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..f0a2c9818bbc20c28e51ace6ac29954894bb69ea
--- /dev/null
+++ b/libgfortran/generated/product_r16.c
@@ -0,0 +1,334 @@
+/* Implementation of the PRODUCT intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16)
+
+
+extern void product_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *);
+export_proto(product_r16);
+
+void
+product_r16 (gfc_array_r16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_REAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_REAL_16 result;
+      src = base;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result *= *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void mproduct_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(mproduct_r16);
+
+void
+mproduct_r16 (gfc_array_r16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 1;
+        if (len <= 0)
+	  *dest = 1;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result *= *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c
index 46814d7e808c22bc6a46af3a398bb1a71233671f..6ca9ff84cf202125b1740fec9e81df62cb681c84 100644
--- a/libgfortran/generated/product_r4.c
+++ b/libgfortran/generated/product_r4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)
+
+
 extern void product_r4 (gfc_array_r4 *, gfc_array_r4 *, index_type *);
 export_proto(product_r4);
 
@@ -328,3 +331,4 @@ mproduct_r4 (gfc_array_r4 * retarray, gfc_array_r4 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c
index 891ca5da237c9392db93cc135c01d16f3b96b27d..d73ccc7b0e0da86c34f197e7a95ab9be5838960f 100644
--- a/libgfortran/generated/product_r8.c
+++ b/libgfortran/generated/product_r8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8)
+
+
 extern void product_r8 (gfc_array_r8 *, gfc_array_r8 *, index_type *);
 export_proto(product_r8);
 
@@ -328,3 +331,4 @@ mproduct_r8 (gfc_array_r8 * retarray, gfc_array_r8 * array,
     }
 }
 
+#endif
diff --git a/libgfortran/generated/reshape_c10.c b/libgfortran/generated/reshape_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..30988e87eff573b83b733d2a2598ed405c863dc6
--- /dev/null
+++ b/libgfortran/generated/reshape_c10.c
@@ -0,0 +1,262 @@
+/* Implementation of the RESHAPE
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
+
+/* The shape parameter is ignored. We can currently deduce the shape from the
+   return array.  */
+
+extern void reshape_c10 (gfc_array_c10 *, gfc_array_c10 *, shape_type *,
+				    gfc_array_c10 *, shape_type *);
+export_proto(reshape_c10);
+
+void
+reshape_c10 (gfc_array_c10 * ret, gfc_array_c10 * source, shape_type * shape,
+                      gfc_array_c10 * pad, shape_type * order)
+{
+  /* r.* indicates the return array.  */
+  index_type rcount[GFC_MAX_DIMENSIONS];
+  index_type rextent[GFC_MAX_DIMENSIONS];
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type rdim;
+  index_type rsize;
+  index_type rs;
+  index_type rex;
+  GFC_COMPLEX_10 *rptr;
+  /* s.* indicates the source array.  */
+  index_type scount[GFC_MAX_DIMENSIONS];
+  index_type sextent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type sdim;
+  index_type ssize;
+  const GFC_COMPLEX_10 *sptr;
+  /* p.* indicates the pad array.  */
+  index_type pcount[GFC_MAX_DIMENSIONS];
+  index_type pextent[GFC_MAX_DIMENSIONS];
+  index_type pstride[GFC_MAX_DIMENSIONS];
+  index_type pdim;
+  index_type psize;
+  const GFC_COMPLEX_10 *pptr;
+
+  const GFC_COMPLEX_10 *src;
+  int n;
+  int dim;
+
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+  if (shape->dim[0].stride == 0)
+    shape->dim[0].stride = 1;
+  if (pad && pad->dim[0].stride == 0)
+    pad->dim[0].stride = 1;
+  if (order && order->dim[0].stride == 0)
+    order->dim[0].stride = 1;
+
+  if (ret->data == NULL)
+    {
+      rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
+      rs = 1;
+      for (n=0; n < rdim; n++)
+	{
+	  ret->dim[n].lbound = 0;
+	  rex = shape->data[n * shape->dim[0].stride];
+	  ret->dim[n].ubound =  rex - 1;
+	  ret->dim[n].stride = rs;
+	  rs *= rex;
+	}
+      ret->offset = 0;
+      ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_10));
+      ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
+    }
+  else
+    {
+      rdim = GFC_DESCRIPTOR_RANK (ret);
+      if (ret->dim[0].stride == 0)
+	ret->dim[0].stride = 1;
+    }
+
+  rsize = 1;
+  for (n = 0; n < rdim; n++)
+    {
+      if (order)
+        dim = order->data[n * order->dim[0].stride] - 1;
+      else
+        dim = n;
+
+      rcount[n] = 0;
+      rstride[n] = ret->dim[dim].stride;
+      rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound;
+
+      if (rextent[n] != shape->data[dim * shape->dim[0].stride])
+        runtime_error ("shape and target do not conform");
+
+      if (rsize == rstride[n])
+        rsize *= rextent[n];
+      else
+        rsize = 0;
+      if (rextent[n] <= 0)
+        return;
+    }
+
+  sdim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  for (n = 0; n < sdim; n++)
+    {
+      scount[n] = 0;
+      sstride[n] = source->dim[n].stride;
+      sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (sextent[n] <= 0)
+        abort ();
+
+      if (ssize == sstride[n])
+        ssize *= sextent[n];
+      else
+        ssize = 0;
+    }
+
+  if (pad)
+    {
+      pdim = GFC_DESCRIPTOR_RANK (pad);
+      psize = 1;
+      for (n = 0; n < pdim; n++)
+        {
+          pcount[n] = 0;
+          pstride[n] = pad->dim[n].stride;
+          pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound;
+          if (pextent[n] <= 0)
+            abort ();
+          if (psize == pstride[n])
+            psize *= pextent[n];
+          else
+            psize = 0;
+        }
+      pptr = pad->data;
+    }
+  else
+    {
+      pdim = 0;
+      psize = 1;
+      pptr = NULL;
+    }
+
+  if (rsize != 0 && ssize != 0 && psize != 0)
+    {
+      rsize *= sizeof (GFC_COMPLEX_10);
+      ssize *= sizeof (GFC_COMPLEX_10);
+      psize *= sizeof (GFC_COMPLEX_10);
+      reshape_packed ((char *)ret->data, rsize, (char *)source->data,
+		      ssize, pad ? (char *)pad->data : NULL, psize);
+      return;
+    }
+  rptr = ret->data;
+  src = sptr = source->data;
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+
+  while (rptr)
+    {
+      /* Select between the source and pad arrays.  */
+      *rptr = *src;
+      /* Advance to the next element.  */
+      rptr += rstride0;
+      src += sstride0;
+      rcount[0]++;
+      scount[0]++;
+      /* Advance to the next destination element.  */
+      n = 0;
+      while (rcount[n] == rextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          rcount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * rextent[n];
+          n++;
+          if (n == rdim)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              rcount[n]++;
+              rptr += rstride[n];
+            }
+        }
+      /* Advance to the next source element.  */
+      n = 0;
+      while (scount[n] == sextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          scount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= sstride[n] * sextent[n];
+          n++;
+          if (n == sdim)
+            {
+              if (sptr && pad)
+                {
+                  /* Switch to the pad array.  */
+                  sptr = NULL;
+                  sdim = pdim;
+                  for (dim = 0; dim < pdim; dim++)
+                    {
+                      scount[dim] = pcount[dim];
+                      sextent[dim] = pextent[dim];
+                      sstride[dim] = pstride[dim];
+                      sstride0 = sstride[0];
+                    }
+                }
+              /* We now start again from the beginning of the pad array.  */
+              src = pptr;
+              break;
+            }
+          else
+            {
+              scount[n]++;
+              src += sstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/reshape_c16.c b/libgfortran/generated/reshape_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..1c238de22ebfa98bdc84f3a7aad362dab430b78d
--- /dev/null
+++ b/libgfortran/generated/reshape_c16.c
@@ -0,0 +1,262 @@
+/* Implementation of the RESHAPE
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
+
+/* The shape parameter is ignored. We can currently deduce the shape from the
+   return array.  */
+
+extern void reshape_c16 (gfc_array_c16 *, gfc_array_c16 *, shape_type *,
+				    gfc_array_c16 *, shape_type *);
+export_proto(reshape_c16);
+
+void
+reshape_c16 (gfc_array_c16 * ret, gfc_array_c16 * source, shape_type * shape,
+                      gfc_array_c16 * pad, shape_type * order)
+{
+  /* r.* indicates the return array.  */
+  index_type rcount[GFC_MAX_DIMENSIONS];
+  index_type rextent[GFC_MAX_DIMENSIONS];
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type rdim;
+  index_type rsize;
+  index_type rs;
+  index_type rex;
+  GFC_COMPLEX_16 *rptr;
+  /* s.* indicates the source array.  */
+  index_type scount[GFC_MAX_DIMENSIONS];
+  index_type sextent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type sdim;
+  index_type ssize;
+  const GFC_COMPLEX_16 *sptr;
+  /* p.* indicates the pad array.  */
+  index_type pcount[GFC_MAX_DIMENSIONS];
+  index_type pextent[GFC_MAX_DIMENSIONS];
+  index_type pstride[GFC_MAX_DIMENSIONS];
+  index_type pdim;
+  index_type psize;
+  const GFC_COMPLEX_16 *pptr;
+
+  const GFC_COMPLEX_16 *src;
+  int n;
+  int dim;
+
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+  if (shape->dim[0].stride == 0)
+    shape->dim[0].stride = 1;
+  if (pad && pad->dim[0].stride == 0)
+    pad->dim[0].stride = 1;
+  if (order && order->dim[0].stride == 0)
+    order->dim[0].stride = 1;
+
+  if (ret->data == NULL)
+    {
+      rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
+      rs = 1;
+      for (n=0; n < rdim; n++)
+	{
+	  ret->dim[n].lbound = 0;
+	  rex = shape->data[n * shape->dim[0].stride];
+	  ret->dim[n].ubound =  rex - 1;
+	  ret->dim[n].stride = rs;
+	  rs *= rex;
+	}
+      ret->offset = 0;
+      ret->data = internal_malloc_size ( rs * sizeof (GFC_COMPLEX_16));
+      ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
+    }
+  else
+    {
+      rdim = GFC_DESCRIPTOR_RANK (ret);
+      if (ret->dim[0].stride == 0)
+	ret->dim[0].stride = 1;
+    }
+
+  rsize = 1;
+  for (n = 0; n < rdim; n++)
+    {
+      if (order)
+        dim = order->data[n * order->dim[0].stride] - 1;
+      else
+        dim = n;
+
+      rcount[n] = 0;
+      rstride[n] = ret->dim[dim].stride;
+      rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound;
+
+      if (rextent[n] != shape->data[dim * shape->dim[0].stride])
+        runtime_error ("shape and target do not conform");
+
+      if (rsize == rstride[n])
+        rsize *= rextent[n];
+      else
+        rsize = 0;
+      if (rextent[n] <= 0)
+        return;
+    }
+
+  sdim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  for (n = 0; n < sdim; n++)
+    {
+      scount[n] = 0;
+      sstride[n] = source->dim[n].stride;
+      sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (sextent[n] <= 0)
+        abort ();
+
+      if (ssize == sstride[n])
+        ssize *= sextent[n];
+      else
+        ssize = 0;
+    }
+
+  if (pad)
+    {
+      pdim = GFC_DESCRIPTOR_RANK (pad);
+      psize = 1;
+      for (n = 0; n < pdim; n++)
+        {
+          pcount[n] = 0;
+          pstride[n] = pad->dim[n].stride;
+          pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound;
+          if (pextent[n] <= 0)
+            abort ();
+          if (psize == pstride[n])
+            psize *= pextent[n];
+          else
+            psize = 0;
+        }
+      pptr = pad->data;
+    }
+  else
+    {
+      pdim = 0;
+      psize = 1;
+      pptr = NULL;
+    }
+
+  if (rsize != 0 && ssize != 0 && psize != 0)
+    {
+      rsize *= sizeof (GFC_COMPLEX_16);
+      ssize *= sizeof (GFC_COMPLEX_16);
+      psize *= sizeof (GFC_COMPLEX_16);
+      reshape_packed ((char *)ret->data, rsize, (char *)source->data,
+		      ssize, pad ? (char *)pad->data : NULL, psize);
+      return;
+    }
+  rptr = ret->data;
+  src = sptr = source->data;
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+
+  while (rptr)
+    {
+      /* Select between the source and pad arrays.  */
+      *rptr = *src;
+      /* Advance to the next element.  */
+      rptr += rstride0;
+      src += sstride0;
+      rcount[0]++;
+      scount[0]++;
+      /* Advance to the next destination element.  */
+      n = 0;
+      while (rcount[n] == rextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          rcount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * rextent[n];
+          n++;
+          if (n == rdim)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              rcount[n]++;
+              rptr += rstride[n];
+            }
+        }
+      /* Advance to the next source element.  */
+      n = 0;
+      while (scount[n] == sextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          scount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= sstride[n] * sextent[n];
+          n++;
+          if (n == sdim)
+            {
+              if (sptr && pad)
+                {
+                  /* Switch to the pad array.  */
+                  sptr = NULL;
+                  sdim = pdim;
+                  for (dim = 0; dim < pdim; dim++)
+                    {
+                      scount[dim] = pcount[dim];
+                      sextent[dim] = pextent[dim];
+                      sstride[dim] = pstride[dim];
+                      sstride0 = sstride[0];
+                    }
+                }
+              /* We now start again from the beginning of the pad array.  */
+              src = pptr;
+              break;
+            }
+          else
+            {
+              scount[n]++;
+              src += sstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/reshape_c4.c b/libgfortran/generated/reshape_c4.c
index f1be1851314c36f0bdcd31d7a33c370b27a974da..4416b9060bc38de63485f52623b4e207039f6723 100644
--- a/libgfortran/generated/reshape_c4.c
+++ b/libgfortran/generated/reshape_c4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
 
 /* The shape parameter is ignored. We can currently deduce the shape from the
@@ -256,3 +258,5 @@ reshape_c4 (gfc_array_c4 * ret, gfc_array_c4 * source, shape_type * shape,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/reshape_c8.c b/libgfortran/generated/reshape_c8.c
index 7d853f6378b34c6a131bb3d483644730884128be..425c6ebac0c281fbd4c52b8d5d3a1a7460e32747 100644
--- a/libgfortran/generated/reshape_c8.c
+++ b/libgfortran/generated/reshape_c8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
 
 /* The shape parameter is ignored. We can currently deduce the shape from the
@@ -256,3 +258,5 @@ reshape_c8 (gfc_array_c8 * ret, gfc_array_c8 * source, shape_type * shape,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/reshape_i16.c b/libgfortran/generated/reshape_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..2d793e2929dc5f04e33886c6f4bb0bb3a76a705a
--- /dev/null
+++ b/libgfortran/generated/reshape_i16.c
@@ -0,0 +1,262 @@
+/* Implementation of the RESHAPE
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
+
+/* The shape parameter is ignored. We can currently deduce the shape from the
+   return array.  */
+
+extern void reshape_16 (gfc_array_i16 *, gfc_array_i16 *, shape_type *,
+				    gfc_array_i16 *, shape_type *);
+export_proto(reshape_16);
+
+void
+reshape_16 (gfc_array_i16 * ret, gfc_array_i16 * source, shape_type * shape,
+                      gfc_array_i16 * pad, shape_type * order)
+{
+  /* r.* indicates the return array.  */
+  index_type rcount[GFC_MAX_DIMENSIONS];
+  index_type rextent[GFC_MAX_DIMENSIONS];
+  index_type rstride[GFC_MAX_DIMENSIONS];
+  index_type rstride0;
+  index_type rdim;
+  index_type rsize;
+  index_type rs;
+  index_type rex;
+  GFC_INTEGER_16 *rptr;
+  /* s.* indicates the source array.  */
+  index_type scount[GFC_MAX_DIMENSIONS];
+  index_type sextent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type sstride0;
+  index_type sdim;
+  index_type ssize;
+  const GFC_INTEGER_16 *sptr;
+  /* p.* indicates the pad array.  */
+  index_type pcount[GFC_MAX_DIMENSIONS];
+  index_type pextent[GFC_MAX_DIMENSIONS];
+  index_type pstride[GFC_MAX_DIMENSIONS];
+  index_type pdim;
+  index_type psize;
+  const GFC_INTEGER_16 *pptr;
+
+  const GFC_INTEGER_16 *src;
+  int n;
+  int dim;
+
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+  if (shape->dim[0].stride == 0)
+    shape->dim[0].stride = 1;
+  if (pad && pad->dim[0].stride == 0)
+    pad->dim[0].stride = 1;
+  if (order && order->dim[0].stride == 0)
+    order->dim[0].stride = 1;
+
+  if (ret->data == NULL)
+    {
+      rdim = shape->dim[0].ubound - shape->dim[0].lbound + 1;
+      rs = 1;
+      for (n=0; n < rdim; n++)
+	{
+	  ret->dim[n].lbound = 0;
+	  rex = shape->data[n * shape->dim[0].stride];
+	  ret->dim[n].ubound =  rex - 1;
+	  ret->dim[n].stride = rs;
+	  rs *= rex;
+	}
+      ret->offset = 0;
+      ret->data = internal_malloc_size ( rs * sizeof (GFC_INTEGER_16));
+      ret->dtype = (source->dtype & ~GFC_DTYPE_RANK_MASK) | rdim;
+    }
+  else
+    {
+      rdim = GFC_DESCRIPTOR_RANK (ret);
+      if (ret->dim[0].stride == 0)
+	ret->dim[0].stride = 1;
+    }
+
+  rsize = 1;
+  for (n = 0; n < rdim; n++)
+    {
+      if (order)
+        dim = order->data[n * order->dim[0].stride] - 1;
+      else
+        dim = n;
+
+      rcount[n] = 0;
+      rstride[n] = ret->dim[dim].stride;
+      rextent[n] = ret->dim[dim].ubound + 1 - ret->dim[dim].lbound;
+
+      if (rextent[n] != shape->data[dim * shape->dim[0].stride])
+        runtime_error ("shape and target do not conform");
+
+      if (rsize == rstride[n])
+        rsize *= rextent[n];
+      else
+        rsize = 0;
+      if (rextent[n] <= 0)
+        return;
+    }
+
+  sdim = GFC_DESCRIPTOR_RANK (source);
+  ssize = 1;
+  for (n = 0; n < sdim; n++)
+    {
+      scount[n] = 0;
+      sstride[n] = source->dim[n].stride;
+      sextent[n] = source->dim[n].ubound + 1 - source->dim[n].lbound;
+      if (sextent[n] <= 0)
+        abort ();
+
+      if (ssize == sstride[n])
+        ssize *= sextent[n];
+      else
+        ssize = 0;
+    }
+
+  if (pad)
+    {
+      pdim = GFC_DESCRIPTOR_RANK (pad);
+      psize = 1;
+      for (n = 0; n < pdim; n++)
+        {
+          pcount[n] = 0;
+          pstride[n] = pad->dim[n].stride;
+          pextent[n] = pad->dim[n].ubound + 1 - pad->dim[n].lbound;
+          if (pextent[n] <= 0)
+            abort ();
+          if (psize == pstride[n])
+            psize *= pextent[n];
+          else
+            psize = 0;
+        }
+      pptr = pad->data;
+    }
+  else
+    {
+      pdim = 0;
+      psize = 1;
+      pptr = NULL;
+    }
+
+  if (rsize != 0 && ssize != 0 && psize != 0)
+    {
+      rsize *= sizeof (GFC_INTEGER_16);
+      ssize *= sizeof (GFC_INTEGER_16);
+      psize *= sizeof (GFC_INTEGER_16);
+      reshape_packed ((char *)ret->data, rsize, (char *)source->data,
+		      ssize, pad ? (char *)pad->data : NULL, psize);
+      return;
+    }
+  rptr = ret->data;
+  src = sptr = source->data;
+  rstride0 = rstride[0];
+  sstride0 = sstride[0];
+
+  while (rptr)
+    {
+      /* Select between the source and pad arrays.  */
+      *rptr = *src;
+      /* Advance to the next element.  */
+      rptr += rstride0;
+      src += sstride0;
+      rcount[0]++;
+      scount[0]++;
+      /* Advance to the next destination element.  */
+      n = 0;
+      while (rcount[n] == rextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          rcount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          rptr -= rstride[n] * rextent[n];
+          n++;
+          if (n == rdim)
+            {
+              /* Break out of the loop.  */
+              rptr = NULL;
+              break;
+            }
+          else
+            {
+              rcount[n]++;
+              rptr += rstride[n];
+            }
+        }
+      /* Advance to the next source element.  */
+      n = 0;
+      while (scount[n] == sextent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          scount[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          src -= sstride[n] * sextent[n];
+          n++;
+          if (n == sdim)
+            {
+              if (sptr && pad)
+                {
+                  /* Switch to the pad array.  */
+                  sptr = NULL;
+                  sdim = pdim;
+                  for (dim = 0; dim < pdim; dim++)
+                    {
+                      scount[dim] = pcount[dim];
+                      sextent[dim] = pextent[dim];
+                      sstride[dim] = pstride[dim];
+                      sstride0 = sstride[0];
+                    }
+                }
+              /* We now start again from the beginning of the pad array.  */
+              src = pptr;
+              break;
+            }
+          else
+            {
+              scount[n]++;
+              src += sstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/reshape_i4.c b/libgfortran/generated/reshape_i4.c
index bf7bba363c7dcac7fdb9ba57a7bc53b3e3f7c45a..565d79c6222d92980021c73612924655e80016b4 100644
--- a/libgfortran/generated/reshape_i4.c
+++ b/libgfortran/generated/reshape_i4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
 
 /* The shape parameter is ignored. We can currently deduce the shape from the
@@ -256,3 +258,5 @@ reshape_4 (gfc_array_i4 * ret, gfc_array_i4 * source, shape_type * shape,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/reshape_i8.c b/libgfortran/generated/reshape_i8.c
index 5f17a5faa84c7fbe3cdcdc5f5cd2bb3ee9b94900..465d532ed8aa1e07eddd58d12196e07db4d998b5 100644
--- a/libgfortran/generated/reshape_i8.c
+++ b/libgfortran/generated/reshape_i8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
 
 /* The shape parameter is ignored. We can currently deduce the shape from the
@@ -256,3 +258,5 @@ reshape_8 (gfc_array_i8 * ret, gfc_array_i8 * source, shape_type * shape,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/set_exponent_r10.c b/libgfortran/generated/set_exponent_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..49a0a6e3e4e25ade74838e66fbeffcbf35322148
--- /dev/null
+++ b/libgfortran/generated/set_exponent_r10.c
@@ -0,0 +1,48 @@
+/* Implementation of the SET_EXPONENT intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_SCALBNL) && defined (HAVE_FREXPL)
+
+extern GFC_REAL_10 set_exponent_r10 (GFC_REAL_10 s, GFC_INTEGER_4 i);
+export_proto(set_exponent_r10);
+
+GFC_REAL_10
+set_exponent_r10 (GFC_REAL_10 s, GFC_INTEGER_4 i)
+{
+  int dummy_exp;
+  return scalbnl (frexpl (s, &dummy_exp), i);
+}
+
+#endif
diff --git a/libgfortran/generated/set_exponent_r16.c b/libgfortran/generated/set_exponent_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..ddc1fc6f005414d1f4072eb88148ddf71a5f6ba0
--- /dev/null
+++ b/libgfortran/generated/set_exponent_r16.c
@@ -0,0 +1,48 @@
+/* Implementation of the SET_EXPONENT intrinsic
+   Copyright 2003 Free Software Foundation, Inc.
+   Contributed by Richard Henderson <rth@redhat.com>.
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <math.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_SCALBNL) && defined (HAVE_FREXPL)
+
+extern GFC_REAL_16 set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i);
+export_proto(set_exponent_r16);
+
+GFC_REAL_16
+set_exponent_r16 (GFC_REAL_16 s, GFC_INTEGER_4 i)
+{
+  int dummy_exp;
+  return scalbnl (frexpl (s, &dummy_exp), i);
+}
+
+#endif
diff --git a/libgfortran/generated/set_exponent_r4.c b/libgfortran/generated/set_exponent_r4.c
index e646176a7ce3019e3eb79423a1cef7b4393e16b3..6b1be5d43d8077d7c2501424962ee19e90ed1eff 100644
--- a/libgfortran/generated/set_exponent_r4.c
+++ b/libgfortran/generated/set_exponent_r4.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_SCALBNF) && defined (HAVE_FREXPF)
+
 extern GFC_REAL_4 set_exponent_r4 (GFC_REAL_4 s, GFC_INTEGER_4 i);
 export_proto(set_exponent_r4);
 
@@ -40,3 +44,5 @@ set_exponent_r4 (GFC_REAL_4 s, GFC_INTEGER_4 i)
   int dummy_exp;
   return scalbnf (frexpf (s, &dummy_exp), i);
 }
+
+#endif
diff --git a/libgfortran/generated/set_exponent_r8.c b/libgfortran/generated/set_exponent_r8.c
index 482e0185dbf2bc80a46a88220652ff47c8c68a45..1707a9063b6170f41db7e5a137274b1bc4b14d93 100644
--- a/libgfortran/generated/set_exponent_r8.c
+++ b/libgfortran/generated/set_exponent_r8.c
@@ -27,10 +27,14 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_SCALBN) && defined (HAVE_FREXP)
+
 extern GFC_REAL_8 set_exponent_r8 (GFC_REAL_8 s, GFC_INTEGER_4 i);
 export_proto(set_exponent_r8);
 
@@ -40,3 +44,5 @@ set_exponent_r8 (GFC_REAL_8 s, GFC_INTEGER_4 i)
   int dummy_exp;
   return scalbn (frexp (s, &dummy_exp), i);
 }
+
+#endif
diff --git a/libgfortran/generated/shape_i16.c b/libgfortran/generated/shape_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..87a58ffe5a6ed87d6872464cd0a6714596b11362
--- /dev/null
+++ b/libgfortran/generated/shape_i16.c
@@ -0,0 +1,58 @@
+/* Implementation of the SHAPE intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+extern void shape_16 (gfc_array_i16 * ret, const gfc_array_i16 * array);
+export_proto(shape_16);
+
+void
+shape_16 (gfc_array_i16 * ret, const gfc_array_i16 * array)
+{
+  int n;
+  index_type stride;
+
+  stride = ret->dim[0].stride;
+  if (stride == 0)
+    stride = 1;
+
+  for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
+    {
+      ret->data[n * stride] =
+        array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/shape_i4.c b/libgfortran/generated/shape_i4.c
index c6b4f7f5369b719c8b88077db15f76ca2498a653..7a56eee5b5f8fee747ffc4ac51bccd62ea875141 100644
--- a/libgfortran/generated/shape_i4.c
+++ b/libgfortran/generated/shape_i4.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 extern void shape_4 (gfc_array_i4 * ret, const gfc_array_i4 * array);
 export_proto(shape_4);
 
@@ -52,3 +54,5 @@ shape_4 (gfc_array_i4 * ret, const gfc_array_i4 * array)
         array->dim[n].ubound + 1 - array->dim[n].lbound;
     }
 }
+
+#endif
diff --git a/libgfortran/generated/shape_i8.c b/libgfortran/generated/shape_i8.c
index 84011b166b3444f7443eb477b38c4dae62217aa0..2e696c27b182835beb5b1cfe6d67156fb3163302 100644
--- a/libgfortran/generated/shape_i8.c
+++ b/libgfortran/generated/shape_i8.c
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 extern void shape_8 (gfc_array_i8 * ret, const gfc_array_i8 * array);
 export_proto(shape_8);
 
@@ -52,3 +54,5 @@ shape_8 (gfc_array_i8 * ret, const gfc_array_i8 * array)
         array->dim[n].ubound + 1 - array->dim[n].lbound;
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..655529a7fe9e176c5e427aea9bff951fd3e6f84f
--- /dev/null
+++ b/libgfortran/generated/sum_c10.c
@@ -0,0 +1,334 @@
+/* Implementation of the SUM intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_COMPLEX_10) && defined (HAVE_GFC_COMPLEX_10)
+
+
+extern void sum_c10 (gfc_array_c10 *, gfc_array_c10 *, index_type *);
+export_proto(sum_c10);
+
+void
+sum_c10 (gfc_array_c10 *retarray, gfc_array_c10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_10 *base;
+  GFC_COMPLEX_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_COMPLEX_10 *src;
+      GFC_COMPLEX_10 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result += *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void msum_c10 (gfc_array_c10 *, gfc_array_c10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(msum_c10);
+
+void
+msum_c10 (gfc_array_c10 * retarray, gfc_array_c10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_10 *dest;
+  GFC_COMPLEX_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_COMPLEX_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_COMPLEX_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result += *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..ee40ba5149cca256f51fdb6db32773068d6f396a
--- /dev/null
+++ b/libgfortran/generated/sum_c16.c
@@ -0,0 +1,334 @@
+/* Implementation of the SUM intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_COMPLEX_16) && defined (HAVE_GFC_COMPLEX_16)
+
+
+extern void sum_c16 (gfc_array_c16 *, gfc_array_c16 *, index_type *);
+export_proto(sum_c16);
+
+void
+sum_c16 (gfc_array_c16 *retarray, gfc_array_c16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_16 *base;
+  GFC_COMPLEX_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_COMPLEX_16 *src;
+      GFC_COMPLEX_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result += *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void msum_c16 (gfc_array_c16 *, gfc_array_c16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(msum_c16);
+
+void
+msum_c16 (gfc_array_c16 * retarray, gfc_array_c16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_COMPLEX_16 *dest;
+  GFC_COMPLEX_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_COMPLEX_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_COMPLEX_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_COMPLEX_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result += *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c
index 88bd14debc49b50952426275008d0bb8c6aa186c..bb08a4b558d001bbdb4b323476497bef3acd2e06 100644
--- a/libgfortran/generated/sum_c4.c
+++ b/libgfortran/generated/sum_c4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_COMPLEX_4) && defined (HAVE_GFC_COMPLEX_4)
+
+
 extern void sum_c4 (gfc_array_c4 *, gfc_array_c4 *, index_type *);
 export_proto(sum_c4);
 
@@ -327,3 +330,5 @@ msum_c4 (gfc_array_c4 * retarray, gfc_array_c4 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c
index c532e2a30233001215d39d2f296202bc92a00ff7..fd8e3560aa34914fa129d3438840ae6997ff993f 100644
--- a/libgfortran/generated/sum_c8.c
+++ b/libgfortran/generated/sum_c8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_COMPLEX_8) && defined (HAVE_GFC_COMPLEX_8)
+
+
 extern void sum_c8 (gfc_array_c8 *, gfc_array_c8 *, index_type *);
 export_proto(sum_c8);
 
@@ -327,3 +330,5 @@ msum_c8 (gfc_array_c8 * retarray, gfc_array_c8 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..b1ba2353fb936fa068812b76ce53d516be202ac2
--- /dev/null
+++ b/libgfortran/generated/sum_i16.c
@@ -0,0 +1,334 @@
+/* Implementation of the SUM intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_INTEGER_16) && defined (HAVE_GFC_INTEGER_16)
+
+
+extern void sum_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *);
+export_proto(sum_i16);
+
+void
+sum_i16 (gfc_array_i16 *retarray, gfc_array_i16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *base;
+  GFC_INTEGER_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_INTEGER_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result += *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void msum_i16 (gfc_array_i16 *, gfc_array_i16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(msum_i16);
+
+void
+msum_i16 (gfc_array_i16 * retarray, gfc_array_i16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_INTEGER_16 *dest;
+  GFC_INTEGER_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_INTEGER_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_INTEGER_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_INTEGER_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result += *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c
index 6fd750eb246209c28ca3c0f92b69c08f8d5cefc2..1efb59e134e77239ee7a7f9709b56d1e1c3e2041 100644
--- a/libgfortran/generated/sum_i4.c
+++ b/libgfortran/generated/sum_i4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_4) && defined (HAVE_GFC_INTEGER_4)
+
+
 extern void sum_i4 (gfc_array_i4 *, gfc_array_i4 *, index_type *);
 export_proto(sum_i4);
 
@@ -327,3 +330,5 @@ msum_i4 (gfc_array_i4 * retarray, gfc_array_i4 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c
index 8b7ea070abbb1d37102fa24e3aaf7e28238f8e43..a7c3d2f6b83b0a40a3c8d6e7a8397e3e06f9ea81 100644
--- a/libgfortran/generated/sum_i8.c
+++ b/libgfortran/generated/sum_i8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_INTEGER_8) && defined (HAVE_GFC_INTEGER_8)
+
+
 extern void sum_i8 (gfc_array_i8 *, gfc_array_i8 *, index_type *);
 export_proto(sum_i8);
 
@@ -327,3 +330,5 @@ msum_i8 (gfc_array_i8 * retarray, gfc_array_i8 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c
new file mode 100644
index 0000000000000000000000000000000000000000..e0231ca645b0843506203720db85c111a6634fcb
--- /dev/null
+++ b/libgfortran/generated/sum_r10.c
@@ -0,0 +1,334 @@
+/* Implementation of the SUM intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_GFC_REAL_10)
+
+
+extern void sum_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *);
+export_proto(sum_r10);
+
+void
+sum_r10 (gfc_array_r10 *retarray, gfc_array_r10 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *base;
+  GFC_REAL_10 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_REAL_10 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result += *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void msum_r10 (gfc_array_r10 *, gfc_array_r10 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(msum_r10);
+
+void
+msum_r10 (gfc_array_r10 * retarray, gfc_array_r10 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_10 *dest;
+  GFC_REAL_10 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_10)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_10 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_10 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result += *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c
new file mode 100644
index 0000000000000000000000000000000000000000..4168f8c0669d1ca834b2dd07e5c75e363220fb85
--- /dev/null
+++ b/libgfortran/generated/sum_r16.c
@@ -0,0 +1,334 @@
+/* Implementation of the SUM intrinsic
+   Copyright 2002 Free Software Foundation, Inc.
+   Contributed by Paul Brook <paul@nowt.org>
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <stdlib.h>
+#include <assert.h>
+#include "libgfortran.h"
+
+
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_GFC_REAL_16)
+
+
+extern void sum_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *);
+export_proto(sum_r16);
+
+void
+sum_r16 (gfc_array_r16 *retarray, gfc_array_r16 *array, index_type *pdim)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *base;
+  GFC_REAL_16 *dest;
+  index_type rank;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type dim;
+
+  /* Make dim zero based to avoid confusion.  */
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  delta = array->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        len = 0;
+    }
+
+  base = array->data;
+  dest = retarray->data;
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_REAL_16 result;
+      src = base;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta)
+	      {
+
+  result += *src;
+          }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+
+extern void msum_r16 (gfc_array_r16 *, gfc_array_r16 *, index_type *,
+					       gfc_array_l4 *);
+export_proto(msum_r16);
+
+void
+msum_r16 (gfc_array_r16 * retarray, gfc_array_r16 * array,
+				  index_type *pdim, gfc_array_l4 * mask)
+{
+  index_type count[GFC_MAX_DIMENSIONS];
+  index_type extent[GFC_MAX_DIMENSIONS];
+  index_type sstride[GFC_MAX_DIMENSIONS];
+  index_type dstride[GFC_MAX_DIMENSIONS];
+  index_type mstride[GFC_MAX_DIMENSIONS];
+  GFC_REAL_16 *dest;
+  GFC_REAL_16 *base;
+  GFC_LOGICAL_4 *mbase;
+  int rank;
+  int dim;
+  index_type n;
+  index_type len;
+  index_type delta;
+  index_type mdelta;
+
+  dim = (*pdim) - 1;
+  rank = GFC_DESCRIPTOR_RANK (array) - 1;
+
+  /* TODO:  It should be a front end job to correctly set the strides.  */
+
+  if (array->dim[0].stride == 0)
+    array->dim[0].stride = 1;
+
+  if (mask->dim[0].stride == 0)
+    mask->dim[0].stride = 1;
+
+  len = array->dim[dim].ubound + 1 - array->dim[dim].lbound;
+  if (len <= 0)
+    return;
+  delta = array->dim[dim].stride;
+  mdelta = mask->dim[dim].stride;
+
+  for (n = 0; n < dim; n++)
+    {
+      sstride[n] = array->dim[n].stride;
+      mstride[n] = mask->dim[n].stride;
+      extent[n] = array->dim[n].ubound + 1 - array->dim[n].lbound;
+    }
+  for (n = dim; n < rank; n++)
+    {
+      sstride[n] = array->dim[n + 1].stride;
+      mstride[n] = mask->dim[n + 1].stride;
+      extent[n] =
+        array->dim[n + 1].ubound + 1 - array->dim[n + 1].lbound;
+    }
+
+  if (retarray->data == NULL)
+    {
+      for (n = 0; n < rank; n++)
+        {
+          retarray->dim[n].lbound = 0;
+          retarray->dim[n].ubound = extent[n]-1;
+          if (n == 0)
+            retarray->dim[n].stride = 1;
+          else
+            retarray->dim[n].stride = retarray->dim[n-1].stride * extent[n-1];
+        }
+
+      retarray->data
+	 = internal_malloc_size (sizeof (GFC_REAL_16)
+		 		 * retarray->dim[rank-1].stride
+				 * extent[rank-1]);
+      retarray->offset = 0;
+      retarray->dtype = (array->dtype & ~GFC_DTYPE_RANK_MASK) | rank;
+    }
+  else
+    {
+      if (retarray->dim[0].stride == 0)
+	retarray->dim[0].stride = 1;
+
+      if (rank != GFC_DESCRIPTOR_RANK (retarray))
+	runtime_error ("rank of return array incorrect");
+    }
+
+  for (n = 0; n < rank; n++)
+    {
+      count[n] = 0;
+      dstride[n] = retarray->dim[n].stride;
+      if (extent[n] <= 0)
+        return;
+    }
+
+  dest = retarray->data;
+  base = array->data;
+  mbase = mask->data;
+
+  if (GFC_DESCRIPTOR_SIZE (mask) != 4)
+    {
+      /* This allows the same loop to be used for all logical types.  */
+      assert (GFC_DESCRIPTOR_SIZE (mask) == 8);
+      for (n = 0; n < rank; n++)
+        mstride[n] <<= 1;
+      mdelta <<= 1;
+      mbase = (GFOR_POINTER_L8_TO_L4 (mbase));
+    }
+
+  while (base)
+    {
+      GFC_REAL_16 *src;
+      GFC_LOGICAL_4 *msrc;
+      GFC_REAL_16 result;
+      src = base;
+      msrc = mbase;
+      {
+
+  result = 0;
+        if (len <= 0)
+	  *dest = 0;
+	else
+	  {
+	    for (n = 0; n < len; n++, src += delta, msrc += mdelta)
+	      {
+
+  if (*msrc)
+    result += *src;
+              }
+	    *dest = result;
+	  }
+      }
+      /* Advance to the next element.  */
+      count[0]++;
+      base += sstride[0];
+      mbase += mstride[0];
+      dest += dstride[0];
+      n = 0;
+      while (count[n] == extent[n])
+        {
+          /* When we get to the end of a dimension, reset it and increment
+             the next dimension.  */
+          count[n] = 0;
+          /* We could precalculate these products, but this is a less
+             frequently used path so proabably not worth it.  */
+          base -= sstride[n] * extent[n];
+          mbase -= mstride[n] * extent[n];
+          dest -= dstride[n] * extent[n];
+          n++;
+          if (n == rank)
+            {
+              /* Break out of the look.  */
+              base = NULL;
+              break;
+            }
+          else
+            {
+              count[n]++;
+              base += sstride[n];
+              mbase += mstride[n];
+              dest += dstride[n];
+            }
+        }
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c
index 1419f2f853f4a1fcd937b28ef1243871bbe03b64..bf76631811abbdbd6cc8c179b2da5698213633e2 100644
--- a/libgfortran/generated/sum_r4.c
+++ b/libgfortran/generated/sum_r4.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_GFC_REAL_4)
+
+
 extern void sum_r4 (gfc_array_r4 *, gfc_array_r4 *, index_type *);
 export_proto(sum_r4);
 
@@ -327,3 +330,5 @@ msum_r4 (gfc_array_r4 * retarray, gfc_array_r4 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c
index 6dbd65663ba95e13fde2460f8a7b7a25e22d231e..c6d0546b2c3a64173311384b22e35280ccf7f6d3 100644
--- a/libgfortran/generated/sum_r8.c
+++ b/libgfortran/generated/sum_r8.c
@@ -34,6 +34,9 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_GFC_REAL_8)
+
+
 extern void sum_r8 (gfc_array_r8 *, gfc_array_r8 *, index_type *);
 export_proto(sum_r8);
 
@@ -327,3 +330,5 @@ msum_r8 (gfc_array_r8 * retarray, gfc_array_r8 * array,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/generated/transpose_c10.c b/libgfortran/generated/transpose_c10.c
new file mode 100644
index 0000000000000000000000000000000000000000..cb2f992e6f86589fd31eaf9d0196d944b11b0934
--- /dev/null
+++ b/libgfortran/generated/transpose_c10.c
@@ -0,0 +1,102 @@
+/* Implementation of the TRANSPOSE intrinsic
+   Copyright 2003, 2005 Free Software Foundation, Inc.
+   Contributed by Tobias Schlüter
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_10)
+
+extern void transpose_c10 (gfc_array_c10 * ret, gfc_array_c10 * source);
+export_proto(transpose_c10);
+
+void
+transpose_c10 (gfc_array_c10 * ret, gfc_array_c10 * source)
+{
+  /* r.* indicates the return array.  */
+  index_type rxstride, rystride;
+  GFC_COMPLEX_10 *rptr;
+  /* s.* indicates the source array.  */
+  index_type sxstride, systride;
+  const GFC_COMPLEX_10 *sptr;
+
+  index_type xcount, ycount;
+  index_type x, y;
+
+  assert (GFC_DESCRIPTOR_RANK (source) == 2);
+
+  if (ret->data == NULL)
+    {
+      assert (GFC_DESCRIPTOR_RANK (ret) == 2);
+      assert (ret->dtype == source->dtype);
+
+      ret->dim[0].lbound = 0;
+      ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+      ret->dim[0].stride = 1;
+
+      ret->dim[1].lbound = 0;
+      ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+      ret->dim[1].stride = ret->dim[0].ubound+1;
+
+      ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_10) * size0 ((array_t *) ret));
+      ret->offset = 0;
+    }
+
+  if (ret->dim[0].stride == 0)
+    ret->dim[0].stride = 1;
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+
+  sxstride = source->dim[0].stride;
+  systride = source->dim[1].stride;
+  xcount = source->dim[0].ubound + 1 - source->dim[0].lbound;
+  ycount = source->dim[1].ubound + 1 - source->dim[1].lbound;
+
+  rxstride = ret->dim[0].stride;
+  rystride = ret->dim[1].stride;
+
+  rptr = ret->data;
+  sptr = source->data;
+
+  for (y=0; y < ycount; y++)
+    {
+      for (x=0; x < xcount; x++)
+        {
+          *rptr = *sptr;
+
+          sptr += sxstride;
+          rptr += rystride;
+        }
+        sptr += systride - (sxstride * xcount);
+        rptr += rxstride - (rystride * xcount);
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/transpose_c16.c b/libgfortran/generated/transpose_c16.c
new file mode 100644
index 0000000000000000000000000000000000000000..4c39c58ba3099e63ff162f339930b34afade6132
--- /dev/null
+++ b/libgfortran/generated/transpose_c16.c
@@ -0,0 +1,102 @@
+/* Implementation of the TRANSPOSE intrinsic
+   Copyright 2003, 2005 Free Software Foundation, Inc.
+   Contributed by Tobias Schlüter
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_COMPLEX_16)
+
+extern void transpose_c16 (gfc_array_c16 * ret, gfc_array_c16 * source);
+export_proto(transpose_c16);
+
+void
+transpose_c16 (gfc_array_c16 * ret, gfc_array_c16 * source)
+{
+  /* r.* indicates the return array.  */
+  index_type rxstride, rystride;
+  GFC_COMPLEX_16 *rptr;
+  /* s.* indicates the source array.  */
+  index_type sxstride, systride;
+  const GFC_COMPLEX_16 *sptr;
+
+  index_type xcount, ycount;
+  index_type x, y;
+
+  assert (GFC_DESCRIPTOR_RANK (source) == 2);
+
+  if (ret->data == NULL)
+    {
+      assert (GFC_DESCRIPTOR_RANK (ret) == 2);
+      assert (ret->dtype == source->dtype);
+
+      ret->dim[0].lbound = 0;
+      ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+      ret->dim[0].stride = 1;
+
+      ret->dim[1].lbound = 0;
+      ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+      ret->dim[1].stride = ret->dim[0].ubound+1;
+
+      ret->data = internal_malloc_size (sizeof (GFC_COMPLEX_16) * size0 ((array_t *) ret));
+      ret->offset = 0;
+    }
+
+  if (ret->dim[0].stride == 0)
+    ret->dim[0].stride = 1;
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+
+  sxstride = source->dim[0].stride;
+  systride = source->dim[1].stride;
+  xcount = source->dim[0].ubound + 1 - source->dim[0].lbound;
+  ycount = source->dim[1].ubound + 1 - source->dim[1].lbound;
+
+  rxstride = ret->dim[0].stride;
+  rystride = ret->dim[1].stride;
+
+  rptr = ret->data;
+  sptr = source->data;
+
+  for (y=0; y < ycount; y++)
+    {
+      for (x=0; x < xcount; x++)
+        {
+          *rptr = *sptr;
+
+          sptr += sxstride;
+          rptr += rystride;
+        }
+        sptr += systride - (sxstride * xcount);
+        rptr += rxstride - (rystride * xcount);
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/transpose_c4.c b/libgfortran/generated/transpose_c4.c
index 374efed0829df012636ef19ee25176f8b5e11926..a8e22c9f65977fb83ed89e3ce1ef044988395631 100644
--- a/libgfortran/generated/transpose_c4.c
+++ b/libgfortran/generated/transpose_c4.c
@@ -32,6 +32,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_4)
+
 extern void transpose_c4 (gfc_array_c4 * ret, gfc_array_c4 * source);
 export_proto(transpose_c4);
 
@@ -96,3 +98,5 @@ transpose_c4 (gfc_array_c4 * ret, gfc_array_c4 * source)
         rptr += rxstride - (rystride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/generated/transpose_c8.c b/libgfortran/generated/transpose_c8.c
index a87854281113aef094d4d9eb27d67aa9dc2a33e4..a61ecc4d2c2b97996d59ca9134feef5b0b3244d5 100644
--- a/libgfortran/generated/transpose_c8.c
+++ b/libgfortran/generated/transpose_c8.c
@@ -32,6 +32,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_COMPLEX_8)
+
 extern void transpose_c8 (gfc_array_c8 * ret, gfc_array_c8 * source);
 export_proto(transpose_c8);
 
@@ -96,3 +98,5 @@ transpose_c8 (gfc_array_c8 * ret, gfc_array_c8 * source)
         rptr += rxstride - (rystride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/generated/transpose_i16.c b/libgfortran/generated/transpose_i16.c
new file mode 100644
index 0000000000000000000000000000000000000000..fcebdf3c9d88d60c5e413e4043674db8f1f04920
--- /dev/null
+++ b/libgfortran/generated/transpose_i16.c
@@ -0,0 +1,102 @@
+/* Implementation of the TRANSPOSE intrinsic
+   Copyright 2003, 2005 Free Software Foundation, Inc.
+   Contributed by Tobias Schlüter
+
+This file is part of the GNU Fortran 95 runtime library (libgfortran).
+
+Libgfortran is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+Libgfortran is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public
+License along with libgfortran; see the file COPYING.  If not,
+write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
+#include <assert.h>
+#include "libgfortran.h"
+
+#if defined (HAVE_GFC_INTEGER_16)
+
+extern void transpose_i16 (gfc_array_i16 * ret, gfc_array_i16 * source);
+export_proto(transpose_i16);
+
+void
+transpose_i16 (gfc_array_i16 * ret, gfc_array_i16 * source)
+{
+  /* r.* indicates the return array.  */
+  index_type rxstride, rystride;
+  GFC_INTEGER_16 *rptr;
+  /* s.* indicates the source array.  */
+  index_type sxstride, systride;
+  const GFC_INTEGER_16 *sptr;
+
+  index_type xcount, ycount;
+  index_type x, y;
+
+  assert (GFC_DESCRIPTOR_RANK (source) == 2);
+
+  if (ret->data == NULL)
+    {
+      assert (GFC_DESCRIPTOR_RANK (ret) == 2);
+      assert (ret->dtype == source->dtype);
+
+      ret->dim[0].lbound = 0;
+      ret->dim[0].ubound = source->dim[1].ubound - source->dim[1].lbound;
+      ret->dim[0].stride = 1;
+
+      ret->dim[1].lbound = 0;
+      ret->dim[1].ubound = source->dim[0].ubound - source->dim[0].lbound;
+      ret->dim[1].stride = ret->dim[0].ubound+1;
+
+      ret->data = internal_malloc_size (sizeof (GFC_INTEGER_16) * size0 ((array_t *) ret));
+      ret->offset = 0;
+    }
+
+  if (ret->dim[0].stride == 0)
+    ret->dim[0].stride = 1;
+  if (source->dim[0].stride == 0)
+    source->dim[0].stride = 1;
+
+  sxstride = source->dim[0].stride;
+  systride = source->dim[1].stride;
+  xcount = source->dim[0].ubound + 1 - source->dim[0].lbound;
+  ycount = source->dim[1].ubound + 1 - source->dim[1].lbound;
+
+  rxstride = ret->dim[0].stride;
+  rystride = ret->dim[1].stride;
+
+  rptr = ret->data;
+  sptr = source->data;
+
+  for (y=0; y < ycount; y++)
+    {
+      for (x=0; x < xcount; x++)
+        {
+          *rptr = *sptr;
+
+          sptr += sxstride;
+          rptr += rystride;
+        }
+        sptr += systride - (sxstride * xcount);
+        rptr += rxstride - (rystride * xcount);
+    }
+}
+
+#endif
diff --git a/libgfortran/generated/transpose_i4.c b/libgfortran/generated/transpose_i4.c
index c99ef487711cf547b4757d358e857eb6dd89f769..b3979a87d4c48eb612d1d370478d713f793284ab 100644
--- a/libgfortran/generated/transpose_i4.c
+++ b/libgfortran/generated/transpose_i4.c
@@ -32,6 +32,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_4)
+
 extern void transpose_i4 (gfc_array_i4 * ret, gfc_array_i4 * source);
 export_proto(transpose_i4);
 
@@ -96,3 +98,5 @@ transpose_i4 (gfc_array_i4 * ret, gfc_array_i4 * source)
         rptr += rxstride - (rystride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/generated/transpose_i8.c b/libgfortran/generated/transpose_i8.c
index 75aa035bcec4b6f26b2f037391607618ed7e0f98..e195d592841258d8dbf2b3e81da32665d2a06c2b 100644
--- a/libgfortran/generated/transpose_i8.c
+++ b/libgfortran/generated/transpose_i8.c
@@ -32,6 +32,8 @@ Boston, MA 02110-1301, USA.  */
 #include <assert.h>
 #include "libgfortran.h"
 
+#if defined (HAVE_GFC_INTEGER_8)
+
 extern void transpose_i8 (gfc_array_i8 * ret, gfc_array_i8 * source);
 export_proto(transpose_i8);
 
@@ -96,3 +98,5 @@ transpose_i8 (gfc_array_i8 * ret, gfc_array_i8 * source)
         rptr += rxstride - (rystride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/intrinsics/ishftc.c b/libgfortran/intrinsics/ishftc.c
index f5e7493b7c589680f914758e45c522d424339b37..a147b9683898e3dfa660ee3e3edd004507ed713f 100644
--- a/libgfortran/intrinsics/ishftc.c
+++ b/libgfortran/intrinsics/ishftc.c
@@ -69,3 +69,25 @@ ishftc8 (GFC_INTEGER_8 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
   bits = i & ~mask;
   return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
 }
+
+#ifdef HAVE_GFC_INTEGER_16
+extern GFC_INTEGER_16 ishftc16 (GFC_INTEGER_16, GFC_INTEGER_4, GFC_INTEGER_4);
+export_proto(ishftc16);
+
+GFC_INTEGER_16
+ishftc16 (GFC_INTEGER_16 i, GFC_INTEGER_4 shift, GFC_INTEGER_4 size)
+{
+  GFC_INTEGER_16 mask;
+  GFC_UINTEGER_16 bits;
+
+  if (shift < 0)
+    shift = shift + size;
+
+  if (shift == 0 || shift == size)
+    return i;
+
+  mask = (~(GFC_INTEGER_16)0) << size;
+  bits = i & ~mask;
+  return (i & mask) | (bits >> (size - shift)) | ((i << shift) & ~mask);
+}
+#endif
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index 49d2c619eeecbb783f0ab1be60bff04d044b6785..174873b67a339315d5827abab140e73b533b3ad3 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -231,8 +231,19 @@ internal_proto(l8_to_l4_offset);
   (GFC_INTEGER_4)((((GFC_UINTEGER_4)1) << 31) - 1)
 #define GFC_INTEGER_8_HUGE \
   (GFC_INTEGER_8)((((GFC_UINTEGER_8)1) << 63) - 1)
+#ifdef HAVE_GFC_INTEGER_16
+#define GFC_INTEGER_16_HUGE \
+  (GFC_INTEGER_16)((((GFC_UINTEGER_16)1) << 127) - 1)
+#endif
+
 #define GFC_REAL_4_HUGE FLT_MAX
 #define GFC_REAL_8_HUGE DBL_MAX
+#ifdef HAVE_GFC_REAL_10
+#define GFC_REAL_10_HUGE LDBL_MAX
+#endif
+#ifdef HAVE_GFC_REAL_16
+#define GFC_REAL_16_HUGE LDBL_MAX
+#endif
 
 #ifndef GFC_MAX_DIMENSIONS
 #define GFC_MAX_DIMENSIONS 7
@@ -259,12 +270,30 @@ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8;
+#ifdef HAVE_GFC_INTEGER_16
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_16) gfc_array_i16;
+#endif
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_4) gfc_array_r4;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_8) gfc_array_r8;
+#ifdef HAVE_GFC_REAL_10
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_10) gfc_array_r10;
+#endif
+#ifdef HAVE_GFC_REAL_16
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_REAL_16) gfc_array_r16;
+#endif
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_4) gfc_array_c4;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_8) gfc_array_c8;
+#ifdef HAVE_GFC_COMPLEX_10
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_10) gfc_array_c10;
+#endif
+#ifdef HAVE_GFC_COMPLEX_16
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_COMPLEX_16) gfc_array_c16;
+#endif
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_4) gfc_array_l4;
 typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_8) gfc_array_l8;
+#ifdef HAVE_GFC_LOGICAL_16
+typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_LOGICAL_16) gfc_array_l16;
+#endif
 
 #define GFC_DTYPE_RANK_MASK 0x07
 #define GFC_DTYPE_TYPE_SHIFT 3
diff --git a/libgfortran/m4/all.m4 b/libgfortran/m4/all.m4
index 5e20473676d007d2816021fb1f5ad44c90bd71bd..3af195552cbcf71c791dde7f5941cacf17767185 100644
--- a/libgfortran/m4/all.m4
+++ b/libgfortran/m4/all.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(1,
 `  /* Return true only if all the elements are set.  */
   result = 1;',
@@ -44,3 +47,4 @@ ARRAY_FUNCTION(1,
       break;
     }')
 
+#endif
diff --git a/libgfortran/m4/any.m4 b/libgfortran/m4/any.m4
index 8c78b3444cac05d3d6693c99690c760d64cd8853..918c9f0eedb3b0f6a4c5ce6c7a46fe6599cb8d8c 100644
--- a/libgfortran/m4/any.m4
+++ b/libgfortran/m4/any.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(0,
 `  result = 0;',
 `  /* Return true if any of the elements are set.  */
@@ -44,3 +47,4 @@ ARRAY_FUNCTION(0,
       break;
     }')
 
+#endif
diff --git a/libgfortran/m4/count.m4 b/libgfortran/m4/count.m4
index 59580febb02cea0d95311d45383ac53332217e23..983dbb71bfa251a9d13697a4f9bc5e22d112ffa2 100644
--- a/libgfortran/m4/count.m4
+++ b/libgfortran/m4/count.m4
@@ -35,8 +35,12 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(0,
 `  result = 0;',
 `  if (*src)
     result++;')
 
+#endif
diff --git a/libgfortran/m4/cshift1.m4 b/libgfortran/m4/cshift1.m4
index 5c3d0b01324a1cda1649b558fde8ab839a69ed46..28494d8f8b98e637348b493dc87ebf80f153a73e 100644
--- a/libgfortran/m4/cshift1.m4
+++ b/libgfortran/m4/cshift1.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'atype_name`)'
+
 static void
 cshift1 (gfc_array_char * ret, const gfc_array_char * array,
 	 const atype * h, const atype_name * pwhich, index_type size)
@@ -220,3 +222,5 @@ cshift1_`'atype_kind`'_char (gfc_array_char * ret,
 {
   cshift1 (ret, array, h, pwhich, array_length);
 }
+
+#endif
diff --git a/libgfortran/m4/dotprod.m4 b/libgfortran/m4/dotprod.m4
index 1410a1a3f3a6904ecbc9d1ffbf1be29ef8f6bcf9..af41fcc8e856b13bfabc458b925b1da491e146ee 100644
--- a/libgfortran/m4/dotprod.m4
+++ b/libgfortran/m4/dotprod.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern rtype_name dot_product_`'rtype_code (rtype * a, rtype * b);
@@ -75,3 +77,5 @@ sinclude(`dotprod_asm_'rtype_code`.m4')dnl
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/m4/dotprodc.m4 b/libgfortran/m4/dotprodc.m4
index 806dd798255a371b009c6d8b755c90ef55ffeab7..36740b077ce6d9112099bcf0c65c5e2925a2ba1c 100644
--- a/libgfortran/m4/dotprodc.m4
+++ b/libgfortran/m4/dotprodc.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 typedef GFC_ARRAY_DESCRIPTOR(GFC_MAX_DIMENSIONS, char) char_array;
 
 extern rtype_name dot_product_`'rtype_code (rtype * a, rtype * b);
@@ -78,3 +80,5 @@ sinclude(`dotprod_asm_'rtype_code`.m4')dnl
 
   return res;
 }
+
+#endif
diff --git a/libgfortran/m4/dotprodl.m4 b/libgfortran/m4/dotprodl.m4
index 56365f03c3dc7081e08345fa3cd5ae367e8e9092..946fe228519f246e4d290db979a07d9dcd3c03b5 100644
--- a/libgfortran/m4/dotprodl.m4
+++ b/libgfortran/m4/dotprodl.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 extern rtype_name dot_product_`'rtype_code (gfc_array_l4 *, gfc_array_l4 *);
 export_proto(dot_product_`'rtype_code);
 
@@ -84,3 +86,5 @@ dot_product_`'rtype_code (gfc_array_l4 * a, gfc_array_l4 * b)
 
   return 0;
 }
+
+#endif
diff --git a/libgfortran/m4/eoshift1.m4 b/libgfortran/m4/eoshift1.m4
index b5245ee42ea55f168e41a86e75160c32c248f41c..cd7a1d852ffd63248cfaa7d5760923c327c33864 100644
--- a/libgfortran/m4/eoshift1.m4
+++ b/libgfortran/m4/eoshift1.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'atype_name`)'
+
 static void
 eoshift1 (gfc_array_char *ret, const gfc_array_char *array, const atype *h,
 	  const char *pbound, const atype_name *pwhich, index_type size,
@@ -246,3 +248,5 @@ eoshift1_`'atype_kind`'_char (gfc_array_char *ret,
 {
   eoshift1 (ret, array, h, pbound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/m4/eoshift3.m4 b/libgfortran/m4/eoshift3.m4
index aa4d8ddd33339ad177cf8d4aa337ea82182dd8ee..318d67f274155d1a7c8b8cb005aa5370ed011636 100644
--- a/libgfortran/m4/eoshift3.m4
+++ b/libgfortran/m4/eoshift3.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'atype_name`)'
+
 static void
 eoshift3 (gfc_array_char *ret, const gfc_array_char *array, const atype *h,
 	  const gfc_array_char *bound, const atype_name *pwhich,
@@ -268,3 +270,5 @@ eoshift3_`'atype_kind`'_char (gfc_array_char *ret,
 {
   eoshift3 (ret, array, h, bound, pwhich, array_length, ' ');
 }
+
+#endif
diff --git a/libgfortran/m4/exponent.m4 b/libgfortran/m4/exponent.m4
index 62217937899c6b478d8b6ef2bddbcb5381c0b495..ca0d13081dd3306d283c6d206a55221c40f87e54 100644
--- a/libgfortran/m4/exponent.m4
+++ b/libgfortran/m4/exponent.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"'
 
 include(`mtype.m4')dnl
 
+`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)'
+
 extern GFC_INTEGER_4 exponent_r`'kind (real_type s);
 export_proto(exponent_r`'kind);
 
@@ -42,3 +46,5 @@ exponent_r`'kind (real_type s)
   frexp`'q (s, &ret);
   return ret;
 }
+
+#endif
diff --git a/libgfortran/m4/fraction.m4 b/libgfortran/m4/fraction.m4
index 9f33c59e3046db53a3ae4492eea40869001a1890..07f8337c6245c6e04d35908f9c8eb8690219e4e2 100644
--- a/libgfortran/m4/fraction.m4
+++ b/libgfortran/m4/fraction.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"'
 
 include(`mtype.m4')dnl
 
+`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)'
+
 extern real_type fraction_r`'kind (real_type s);
 export_proto(fraction_r`'kind);
 
@@ -41,3 +45,5 @@ fraction_r`'kind (real_type s)
   int dummy_exp;
   return frexp`'q (s, &dummy_exp);
 }
+
+#endif
diff --git a/libgfortran/m4/in_pack.m4 b/libgfortran/m4/in_pack.m4
index 1e6fdf574842475c30d7be685fc3048e76716880..cb5be529e7cb3436513dd30a7c9146b83a74e20d 100644
--- a/libgfortran/m4/in_pack.m4
+++ b/libgfortran/m4/in_pack.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 /* Allocates a block of memory with internal_malloc if the array needs
    repacking.  */
 
@@ -124,3 +126,4 @@ rtype_name *
   return destptr;
 }
 
+#endif
diff --git a/libgfortran/m4/in_unpack.m4 b/libgfortran/m4/in_unpack.m4
index 1d2a609c007aefaa9aca610cdd766879b14487e7..131eb5d842a5739322e3ea0305286e5395c64a6f 100644
--- a/libgfortran/m4/in_unpack.m4
+++ b/libgfortran/m4/in_unpack.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 dnl Only the kind (ie size) is used to name the function for integers,
 dnl reals and logicals.  For complex, it's c4 and c8.
 void
@@ -112,3 +114,4 @@ void
     }
 }
 
+#endif
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index 02297b935fa809b9a26860f6605e25639dcd10dc..aca2da06bab64c43280a51ed2b06944b4bbdebbc 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -35,6 +35,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 /* This is a C version of the following fortran pseudo-code. The key
    point is the loop order -- we access all arrays column-first, which
    improves the performance enough to boost galgel spec score by 50%.
@@ -217,3 +219,5 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
 	    dest[x*rxstride + y*rystride] += abase[x*axstride + n*aystride] * bbase[n*bxstride + y*bystride];
     }
 }
+
+#endif
diff --git a/libgfortran/m4/matmull.m4 b/libgfortran/m4/matmull.m4
index c36949c2d81e8e2363f1a037dfa64155d8936ad1..9632a6ab76da5f6e98ecb4ea2732b1d3a0ca8f11 100644
--- a/libgfortran/m4/matmull.m4
+++ b/libgfortran/m4/matmull.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 /* Dimensions: retarray(x,y) a(x, count) b(count,y).
    Either a or b can be rank 1.  In this case x or y is 1.  */
 
@@ -192,3 +194,5 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
       dest += rystride - (rxstride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/m4/maxloc0.m4 b/libgfortran/m4/maxloc0.m4
index e0ea06132f275939a768e8be081753fcdaaaca50..8708a7816097701c09bcee366233be631851eb50 100644
--- a/libgfortran/m4/maxloc0.m4
+++ b/libgfortran/m4/maxloc0.m4
@@ -38,6 +38,8 @@ Boston, MA 02110-1301, USA.  */
 include(iparm.m4)dnl
 include(iforeach.m4)dnl
 
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 FOREACH_FUNCTION(
 `  atype_name maxval;
 
@@ -61,3 +63,5 @@ MASKED_FOREACH_FUNCTION(
       for (n = 0; n < rank; n++)
         dest[n * dstride] = count[n] + 1;
     }')
+
+#endif
diff --git a/libgfortran/m4/maxloc1.m4 b/libgfortran/m4/maxloc1.m4
index 103e15ad9a410cdddaf78528c349a1fd759ec00d..d1ea9dcc9b56017c6d240d0c2c9a7cc121111078 100644
--- a/libgfortran/m4/maxloc1.m4
+++ b/libgfortran/m4/maxloc1.m4
@@ -37,6 +37,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(0,
 `  atype_name maxval;
   maxval = atype_min;
@@ -57,3 +60,4 @@ MASKED_ARRAY_FUNCTION(0,
       result = (rtype_name)n + 1;
     }')
 
+#endif
diff --git a/libgfortran/m4/maxval.m4 b/libgfortran/m4/maxval.m4
index be0613c362cbbc3b8bfa7bcea6bd131fc9c6520d..9bdf0d07cdd7a1b2b6e6b18cb50eafa7833acc35 100644
--- a/libgfortran/m4/maxval.m4
+++ b/libgfortran/m4/maxval.m4
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(atype_min,
 `  result = atype_min;',
 `  if (*src > result)
@@ -46,3 +49,4 @@ MASKED_ARRAY_FUNCTION(atype_min,
 `  if (*msrc && *src > result)
     result = *src;')
 
+#endif
diff --git a/libgfortran/m4/minloc0.m4 b/libgfortran/m4/minloc0.m4
index d2186679cf59d0f2663ce3c565c0a5c100889fe0..10fb3a9119d03a0e982820beb95b933c62108878 100644
--- a/libgfortran/m4/minloc0.m4
+++ b/libgfortran/m4/minloc0.m4
@@ -38,6 +38,8 @@ Boston, MA 02110-1301, USA.  */
 include(iparm.m4)dnl
 include(iforeach.m4)dnl
 
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 FOREACH_FUNCTION(
 `  atype_name minval;
 
@@ -61,3 +63,5 @@ MASKED_FOREACH_FUNCTION(
       for (n = 0; n < rank; n++)
         dest[n * dstride] = count[n] + 1;
     }')
+
+#endif
diff --git a/libgfortran/m4/minloc1.m4 b/libgfortran/m4/minloc1.m4
index d2eaff9fc96a6ce6e116c86f328a41750a85b35d..a224b73259232504dbfef11faed2859177a05654 100644
--- a/libgfortran/m4/minloc1.m4
+++ b/libgfortran/m4/minloc1.m4
@@ -37,6 +37,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(0,
 `  atype_name minval;
   minval = atype_max;
@@ -57,3 +60,4 @@ MASKED_ARRAY_FUNCTION(0,
       result = (rtype_name)n + 1;
     }')
 
+#endif
diff --git a/libgfortran/m4/minval.m4 b/libgfortran/m4/minval.m4
index 2fea1cdd74abc94d5e85b32744d4eb0f3614cfed..9bd37f4d1fb5eb543707b3fbd4b653ed03b24c4f 100644
--- a/libgfortran/m4/minval.m4
+++ b/libgfortran/m4/minval.m4
@@ -36,6 +36,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(atype_max,
 `  result = atype_max;',
 `  if (*src < result)
@@ -46,3 +49,4 @@ MASKED_ARRAY_FUNCTION(atype_max,
 `  if (*msrc && *src < result)
     result = *src;')
 
+#endif
diff --git a/libgfortran/m4/mtype.m4 b/libgfortran/m4/mtype.m4
index 84bf39f3561c9ce421be25e3b316f51421ebc9a7..8e7e889bf0e720dbeb85c4cce3a71a8ebdc775de 100644
--- a/libgfortran/m4/mtype.m4
+++ b/libgfortran/m4/mtype.m4
@@ -2,4 +2,5 @@ dnl Get type kind from filename.
 define(kind,regexp(file, `_.\([0-9]+\).c$', `\1'))dnl
 define(complex_type, `GFC_COMPLEX_'kind)dnl
 define(real_type, `GFC_REAL_'kind)dnl
-define(q,ifelse(kind,4,f,ifelse(kind,8,`',`_'kind)))dnl
+define(q,ifelse(kind,4,f,ifelse(kind,8,`',ifelse(kind,10,l,ifelse(kind,16,l,`_'kind)))))dnl
+define(Q,translit(q,`a-z',`A-Z'))dnl
diff --git a/libgfortran/m4/nearest.m4 b/libgfortran/m4/nearest.m4
index ce83dc500ff1db4df294dbf17f2d57aaeba30219..598ba4e3c94b8c9c8c3ecb5a5d9e1c0a86e321b0 100644
--- a/libgfortran/m4/nearest.m4
+++ b/libgfortran/m4/nearest.m4
@@ -27,12 +27,16 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include <float.h>
 #include "libgfortran.h"'
 
 include(`mtype.m4')dnl
 
+`#if defined (HAVE_'real_type`) && defined (HAVE_COPYSIGN'Q`) && defined (HAVE_NEXTAFTER'Q`)'
+
 extern real_type nearest_r`'kind (real_type s, real_type dir);
 export_proto(nearest_r`'kind);
 
@@ -49,3 +53,5 @@ nearest_r`'kind (real_type s, real_type dir)
   else
     return nextafter`'q (s, dir);
 }
+
+#endif
diff --git a/libgfortran/m4/pow.m4 b/libgfortran/m4/pow.m4
index c7ed7664c3ee1d08c07dfb1bbbc64e94fc041d86..ae490040c652ca0571de65f03282b46ea974b41d 100644
--- a/libgfortran/m4/pow.m4
+++ b/libgfortran/m4/pow.m4
@@ -37,6 +37,8 @@ include(iparm.m4)dnl
    Powers" of Donald E. Knuth, "Seminumerical Algorithms", Vol. 2, "The Art
    of Computer Programming", 3rd Edition, 1998.  */
 
+`#if defined (HAVE_'rtype_name`) && defined (HAVE_'atype_name`)'
+
 rtype_name `pow_'rtype_code`_'atype_code (rtype_name a, atype_name b);
 export_proto(pow_`'rtype_code`_'atype_code);
 
@@ -78,3 +80,5 @@ ifelse(rtype_letter,i,`dnl
     }
   return pow;
 }
+
+#endif
diff --git a/libgfortran/m4/product.m4 b/libgfortran/m4/product.m4
index 6e9581d6fbaa1f49887df4918a087e01fe3fc397..df77372e8b0aaeede01898dee749acec712eba27 100644
--- a/libgfortran/m4/product.m4
+++ b/libgfortran/m4/product.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(1,
 `  result = 1;',
 `  result *= *src;')
@@ -44,3 +47,4 @@ MASKED_ARRAY_FUNCTION(1,
 `  if (*msrc)
     result *= *src;')
 
+#endif
diff --git a/libgfortran/m4/reshape.m4 b/libgfortran/m4/reshape.m4
index adc6df0bbdad5267b4a90ea64d8dc2ecc9fd1a2d..c43828ca50a799ceb70b27d8b5800b60da5da84f 100644
--- a/libgfortran/m4/reshape.m4
+++ b/libgfortran/m4/reshape.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 typedef GFC_ARRAY_DESCRIPTOR(1, index_type) shape_type;
 
 /* The shape parameter is ignored. We can currently deduce the shape from the
@@ -258,3 +260,5 @@ reshape_`'rtype_ccode (rtype * ret, rtype * source, shape_type * shape,
         }
     }
 }
+
+#endif
diff --git a/libgfortran/m4/set_exponent.m4 b/libgfortran/m4/set_exponent.m4
index 797906c97b58102e33df7da8b72cbfb13630b1e6..91ba9523b980508e15e9e8274693f17d8b0e254f 100644
--- a/libgfortran/m4/set_exponent.m4
+++ b/libgfortran/m4/set_exponent.m4
@@ -27,11 +27,15 @@ You should have received a copy of the GNU General Public
 License along with libgfortran; see the file COPYING.  If not,
 write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
+
+#include "config.h"
 #include <math.h>
 #include "libgfortran.h"'
 
 include(`mtype.m4')dnl
 
+`#if defined (HAVE_'real_type`) && defined (HAVE_SCALBN'Q`) && defined (HAVE_FREXP'Q`)'
+
 extern real_type set_exponent_r`'kind (real_type s, GFC_INTEGER_4 i);
 export_proto(set_exponent_r`'kind);
 
@@ -41,3 +45,5 @@ set_exponent_r`'kind (real_type s, GFC_INTEGER_4 i)
   int dummy_exp;
   return scalbn`'q (frexp`'q (s, &dummy_exp), i);
 }
+
+#endif
diff --git a/libgfortran/m4/shape.m4 b/libgfortran/m4/shape.m4
index 5481ba07cb6acb9e2e59c7c0c2ca5a2751d6fe52..1b9e10077c0cecb4430df37c09ef6e4a0bf6b4d4 100644
--- a/libgfortran/m4/shape.m4
+++ b/libgfortran/m4/shape.m4
@@ -34,6 +34,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 extern void shape_`'rtype_kind (rtype * ret, const rtype * array);
 export_proto(shape_`'rtype_kind);
 
@@ -53,3 +55,5 @@ shape_`'rtype_kind (rtype * ret, const rtype * array)
         array->dim[n].ubound + 1 - array->dim[n].lbound;
     }
 }
+
+#endif
diff --git a/libgfortran/m4/specific.m4 b/libgfortran/m4/specific.m4
index a6cea730a79c36c9ad07b32fe7154f377eab70a8..e473effb566bd6b0a979f90370a5219ce3910c33 100644
--- a/libgfortran/m4/specific.m4
+++ b/libgfortran/m4/specific.m4
@@ -1,5 +1,5 @@
 include(head.m4)
-define(atype_code,regexp(file,`_\([ircl][0-9]+\).f90',`\1'))dnl
+define(atype_code,regexp(file,`_\([ircl][0-9]+\).[fF]90',`\1'))dnl
 define(atype_letter,substr(atype_code, 0, 1))dnl
 define(atype_kind,substr(atype_code, 1))dnl
 define(get_typename2, `$1 (kind=$2)')dnl
@@ -8,9 +8,35 @@ define(atype_name, get_typename(atype_letter,atype_kind))dnl
 define(name, regexp(regexp(file, `[^/]*$', `\&'), `^_\([^_]*\)_', `\1'))dnl
 define(function_name,`specific__'name`_'atype_code)dnl
 
+define(type,ifelse(atype_letter,l,LOGICAL,ifelse(atype_letter,i,INTEGER,ifelse(atype_letter,r,REAL,ifelse(atype_letter,c,COMPLEX,UNKNOW)))))dnl
+define(Q,ifelse(atype_kind,4,F,ifelse(atype_kind,8,`',ifelse(atype_kind,10,L,ifelse(atype_kind,16,L,`_'atype_kind)))))dnl
+
+dnl A few specifics require a function other than their name, or
+dnl nothing. The list is currently:
+dnl    - integer and logical specifics require no libm function
+dnl    - AINT requires the trunc() family functions
+dnl    - ANINT requires round()
+dnl    - CONJG, DIM, SIGN require no libm function
+define(needed,ifelse(atype_letter,i,`none',ifelse(atype_letter,l,`none',ifelse(name,aint,trunc,ifelse(name,anint,round,ifelse(name,conjg,none,ifelse(name,dim,none,ifelse(name,sign,none,ifelse(name,abs,fabs,name)))))))))dnl
+define(prefix,ifelse(atype_letter,c,C,`'))dnl
+
+dnl Special case for fabs, for which the corresponding complex function
+dnl is not cfabs but cabs.
+define(NEEDED,translit(ifelse(prefix`'needed,`Cfabs',`abs',needed),`a-z',`A-Z'))dnl
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+`#if defined (HAVE_GFC_'type`_'atype_kind`)'
+ifelse(NEEDED,NONE,`',`#ifdef HAVE_'prefix`'NEEDED`'Q)
+
 elemental function function_name (parm)
    atype_name, intent (in) :: parm
    atype_name :: function_name
 
    function_name = name (parm)
 end function
+
+ifelse(NEEDED,NONE,`',`#endif')
+#endif
diff --git a/libgfortran/m4/specific2.m4 b/libgfortran/m4/specific2.m4
index dab90b0aeb0853cea13e6385c7d79e7962171d06..fa26f397698215ed6b4554ca244903d5bb8c850f 100644
--- a/libgfortran/m4/specific2.m4
+++ b/libgfortran/m4/specific2.m4
@@ -1,5 +1,5 @@
 include(head.m4)
-define(atype_code,regexp(file,`_\([ircl][0-9]+\).f90',`\1'))dnl
+define(atype_code,regexp(file,`_\([ircl][0-9]+\).[fF]90',`\1'))dnl
 define(atype_letter,substr(atype_code, 0, 1))dnl
 define(atype_kind,substr(atype_code, 1))dnl
 define(get_typename2, `$1 (kind=$2)')dnl
@@ -8,9 +8,23 @@ define(atype_name, get_typename(atype_letter,atype_kind))dnl
 define(name, regexp(regexp(file, `[^/]*$', `\&'), `^_\([^_]*\)_', `\1'))dnl
 define(function_name,`specific__'name`_'atype_code)dnl
 
+define(Q,ifelse(atype_kind,4,F,ifelse(atype_kind,8,`',ifelse(atype_kind,10,L,ifelse(atype_kind,16,L,`_'atype_kind)))))dnl
+
+#include "config.h"
+#include "kinds.inc"
+#include "c99_protos.inc"
+
+`#if defined (HAVE_GFC_'ifelse(atype_letter,l,LOGICAL,ifelse(atype_letter,i,INTEGER,ifelse(atype_letter,r,REAL,ifelse(atype_letter,c,COMPLEX,UNKNOW))))`_'atype_kind`)'
+
+ifelse(name,atan2,`#ifdef HAVE_ATAN2'Q,)
+
 elemental function function_name (p1, p2)
    atype_name, intent (in) :: p1, p2
    atype_name :: function_name
 
    function_name = name (p1, p2)
 end function
+
+ifelse(name,atan2,`#endif',)
+
+#endif
diff --git a/libgfortran/m4/sum.m4 b/libgfortran/m4/sum.m4
index 8dcc7aac24246bd4dca1ef8c60eca30226110278..1d91c0d510090fe6a6c01856f40038612e42b84c 100644
--- a/libgfortran/m4/sum.m4
+++ b/libgfortran/m4/sum.m4
@@ -35,6 +35,9 @@ Boston, MA 02110-1301, USA.  */
 
 include(iparm.m4)dnl
 include(ifunction.m4)dnl
+
+`#if defined (HAVE_'atype_name`) && defined (HAVE_'rtype_name`)'
+
 ARRAY_FUNCTION(0,
 `  result = 0;',
 `  result += *src;')
@@ -43,3 +46,5 @@ MASKED_ARRAY_FUNCTION(0,
 `  result = 0;',
 `  if (*msrc)
     result += *src;')
+
+#endif
diff --git a/libgfortran/m4/transpose.m4 b/libgfortran/m4/transpose.m4
index cfd817576aadaf3f933c4561882c89e8aa0171db..56669cecef133825e5ddc525dd4b54a41cb1382c 100644
--- a/libgfortran/m4/transpose.m4
+++ b/libgfortran/m4/transpose.m4
@@ -33,6 +33,8 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"'
 include(iparm.m4)dnl
 
+`#if defined (HAVE_'rtype_name`)'
+
 extern void transpose_`'rtype_code (rtype * ret, rtype * source);
 export_proto(transpose_`'rtype_code);
 
@@ -97,3 +99,5 @@ transpose_`'rtype_code (rtype * ret, rtype * source)
         rptr += rxstride - (rystride * xcount);
     }
 }
+
+#endif
diff --git a/libgfortran/mk-kinds-h.sh b/libgfortran/mk-kinds-h.sh
index 6f292bf48a8aed4caa26bfb8aac1cb009260ffd3..98328b6323a7f7dc6f8176ea8bd3f68589d8a00f 100755
--- a/libgfortran/mk-kinds-h.sh
+++ b/libgfortran/mk-kinds-h.sh
@@ -24,6 +24,7 @@ for k in $possible_integer_kinds; do
     echo "typedef ${prefix}int${s}_t GFC_INTEGER_${k};"
     echo "typedef ${prefix}uint${s}_t GFC_UINTEGER_${k};"
     echo "typedef GFC_INTEGER_${k} GFC_LOGICAL_${k};"
+    echo "#define HAVE_GFC_LOGICAL_${k}"
     echo "#define HAVE_GFC_INTEGER_${k}"
   fi
   rm -f tmp$$.*
@@ -50,6 +51,7 @@ for k in $possible_real_kinds; do
     echo "typedef ${ctype} GFC_REAL_${k};"
     echo "typedef complex ${ctype} GFC_COMPLEX_${k};"
     echo "#define HAVE_GFC_REAL_${k}"
+    echo "#define HAVE_GFC_COMPLEX_${k}"
   fi
   rm -f tmp$$.*
 done