[v2,1/3] libgfortran: Don't skip allocation if size is zero [PR112412]

Message ID 20231107102404.1723120-2-mikael@gcc.gnu.org
State Accepted
Headers
Series libgfortran: empty array fixes |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Mikael Morin Nov. 7, 2023, 10:24 a.m. UTC
  In the function template of transformational functions doing a reduction
of an array along one dimension, if the passed in result array was
unallocated and the calculated allocation size was zero (this is the case
of empty result arrays), an early return used to skip the allocation.  This
change moves the allocation before the early return, so that empty result
arrays are not seen as unallocated.  This is possible because zero size is
explicitly supported by the allocation function.

The offending code is present in several places, and this updates them all.
More precisely, there is one place in the template for logical reductions,
and there are two places in the templates corresponding to masked reductions
with respectively array mask and scalar mask.  Templates for unmasked
reductions, which already allocate before returning, are not affected, but
unmasked reductions are checked nevertheless in the testcase.  The affected
m4 files are ifunction.m4 for regular functions and types, ifunction-s.m4
for character minloc and maxloc, ifunction-s2.m4 for character minval and
maxval, and ifunction_logical for logical reductions.

	PR fortran/112412

libgfortran/ChangeLog:

	* m4/ifunction.m4 (START_MASKED_ARRAY_FUNCTION, SCALAR_ARRAY_FUNCTION):
	Don't skip allocation if the allocation size is zero.
	* m4/ifunction-s.m4 (START_MASKED_ARRAY_FUNCTION,
	SCALAR_ARRAY_FUNCTION): Ditto.
	* m4/ifunction-s2.m4 (START_MASKED_ARRAY_FUNCTION,
	SCALAR_ARRAY_FUNCTION): Ditto.
	* m4/ifunction_logical.m4 (START_ARRAY_FUNCTION): Ditto.
	* generated/all_l1.c: Regenerate.
	* generated/all_l16.c: Regenerate.
	* generated/all_l2.c: Regenerate.
	* generated/all_l4.c: Regenerate.
	* generated/all_l8.c: Regenerate.
	* generated/any_l1.c: Regenerate.
	* generated/any_l16.c: Regenerate.
	* generated/any_l2.c: Regenerate.
	* generated/any_l4.c: Regenerate.
	* generated/any_l8.c: Regenerate.
	* generated/count_16_l.c: Regenerate.
	* generated/count_1_l.c: Regenerate.
	* generated/count_2_l.c: Regenerate.
	* generated/count_4_l.c: Regenerate.
	* generated/count_8_l.c: Regenerate.
	* generated/iall_i1.c: Regenerate.
	* generated/iall_i16.c: Regenerate.
	* generated/iall_i2.c: Regenerate.
	* generated/iall_i4.c: Regenerate.
	* generated/iall_i8.c: Regenerate.
	* generated/iany_i1.c: Regenerate.
	* generated/iany_i16.c: Regenerate.
	* generated/iany_i2.c: Regenerate.
	* generated/iany_i4.c: Regenerate.
	* generated/iany_i8.c: Regenerate.
	* generated/iparity_i1.c: Regenerate.
	* generated/iparity_i16.c: Regenerate.
	* generated/iparity_i2.c: Regenerate.
	* generated/iparity_i4.c: Regenerate.
	* generated/iparity_i8.c: Regenerate.
	* generated/maxloc1_16_i1.c: Regenerate.
	* generated/maxloc1_16_i16.c: Regenerate.
	* generated/maxloc1_16_i2.c: Regenerate.
	* generated/maxloc1_16_i4.c: Regenerate.
	* generated/maxloc1_16_i8.c: Regenerate.
	* generated/maxloc1_16_r10.c: Regenerate.
	* generated/maxloc1_16_r16.c: Regenerate.
	* generated/maxloc1_16_r17.c: Regenerate.
	* generated/maxloc1_16_r4.c: Regenerate.
	* generated/maxloc1_16_r8.c: Regenerate.
	* generated/maxloc1_16_s1.c: Regenerate.
	* generated/maxloc1_16_s4.c: Regenerate.
	* generated/maxloc1_4_i1.c: Regenerate.
	* generated/maxloc1_4_i16.c: Regenerate.
	* generated/maxloc1_4_i2.c: Regenerate.
	* generated/maxloc1_4_i4.c: Regenerate.
	* generated/maxloc1_4_i8.c: Regenerate.
	* generated/maxloc1_4_r10.c: Regenerate.
	* generated/maxloc1_4_r16.c: Regenerate.
	* generated/maxloc1_4_r17.c: Regenerate.
	* generated/maxloc1_4_r4.c: Regenerate.
	* generated/maxloc1_4_r8.c: Regenerate.
	* generated/maxloc1_4_s1.c: Regenerate.
	* generated/maxloc1_4_s4.c: Regenerate.
	* generated/maxloc1_8_i1.c: Regenerate.
	* generated/maxloc1_8_i16.c: Regenerate.
	* generated/maxloc1_8_i2.c: Regenerate.
	* generated/maxloc1_8_i4.c: Regenerate.
	* generated/maxloc1_8_i8.c: Regenerate.
	* generated/maxloc1_8_r10.c: Regenerate.
	* generated/maxloc1_8_r16.c: Regenerate.
	* generated/maxloc1_8_r17.c: Regenerate.
	* generated/maxloc1_8_r4.c: Regenerate.
	* generated/maxloc1_8_r8.c: Regenerate.
	* generated/maxloc1_8_s1.c: Regenerate.
	* generated/maxloc1_8_s4.c: Regenerate.
	* generated/maxval1_s1.c: Regenerate.
	* generated/maxval1_s4.c: Regenerate.
	* generated/maxval_i1.c: Regenerate.
	* generated/maxval_i16.c: Regenerate.
	* generated/maxval_i2.c: Regenerate.
	* generated/maxval_i4.c: Regenerate.
	* generated/maxval_i8.c: Regenerate.
	* generated/maxval_r10.c: Regenerate.
	* generated/maxval_r16.c: Regenerate.
	* generated/maxval_r17.c: Regenerate.
	* generated/maxval_r4.c: Regenerate.
	* generated/maxval_r8.c: Regenerate.
	* generated/minloc1_16_i1.c: Regenerate.
	* generated/minloc1_16_i16.c: Regenerate.
	* generated/minloc1_16_i2.c: Regenerate.
	* generated/minloc1_16_i4.c: Regenerate.
	* generated/minloc1_16_i8.c: Regenerate.
	* generated/minloc1_16_r10.c: Regenerate.
	* generated/minloc1_16_r16.c: Regenerate.
	* generated/minloc1_16_r17.c: Regenerate.
	* generated/minloc1_16_r4.c: Regenerate.
	* generated/minloc1_16_r8.c: Regenerate.
	* generated/minloc1_16_s1.c: Regenerate.
	* generated/minloc1_16_s4.c: Regenerate.
	* generated/minloc1_4_i1.c: Regenerate.
	* generated/minloc1_4_i16.c: Regenerate.
	* generated/minloc1_4_i2.c: Regenerate.
	* generated/minloc1_4_i4.c: Regenerate.
	* generated/minloc1_4_i8.c: Regenerate.
	* generated/minloc1_4_r10.c: Regenerate.
	* generated/minloc1_4_r16.c: Regenerate.
	* generated/minloc1_4_r17.c: Regenerate.
	* generated/minloc1_4_r4.c: Regenerate.
	* generated/minloc1_4_r8.c: Regenerate.
	* generated/minloc1_4_s1.c: Regenerate.
	* generated/minloc1_4_s4.c: Regenerate.
	* generated/minloc1_8_i1.c: Regenerate.
	* generated/minloc1_8_i16.c: Regenerate.
	* generated/minloc1_8_i2.c: Regenerate.
	* generated/minloc1_8_i4.c: Regenerate.
	* generated/minloc1_8_i8.c: Regenerate.
	* generated/minloc1_8_r10.c: Regenerate.
	* generated/minloc1_8_r16.c: Regenerate.
	* generated/minloc1_8_r17.c: Regenerate.
	* generated/minloc1_8_r4.c: Regenerate.
	* generated/minloc1_8_r8.c: Regenerate.
	* generated/minloc1_8_s1.c: Regenerate.
	* generated/minloc1_8_s4.c: Regenerate.
	* generated/minval1_s1.c: Regenerate.
	* generated/minval1_s4.c: Regenerate.
	* generated/minval_i1.c: Regenerate.
	* generated/minval_i16.c: Regenerate.
	* generated/minval_i2.c: Regenerate.
	* generated/minval_i4.c: Regenerate.
	* generated/minval_i8.c: Regenerate.
	* generated/minval_r10.c: Regenerate.
	* generated/minval_r16.c: Regenerate.
	* generated/minval_r17.c: Regenerate.
	* generated/minval_r4.c: Regenerate.
	* generated/minval_r8.c: Regenerate.
	* generated/product_c10.c: Regenerate.
	* generated/product_c16.c: Regenerate.
	* generated/product_c17.c: Regenerate.
	* generated/product_c4.c: Regenerate.
	* generated/product_c8.c: Regenerate.
	* generated/product_i1.c: Regenerate.
	* generated/product_i16.c: Regenerate.
	* generated/product_i2.c: Regenerate.
	* generated/product_i4.c: Regenerate.
	* generated/product_i8.c: Regenerate.
	* generated/product_r10.c: Regenerate.
	* generated/product_r16.c: Regenerate.
	* generated/product_r17.c: Regenerate.
	* generated/product_r4.c: Regenerate.
	* generated/product_r8.c: Regenerate.
	* generated/sum_c10.c: Regenerate.
	* generated/sum_c16.c: Regenerate.
	* generated/sum_c17.c: Regenerate.
	* generated/sum_c4.c: Regenerate.
	* generated/sum_c8.c: Regenerate.
	* generated/sum_i1.c: Regenerate.
	* generated/sum_i16.c: Regenerate.
	* generated/sum_i2.c: Regenerate.
	* generated/sum_i4.c: Regenerate.
	* generated/sum_i8.c: Regenerate.
	* generated/sum_r10.c: Regenerate.
	* generated/sum_r16.c: Regenerate.
	* generated/sum_r17.c: Regenerate.
	* generated/sum_r4.c: Regenerate.
	* generated/sum_r8.c: Regenerate.

gcc/testsuite/ChangeLog:

	* gfortran.dg/allocated_4.f90: New test.
---
 gcc/testsuite/gfortran.dg/allocated_4.f90 | 195 ++++++++++++++++++++++
 libgfortran/generated/all_l1.c            |   3 +-
 libgfortran/generated/all_l16.c           |   3 +-
 libgfortran/generated/all_l2.c            |   3 +-
 libgfortran/generated/all_l4.c            |   3 +-
 libgfortran/generated/all_l8.c            |   3 +-
 libgfortran/generated/any_l1.c            |   3 +-
 libgfortran/generated/any_l16.c           |   3 +-
 libgfortran/generated/any_l2.c            |   3 +-
 libgfortran/generated/any_l4.c            |   3 +-
 libgfortran/generated/any_l8.c            |   3 +-
 libgfortran/generated/count_16_l.c        |   3 +-
 libgfortran/generated/count_1_l.c         |   3 +-
 libgfortran/generated/count_2_l.c         |   3 +-
 libgfortran/generated/count_4_l.c         |   3 +-
 libgfortran/generated/count_8_l.c         |   3 +-
 libgfortran/generated/iall_i1.c           |   7 +-
 libgfortran/generated/iall_i16.c          |   7 +-
 libgfortran/generated/iall_i2.c           |   7 +-
 libgfortran/generated/iall_i4.c           |   7 +-
 libgfortran/generated/iall_i8.c           |   7 +-
 libgfortran/generated/iany_i1.c           |   7 +-
 libgfortran/generated/iany_i16.c          |   7 +-
 libgfortran/generated/iany_i2.c           |   7 +-
 libgfortran/generated/iany_i4.c           |   7 +-
 libgfortran/generated/iany_i8.c           |   7 +-
 libgfortran/generated/iparity_i1.c        |   7 +-
 libgfortran/generated/iparity_i16.c       |   7 +-
 libgfortran/generated/iparity_i2.c        |   7 +-
 libgfortran/generated/iparity_i4.c        |   7 +-
 libgfortran/generated/iparity_i8.c        |   7 +-
 libgfortran/generated/maxloc1_16_i1.c     |   7 +-
 libgfortran/generated/maxloc1_16_i16.c    |   7 +-
 libgfortran/generated/maxloc1_16_i2.c     |   7 +-
 libgfortran/generated/maxloc1_16_i4.c     |   7 +-
 libgfortran/generated/maxloc1_16_i8.c     |   7 +-
 libgfortran/generated/maxloc1_16_r10.c    |   7 +-
 libgfortran/generated/maxloc1_16_r16.c    |   7 +-
 libgfortran/generated/maxloc1_16_r17.c    |   7 +-
 libgfortran/generated/maxloc1_16_r4.c     |   7 +-
 libgfortran/generated/maxloc1_16_r8.c     |   7 +-
 libgfortran/generated/maxloc1_16_s1.c     |   7 +-
 libgfortran/generated/maxloc1_16_s4.c     |   7 +-
 libgfortran/generated/maxloc1_4_i1.c      |   7 +-
 libgfortran/generated/maxloc1_4_i16.c     |   7 +-
 libgfortran/generated/maxloc1_4_i2.c      |   7 +-
 libgfortran/generated/maxloc1_4_i4.c      |   7 +-
 libgfortran/generated/maxloc1_4_i8.c      |   7 +-
 libgfortran/generated/maxloc1_4_r10.c     |   7 +-
 libgfortran/generated/maxloc1_4_r16.c     |   7 +-
 libgfortran/generated/maxloc1_4_r17.c     |   7 +-
 libgfortran/generated/maxloc1_4_r4.c      |   7 +-
 libgfortran/generated/maxloc1_4_r8.c      |   7 +-
 libgfortran/generated/maxloc1_4_s1.c      |   7 +-
 libgfortran/generated/maxloc1_4_s4.c      |   7 +-
 libgfortran/generated/maxloc1_8_i1.c      |   7 +-
 libgfortran/generated/maxloc1_8_i16.c     |   7 +-
 libgfortran/generated/maxloc1_8_i2.c      |   7 +-
 libgfortran/generated/maxloc1_8_i4.c      |   7 +-
 libgfortran/generated/maxloc1_8_i8.c      |   7 +-
 libgfortran/generated/maxloc1_8_r10.c     |   7 +-
 libgfortran/generated/maxloc1_8_r16.c     |   7 +-
 libgfortran/generated/maxloc1_8_r17.c     |   7 +-
 libgfortran/generated/maxloc1_8_r4.c      |   7 +-
 libgfortran/generated/maxloc1_8_r8.c      |   7 +-
 libgfortran/generated/maxloc1_8_s1.c      |   7 +-
 libgfortran/generated/maxloc1_8_s4.c      |   7 +-
 libgfortran/generated/maxval1_s1.c        |   7 +-
 libgfortran/generated/maxval1_s4.c        |   7 +-
 libgfortran/generated/maxval_i1.c         |   7 +-
 libgfortran/generated/maxval_i16.c        |   7 +-
 libgfortran/generated/maxval_i2.c         |   7 +-
 libgfortran/generated/maxval_i4.c         |   7 +-
 libgfortran/generated/maxval_i8.c         |   7 +-
 libgfortran/generated/maxval_r10.c        |   7 +-
 libgfortran/generated/maxval_r16.c        |   7 +-
 libgfortran/generated/maxval_r17.c        |   7 +-
 libgfortran/generated/maxval_r4.c         |   7 +-
 libgfortran/generated/maxval_r8.c         |   7 +-
 libgfortran/generated/minloc1_16_i1.c     |   7 +-
 libgfortran/generated/minloc1_16_i16.c    |   7 +-
 libgfortran/generated/minloc1_16_i2.c     |   7 +-
 libgfortran/generated/minloc1_16_i4.c     |   7 +-
 libgfortran/generated/minloc1_16_i8.c     |   7 +-
 libgfortran/generated/minloc1_16_r10.c    |   7 +-
 libgfortran/generated/minloc1_16_r16.c    |   7 +-
 libgfortran/generated/minloc1_16_r17.c    |   7 +-
 libgfortran/generated/minloc1_16_r4.c     |   7 +-
 libgfortran/generated/minloc1_16_r8.c     |   7 +-
 libgfortran/generated/minloc1_16_s1.c     |   7 +-
 libgfortran/generated/minloc1_16_s4.c     |   7 +-
 libgfortran/generated/minloc1_4_i1.c      |   7 +-
 libgfortran/generated/minloc1_4_i16.c     |   7 +-
 libgfortran/generated/minloc1_4_i2.c      |   7 +-
 libgfortran/generated/minloc1_4_i4.c      |   7 +-
 libgfortran/generated/minloc1_4_i8.c      |   7 +-
 libgfortran/generated/minloc1_4_r10.c     |   7 +-
 libgfortran/generated/minloc1_4_r16.c     |   7 +-
 libgfortran/generated/minloc1_4_r17.c     |   7 +-
 libgfortran/generated/minloc1_4_r4.c      |   7 +-
 libgfortran/generated/minloc1_4_r8.c      |   7 +-
 libgfortran/generated/minloc1_4_s1.c      |   7 +-
 libgfortran/generated/minloc1_4_s4.c      |   7 +-
 libgfortran/generated/minloc1_8_i1.c      |   7 +-
 libgfortran/generated/minloc1_8_i16.c     |   7 +-
 libgfortran/generated/minloc1_8_i2.c      |   7 +-
 libgfortran/generated/minloc1_8_i4.c      |   7 +-
 libgfortran/generated/minloc1_8_i8.c      |   7 +-
 libgfortran/generated/minloc1_8_r10.c     |   7 +-
 libgfortran/generated/minloc1_8_r16.c     |   7 +-
 libgfortran/generated/minloc1_8_r17.c     |   7 +-
 libgfortran/generated/minloc1_8_r4.c      |   7 +-
 libgfortran/generated/minloc1_8_r8.c      |   7 +-
 libgfortran/generated/minloc1_8_s1.c      |   7 +-
 libgfortran/generated/minloc1_8_s4.c      |   7 +-
 libgfortran/generated/minval1_s1.c        |   7 +-
 libgfortran/generated/minval1_s4.c        |   7 +-
 libgfortran/generated/minval_i1.c         |   7 +-
 libgfortran/generated/minval_i16.c        |   7 +-
 libgfortran/generated/minval_i2.c         |   7 +-
 libgfortran/generated/minval_i4.c         |   7 +-
 libgfortran/generated/minval_i8.c         |   7 +-
 libgfortran/generated/minval_r10.c        |   7 +-
 libgfortran/generated/minval_r16.c        |   7 +-
 libgfortran/generated/minval_r17.c        |   7 +-
 libgfortran/generated/minval_r4.c         |   7 +-
 libgfortran/generated/minval_r8.c         |   7 +-
 libgfortran/generated/product_c10.c       |   7 +-
 libgfortran/generated/product_c16.c       |   7 +-
 libgfortran/generated/product_c17.c       |   7 +-
 libgfortran/generated/product_c4.c        |   7 +-
 libgfortran/generated/product_c8.c        |   7 +-
 libgfortran/generated/product_i1.c        |   7 +-
 libgfortran/generated/product_i16.c       |   7 +-
 libgfortran/generated/product_i2.c        |   7 +-
 libgfortran/generated/product_i4.c        |   7 +-
 libgfortran/generated/product_i8.c        |   7 +-
 libgfortran/generated/product_r10.c       |   7 +-
 libgfortran/generated/product_r16.c       |   7 +-
 libgfortran/generated/product_r17.c       |   7 +-
 libgfortran/generated/product_r4.c        |   7 +-
 libgfortran/generated/product_r8.c        |   7 +-
 libgfortran/generated/sum_c10.c           |   7 +-
 libgfortran/generated/sum_c16.c           |   7 +-
 libgfortran/generated/sum_c17.c           |   7 +-
 libgfortran/generated/sum_c4.c            |   7 +-
 libgfortran/generated/sum_c8.c            |   7 +-
 libgfortran/generated/sum_i1.c            |   7 +-
 libgfortran/generated/sum_i16.c           |   7 +-
 libgfortran/generated/sum_i2.c            |   7 +-
 libgfortran/generated/sum_i4.c            |   7 +-
 libgfortran/generated/sum_i8.c            |   7 +-
 libgfortran/generated/sum_r10.c           |   7 +-
 libgfortran/generated/sum_r16.c           |   7 +-
 libgfortran/generated/sum_r17.c           |   7 +-
 libgfortran/generated/sum_r4.c            |   7 +-
 libgfortran/generated/sum_r8.c            |   7 +-
 libgfortran/m4/ifunction-s.m4             |   7 +-
 libgfortran/m4/ifunction-s2.m4            |   7 +-
 libgfortran/m4/ifunction.m4               |   7 +-
 libgfortran/m4/ifunction_logical.m4       |   3 +-
 161 files changed, 499 insertions(+), 752 deletions(-)
 create mode 100644 gcc/testsuite/gfortran.dg/allocated_4.f90
  

Patch

diff --git a/gcc/testsuite/gfortran.dg/allocated_4.f90 b/gcc/testsuite/gfortran.dg/allocated_4.f90
new file mode 100644
index 00000000000..485806be287
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/allocated_4.f90
@@ -0,0 +1,195 @@ 
+! { dg-do run }
+!
+! PR fortran/112412
+! The library used to not allocate memory for the result of transformational
+! functions reducing an array along one dimension, if the result of the
+! function was an empty array.  This caused the result to be seen as
+! an unallocated array.
+
+program p
+  implicit none
+  call check_iparity
+  call check_sum
+  call check_minloc_int
+  call check_minloc_char
+  call check_maxloc_char4
+  call check_minval_char
+  call check_maxval_char4
+  call check_any
+  call check_count4
+contains
+  subroutine check_iparity
+    integer :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ integer:: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 1
+    r = iparity(a, dim=i)
+    if (.not. allocated(r)) stop 11
+    deallocate(r)
+    i = 2
+    r = iparity(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 12
+    deallocate(r)
+    i = 4
+    r = iparity(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 13
+    deallocate(r)
+  end subroutine
+  subroutine check_sum
+    integer :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ integer:: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 2
+    r = sum(a, dim=i)
+    if (.not. allocated(r)) stop 21
+    deallocate(r)
+    i = 4
+    r = sum(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 22
+    deallocate(r)
+    i = 1
+    r = sum(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 23
+    deallocate(r)
+  end subroutine
+  subroutine check_minloc_int
+    integer :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ integer:: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 4
+    r = minloc(a, dim=i)
+    if (.not. allocated(r)) stop 31
+    deallocate(r)
+    i = 1
+    r = minloc(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 32
+    deallocate(r)
+    i = 2
+    r = minloc(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 33
+    deallocate(r)
+  end subroutine
+  subroutine check_minloc_char
+    character :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ character:: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 4
+    r = minloc(a, dim=i)
+    if (.not. allocated(r)) stop 41
+    deallocate(r)
+    i = 2
+    r = minloc(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 42
+    deallocate(r)
+    i = 1
+    r = minloc(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 43
+    deallocate(r)
+  end subroutine
+  subroutine check_maxloc_char4
+    character(kind=4) :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ character(kind=4):: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 1
+    r = maxloc(a, dim=i)
+    if (.not. allocated(r)) stop 51
+    deallocate(r)
+    i = 4
+    r = maxloc(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 52
+    deallocate(r)
+    i = 2
+    r = maxloc(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 53
+    deallocate(r)
+  end subroutine
+  subroutine check_minval_char
+    character :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    character, allocatable :: r(:,:,:)
+    a  = reshape((/ character:: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 2
+    r = minval(a, dim=i)
+    if (.not. allocated(r)) stop 61
+    deallocate(r)
+    i = 1
+    r = minval(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 62
+    deallocate(r)
+    i = 4
+    r = minval(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 63
+    deallocate(r)
+  end subroutine
+  subroutine check_maxval_char4
+    character(kind=4) :: a(9,3,0,7)
+    logical :: m1(9,3,0,7)
+    logical(kind=4) :: m4
+    integer :: i
+    character(kind=4), allocatable :: r(:,:,:)
+    a  = reshape((/ character(kind=4):: /), shape(a))
+    m1 = reshape((/ logical:: /), shape(m1))
+    m4 = .false.
+    i = 1
+    r = maxval(a, dim=i)
+    if (.not. allocated(r)) stop 71
+    deallocate(r)
+    i = 2
+    r = maxval(a, dim=i, mask=m1)
+    if (.not. allocated(r)) stop 72
+    deallocate(r)
+    i = 4
+    r = maxval(a, dim=i, mask=m4)
+    if (.not. allocated(r)) stop 73
+    deallocate(r)
+  end subroutine
+  subroutine check_any
+    logical :: a(9,3,0,7)
+    integer :: i
+    logical, allocatable :: r(:,:,:)
+    a  = reshape((/ logical:: /), shape(a))
+    i = 2
+    r = any(a, dim=i)
+    if (.not. allocated(r)) stop 81
+    deallocate(r)
+  end subroutine
+  subroutine check_count4
+    logical(kind=4) :: a(9,3,0,7)
+    integer :: i
+    integer, allocatable :: r(:,:,:)
+    a  = reshape((/ logical(kind=4):: /), shape(a))
+    i = 4
+    r = count(a, dim=i)
+    if (.not. allocated(r)) stop 91
+    deallocate(r)
+  end subroutine
+end program
diff --git a/libgfortran/generated/all_l1.c b/libgfortran/generated/all_l1.c
index afe94491b42..e4942811461 100644
--- a/libgfortran/generated/all_l1.c
+++ b/libgfortran/generated/all_l1.c
@@ -101,14 +101,13 @@  all_l1 (gfc_array_l1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
     }
   else
     {
diff --git a/libgfortran/generated/all_l16.c b/libgfortran/generated/all_l16.c
index 3b04889f920..1fc45bfd97c 100644
--- a/libgfortran/generated/all_l16.c
+++ b/libgfortran/generated/all_l16.c
@@ -101,14 +101,13 @@  all_l16 (gfc_array_l16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/all_l2.c b/libgfortran/generated/all_l2.c
index 5ce9027d6f5..f6dbf1c456d 100644
--- a/libgfortran/generated/all_l2.c
+++ b/libgfortran/generated/all_l2.c
@@ -101,14 +101,13 @@  all_l2 (gfc_array_l2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
     }
   else
     {
diff --git a/libgfortran/generated/all_l4.c b/libgfortran/generated/all_l4.c
index e004d1f6783..7f915ef9c61 100644
--- a/libgfortran/generated/all_l4.c
+++ b/libgfortran/generated/all_l4.c
@@ -101,14 +101,13 @@  all_l4 (gfc_array_l4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/all_l8.c b/libgfortran/generated/all_l8.c
index 7ae7392d4bf..3fa8147c1a1 100644
--- a/libgfortran/generated/all_l8.c
+++ b/libgfortran/generated/all_l8.c
@@ -101,14 +101,13 @@  all_l8 (gfc_array_l8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
     }
   else
     {
diff --git a/libgfortran/generated/any_l1.c b/libgfortran/generated/any_l1.c
index f3269c6c920..236e4100ec2 100644
--- a/libgfortran/generated/any_l1.c
+++ b/libgfortran/generated/any_l1.c
@@ -101,14 +101,13 @@  any_l1 (gfc_array_l1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_1));
     }
   else
     {
diff --git a/libgfortran/generated/any_l16.c b/libgfortran/generated/any_l16.c
index d27f496e93c..7290d66667e 100644
--- a/libgfortran/generated/any_l16.c
+++ b/libgfortran/generated/any_l16.c
@@ -101,14 +101,13 @@  any_l16 (gfc_array_l16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/any_l2.c b/libgfortran/generated/any_l2.c
index bac6837f515..d54e78fda0c 100644
--- a/libgfortran/generated/any_l2.c
+++ b/libgfortran/generated/any_l2.c
@@ -101,14 +101,13 @@  any_l2 (gfc_array_l2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_2));
     }
   else
     {
diff --git a/libgfortran/generated/any_l4.c b/libgfortran/generated/any_l4.c
index f489091774d..a577bc58213 100644
--- a/libgfortran/generated/any_l4.c
+++ b/libgfortran/generated/any_l4.c
@@ -101,14 +101,13 @@  any_l4 (gfc_array_l4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/any_l8.c b/libgfortran/generated/any_l8.c
index a22923c0c61..0af302746f5 100644
--- a/libgfortran/generated/any_l8.c
+++ b/libgfortran/generated/any_l8.c
@@ -101,14 +101,13 @@  any_l8 (gfc_array_l8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_LOGICAL_8));
     }
   else
     {
diff --git a/libgfortran/generated/count_16_l.c b/libgfortran/generated/count_16_l.c
index 545ce6537bf..89f4f753d1a 100644
--- a/libgfortran/generated/count_16_l.c
+++ b/libgfortran/generated/count_16_l.c
@@ -101,14 +101,13 @@  count_16_l (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/count_1_l.c b/libgfortran/generated/count_1_l.c
index fd95964534f..05b8b898e94 100644
--- a/libgfortran/generated/count_1_l.c
+++ b/libgfortran/generated/count_1_l.c
@@ -101,14 +101,13 @@  count_1_l (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/count_2_l.c b/libgfortran/generated/count_2_l.c
index 63512580e61..654b21589d0 100644
--- a/libgfortran/generated/count_2_l.c
+++ b/libgfortran/generated/count_2_l.c
@@ -101,14 +101,13 @@  count_2_l (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/count_4_l.c b/libgfortran/generated/count_4_l.c
index 44e7d68b2a4..8f40ea1c0be 100644
--- a/libgfortran/generated/count_4_l.c
+++ b/libgfortran/generated/count_4_l.c
@@ -101,14 +101,13 @@  count_4_l (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/count_8_l.c b/libgfortran/generated/count_8_l.c
index 4f4d82b5d62..ab64c085803 100644
--- a/libgfortran/generated/count_8_l.c
+++ b/libgfortran/generated/count_8_l.c
@@ -101,14 +101,13 @@  count_8_l (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/iall_i1.c b/libgfortran/generated/iall_i1.c
index 4af96269308..c9696c92485 100644
--- a/libgfortran/generated/iall_i1.c
+++ b/libgfortran/generated/iall_i1.c
@@ -301,15 +301,13 @@  miall_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siall_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/iall_i16.c b/libgfortran/generated/iall_i16.c
index e678d06d1b8..f0a1b3adcf2 100644
--- a/libgfortran/generated/iall_i16.c
+++ b/libgfortran/generated/iall_i16.c
@@ -301,15 +301,13 @@  miall_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siall_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/iall_i2.c b/libgfortran/generated/iall_i2.c
index fbe52663f16..4d14d71cab2 100644
--- a/libgfortran/generated/iall_i2.c
+++ b/libgfortran/generated/iall_i2.c
@@ -301,15 +301,13 @@  miall_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siall_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/iall_i4.c b/libgfortran/generated/iall_i4.c
index 3d6b6deba3d..cb7ce755bfc 100644
--- a/libgfortran/generated/iall_i4.c
+++ b/libgfortran/generated/iall_i4.c
@@ -301,15 +301,13 @@  miall_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siall_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/iall_i8.c b/libgfortran/generated/iall_i8.c
index 072f6837029..c7dab3e2e56 100644
--- a/libgfortran/generated/iall_i8.c
+++ b/libgfortran/generated/iall_i8.c
@@ -301,15 +301,13 @@  miall_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siall_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/iany_i1.c b/libgfortran/generated/iany_i1.c
index 6f03df6efd2..539c5389561 100644
--- a/libgfortran/generated/iany_i1.c
+++ b/libgfortran/generated/iany_i1.c
@@ -301,15 +301,13 @@  miany_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siany_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/iany_i16.c b/libgfortran/generated/iany_i16.c
index 72a7add660b..d690dff60be 100644
--- a/libgfortran/generated/iany_i16.c
+++ b/libgfortran/generated/iany_i16.c
@@ -301,15 +301,13 @@  miany_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siany_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/iany_i2.c b/libgfortran/generated/iany_i2.c
index 26858b42916..dd37c1e5b48 100644
--- a/libgfortran/generated/iany_i2.c
+++ b/libgfortran/generated/iany_i2.c
@@ -301,15 +301,13 @@  miany_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siany_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/iany_i4.c b/libgfortran/generated/iany_i4.c
index ca315d1223c..e9689904951 100644
--- a/libgfortran/generated/iany_i4.c
+++ b/libgfortran/generated/iany_i4.c
@@ -301,15 +301,13 @@  miany_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siany_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/iany_i8.c b/libgfortran/generated/iany_i8.c
index dc9081e5149..79f6c381a3f 100644
--- a/libgfortran/generated/iany_i8.c
+++ b/libgfortran/generated/iany_i8.c
@@ -301,15 +301,13 @@  miany_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siany_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/iparity_i1.c b/libgfortran/generated/iparity_i1.c
index cfb2e481831..8e0f4529d4d 100644
--- a/libgfortran/generated/iparity_i1.c
+++ b/libgfortran/generated/iparity_i1.c
@@ -301,15 +301,13 @@  miparity_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siparity_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/iparity_i16.c b/libgfortran/generated/iparity_i16.c
index 3b1f3232327..912ca591dda 100644
--- a/libgfortran/generated/iparity_i16.c
+++ b/libgfortran/generated/iparity_i16.c
@@ -301,15 +301,13 @@  miparity_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siparity_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/iparity_i2.c b/libgfortran/generated/iparity_i2.c
index 60575bdcb15..6e7e60a5a2e 100644
--- a/libgfortran/generated/iparity_i2.c
+++ b/libgfortran/generated/iparity_i2.c
@@ -301,15 +301,13 @@  miparity_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siparity_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/iparity_i4.c b/libgfortran/generated/iparity_i4.c
index 49f65145e15..0bb1be1dedb 100644
--- a/libgfortran/generated/iparity_i4.c
+++ b/libgfortran/generated/iparity_i4.c
@@ -301,15 +301,13 @@  miparity_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siparity_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/iparity_i8.c b/libgfortran/generated/iparity_i8.c
index ec68d514a48..e219d6e3dce 100644
--- a/libgfortran/generated/iparity_i8.c
+++ b/libgfortran/generated/iparity_i8.c
@@ -301,15 +301,13 @@  miparity_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  siparity_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_i1.c b/libgfortran/generated/maxloc1_16_i1.c
index dd86eb22d95..e126c18bc80 100644
--- a/libgfortran/generated/maxloc1_16_i1.c
+++ b/libgfortran/generated/maxloc1_16_i1.c
@@ -329,15 +329,13 @@  mmaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_i16.c b/libgfortran/generated/maxloc1_16_i16.c
index f40ade40214..04ced535df9 100644
--- a/libgfortran/generated/maxloc1_16_i16.c
+++ b/libgfortran/generated/maxloc1_16_i16.c
@@ -329,15 +329,13 @@  mmaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_i2.c b/libgfortran/generated/maxloc1_16_i2.c
index d857d4fe768..9f7447e9de9 100644
--- a/libgfortran/generated/maxloc1_16_i2.c
+++ b/libgfortran/generated/maxloc1_16_i2.c
@@ -329,15 +329,13 @@  mmaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_i4.c b/libgfortran/generated/maxloc1_16_i4.c
index c67878b0f48..8663dfc7e24 100644
--- a/libgfortran/generated/maxloc1_16_i4.c
+++ b/libgfortran/generated/maxloc1_16_i4.c
@@ -329,15 +329,13 @@  mmaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_i8.c b/libgfortran/generated/maxloc1_16_i8.c
index 6e040811301..c0593a67f11 100644
--- a/libgfortran/generated/maxloc1_16_i8.c
+++ b/libgfortran/generated/maxloc1_16_i8.c
@@ -329,15 +329,13 @@  mmaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_r10.c b/libgfortran/generated/maxloc1_16_r10.c
index 47d8f7ba619..a5e0665fccf 100644
--- a/libgfortran/generated/maxloc1_16_r10.c
+++ b/libgfortran/generated/maxloc1_16_r10.c
@@ -329,15 +329,13 @@  mmaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_r16.c b/libgfortran/generated/maxloc1_16_r16.c
index f5bd965205c..cbb20002665 100644
--- a/libgfortran/generated/maxloc1_16_r16.c
+++ b/libgfortran/generated/maxloc1_16_r16.c
@@ -329,15 +329,13 @@  mmaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_r17.c b/libgfortran/generated/maxloc1_16_r17.c
index 8d59c196236..719ae09772d 100644
--- a/libgfortran/generated/maxloc1_16_r17.c
+++ b/libgfortran/generated/maxloc1_16_r17.c
@@ -329,15 +329,13 @@  mmaxloc1_16_r17 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_r17 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_r4.c b/libgfortran/generated/maxloc1_16_r4.c
index 91299bdcc01..37a0657dab2 100644
--- a/libgfortran/generated/maxloc1_16_r4.c
+++ b/libgfortran/generated/maxloc1_16_r4.c
@@ -329,15 +329,13 @@  mmaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_r8.c b/libgfortran/generated/maxloc1_16_r8.c
index 91e89b02a68..305613694b2 100644
--- a/libgfortran/generated/maxloc1_16_r8.c
+++ b/libgfortran/generated/maxloc1_16_r8.c
@@ -329,15 +329,13 @@  mmaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_s1.c b/libgfortran/generated/maxloc1_16_s1.c
index 313ee1cf440..b9a8a639596 100644
--- a/libgfortran/generated/maxloc1_16_s1.c
+++ b/libgfortran/generated/maxloc1_16_s1.c
@@ -322,15 +322,13 @@  mmaxloc1_16_s1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_16_s1 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_16_s4.c b/libgfortran/generated/maxloc1_16_s4.c
index d8da8569e15..fdaad7fd2dc 100644
--- a/libgfortran/generated/maxloc1_16_s4.c
+++ b/libgfortran/generated/maxloc1_16_s4.c
@@ -322,15 +322,13 @@  mmaxloc1_16_s4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_16_s4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_i1.c b/libgfortran/generated/maxloc1_4_i1.c
index 333b08cec96..b68d92ef44e 100644
--- a/libgfortran/generated/maxloc1_4_i1.c
+++ b/libgfortran/generated/maxloc1_4_i1.c
@@ -329,15 +329,13 @@  mmaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_i16.c b/libgfortran/generated/maxloc1_4_i16.c
index 62dadf6b66f..9221e22505b 100644
--- a/libgfortran/generated/maxloc1_4_i16.c
+++ b/libgfortran/generated/maxloc1_4_i16.c
@@ -329,15 +329,13 @@  mmaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_i2.c b/libgfortran/generated/maxloc1_4_i2.c
index 6bc6e500b52..3fa2e367898 100644
--- a/libgfortran/generated/maxloc1_4_i2.c
+++ b/libgfortran/generated/maxloc1_4_i2.c
@@ -329,15 +329,13 @@  mmaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_i4.c b/libgfortran/generated/maxloc1_4_i4.c
index d38fd367443..5ef2abb98e1 100644
--- a/libgfortran/generated/maxloc1_4_i4.c
+++ b/libgfortran/generated/maxloc1_4_i4.c
@@ -329,15 +329,13 @@  mmaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_i8.c b/libgfortran/generated/maxloc1_4_i8.c
index 30314f0f6dd..102d394b309 100644
--- a/libgfortran/generated/maxloc1_4_i8.c
+++ b/libgfortran/generated/maxloc1_4_i8.c
@@ -329,15 +329,13 @@  mmaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_r10.c b/libgfortran/generated/maxloc1_4_r10.c
index 693f52aef78..623204d792c 100644
--- a/libgfortran/generated/maxloc1_4_r10.c
+++ b/libgfortran/generated/maxloc1_4_r10.c
@@ -329,15 +329,13 @@  mmaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_r16.c b/libgfortran/generated/maxloc1_4_r16.c
index c24dece73f6..92209ce79ce 100644
--- a/libgfortran/generated/maxloc1_4_r16.c
+++ b/libgfortran/generated/maxloc1_4_r16.c
@@ -329,15 +329,13 @@  mmaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_r17.c b/libgfortran/generated/maxloc1_4_r17.c
index a8efa10557e..6ee34b52719 100644
--- a/libgfortran/generated/maxloc1_4_r17.c
+++ b/libgfortran/generated/maxloc1_4_r17.c
@@ -329,15 +329,13 @@  mmaxloc1_4_r17 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_r17 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_r4.c b/libgfortran/generated/maxloc1_4_r4.c
index 6957da417ab..ea6123a987c 100644
--- a/libgfortran/generated/maxloc1_4_r4.c
+++ b/libgfortran/generated/maxloc1_4_r4.c
@@ -329,15 +329,13 @@  mmaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_r8.c b/libgfortran/generated/maxloc1_4_r8.c
index b7e6cf34774..ba83b4d6a6d 100644
--- a/libgfortran/generated/maxloc1_4_r8.c
+++ b/libgfortran/generated/maxloc1_4_r8.c
@@ -329,15 +329,13 @@  mmaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_s1.c b/libgfortran/generated/maxloc1_4_s1.c
index 904c5d4a8fa..7d2ab07915e 100644
--- a/libgfortran/generated/maxloc1_4_s1.c
+++ b/libgfortran/generated/maxloc1_4_s1.c
@@ -322,15 +322,13 @@  mmaxloc1_4_s1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_4_s1 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_4_s4.c b/libgfortran/generated/maxloc1_4_s4.c
index 5b1f7b0938d..7a4950d3e5c 100644
--- a/libgfortran/generated/maxloc1_4_s4.c
+++ b/libgfortran/generated/maxloc1_4_s4.c
@@ -322,15 +322,13 @@  mmaxloc1_4_s4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_4_s4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_i1.c b/libgfortran/generated/maxloc1_8_i1.c
index ee478907548..d243e6e027c 100644
--- a/libgfortran/generated/maxloc1_8_i1.c
+++ b/libgfortran/generated/maxloc1_8_i1.c
@@ -329,15 +329,13 @@  mmaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_i16.c b/libgfortran/generated/maxloc1_8_i16.c
index 2c788a26d53..5871aa52379 100644
--- a/libgfortran/generated/maxloc1_8_i16.c
+++ b/libgfortran/generated/maxloc1_8_i16.c
@@ -329,15 +329,13 @@  mmaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_i2.c b/libgfortran/generated/maxloc1_8_i2.c
index 13474427323..9337f47c9ca 100644
--- a/libgfortran/generated/maxloc1_8_i2.c
+++ b/libgfortran/generated/maxloc1_8_i2.c
@@ -329,15 +329,13 @@  mmaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_i4.c b/libgfortran/generated/maxloc1_8_i4.c
index 57a001fefc6..747b9979fdc 100644
--- a/libgfortran/generated/maxloc1_8_i4.c
+++ b/libgfortran/generated/maxloc1_8_i4.c
@@ -329,15 +329,13 @@  mmaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_i8.c b/libgfortran/generated/maxloc1_8_i8.c
index ff837e6872f..adc0ebae28d 100644
--- a/libgfortran/generated/maxloc1_8_i8.c
+++ b/libgfortran/generated/maxloc1_8_i8.c
@@ -329,15 +329,13 @@  mmaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_r10.c b/libgfortran/generated/maxloc1_8_r10.c
index 9046b279c12..4c8d00d937d 100644
--- a/libgfortran/generated/maxloc1_8_r10.c
+++ b/libgfortran/generated/maxloc1_8_r10.c
@@ -329,15 +329,13 @@  mmaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_r16.c b/libgfortran/generated/maxloc1_8_r16.c
index 93e83307da4..df3edbe611b 100644
--- a/libgfortran/generated/maxloc1_8_r16.c
+++ b/libgfortran/generated/maxloc1_8_r16.c
@@ -329,15 +329,13 @@  mmaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_r17.c b/libgfortran/generated/maxloc1_8_r17.c
index ab14e3a7ebe..162806132f1 100644
--- a/libgfortran/generated/maxloc1_8_r17.c
+++ b/libgfortran/generated/maxloc1_8_r17.c
@@ -329,15 +329,13 @@  mmaxloc1_8_r17 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_r17 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_r4.c b/libgfortran/generated/maxloc1_8_r4.c
index 556357b46a1..dee860a1a8f 100644
--- a/libgfortran/generated/maxloc1_8_r4.c
+++ b/libgfortran/generated/maxloc1_8_r4.c
@@ -329,15 +329,13 @@  mmaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_r8.c b/libgfortran/generated/maxloc1_8_r8.c
index aceebcf7cf4..215d9668adb 100644
--- a/libgfortran/generated/maxloc1_8_r8.c
+++ b/libgfortran/generated/maxloc1_8_r8.c
@@ -329,15 +329,13 @@  mmaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -537,14 +535,13 @@  smaxloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_s1.c b/libgfortran/generated/maxloc1_8_s1.c
index 9659f7f74a6..7b1091d596c 100644
--- a/libgfortran/generated/maxloc1_8_s1.c
+++ b/libgfortran/generated/maxloc1_8_s1.c
@@ -322,15 +322,13 @@  mmaxloc1_8_s1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_8_s1 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxloc1_8_s4.c b/libgfortran/generated/maxloc1_8_s4.c
index 10302b95ade..a61c08c6f64 100644
--- a/libgfortran/generated/maxloc1_8_s4.c
+++ b/libgfortran/generated/maxloc1_8_s4.c
@@ -322,15 +322,13 @@  mmaxloc1_8_s4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -503,14 +501,13 @@  smaxloc1_8_s4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxval1_s1.c b/libgfortran/generated/maxval1_s1.c
index 605e04b4e2e..fd65f4b62ec 100644
--- a/libgfortran/generated/maxval1_s1.c
+++ b/libgfortran/generated/maxval1_s1.c
@@ -318,15 +318,13 @@  mmaxval1_s1 (gfc_array_s1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
-
     }
   else
     {
@@ -496,14 +494,13 @@  smaxval1_s1 (gfc_array_s1 * const restrict retarray,
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]
       		 * string_len;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/maxval1_s4.c b/libgfortran/generated/maxval1_s4.c
index 829cdf213c1..3558e61c76a 100644
--- a/libgfortran/generated/maxval1_s4.c
+++ b/libgfortran/generated/maxval1_s4.c
@@ -318,15 +318,13 @@  mmaxval1_s4 (gfc_array_s4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
-
     }
   else
     {
@@ -496,14 +494,13 @@  smaxval1_s4 (gfc_array_s4 * const restrict retarray,
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]
       		 * string_len;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_i1.c b/libgfortran/generated/maxval_i1.c
index 04faea82a9e..bc52cd74a95 100644
--- a/libgfortran/generated/maxval_i1.c
+++ b/libgfortran/generated/maxval_i1.c
@@ -315,15 +315,13 @@  mmaxval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_i16.c b/libgfortran/generated/maxval_i16.c
index eaaaf7f55b3..1d9d33369d4 100644
--- a/libgfortran/generated/maxval_i16.c
+++ b/libgfortran/generated/maxval_i16.c
@@ -315,15 +315,13 @@  mmaxval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_i2.c b/libgfortran/generated/maxval_i2.c
index 440226d2fff..fe3c6fecce7 100644
--- a/libgfortran/generated/maxval_i2.c
+++ b/libgfortran/generated/maxval_i2.c
@@ -315,15 +315,13 @@  mmaxval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_i4.c b/libgfortran/generated/maxval_i4.c
index 99248447c31..0412c7a7583 100644
--- a/libgfortran/generated/maxval_i4.c
+++ b/libgfortran/generated/maxval_i4.c
@@ -315,15 +315,13 @@  mmaxval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_i8.c b/libgfortran/generated/maxval_i8.c
index cb14e74486f..2037b96b3c5 100644
--- a/libgfortran/generated/maxval_i8.c
+++ b/libgfortran/generated/maxval_i8.c
@@ -315,15 +315,13 @@  mmaxval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_r10.c b/libgfortran/generated/maxval_r10.c
index 9fb9b0297c9..7c397eeea77 100644
--- a/libgfortran/generated/maxval_r10.c
+++ b/libgfortran/generated/maxval_r10.c
@@ -315,15 +315,13 @@  mmaxval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_r10 (gfc_array_r10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_r16.c b/libgfortran/generated/maxval_r16.c
index b06ea6653db..1f2144e5253 100644
--- a/libgfortran/generated/maxval_r16.c
+++ b/libgfortran/generated/maxval_r16.c
@@ -315,15 +315,13 @@  mmaxval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_r16 (gfc_array_r16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_r17.c b/libgfortran/generated/maxval_r17.c
index 1ec11fff1f2..f85460366aa 100644
--- a/libgfortran/generated/maxval_r17.c
+++ b/libgfortran/generated/maxval_r17.c
@@ -315,15 +315,13 @@  mmaxval_r17 (gfc_array_r17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_r17 (gfc_array_r17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_r4.c b/libgfortran/generated/maxval_r4.c
index 8dfde41fa0c..e2fd59e92bc 100644
--- a/libgfortran/generated/maxval_r4.c
+++ b/libgfortran/generated/maxval_r4.c
@@ -315,15 +315,13 @@  mmaxval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_r4 (gfc_array_r4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/maxval_r8.c b/libgfortran/generated/maxval_r8.c
index 179a4227179..d3aadc62529 100644
--- a/libgfortran/generated/maxval_r8.c
+++ b/libgfortran/generated/maxval_r8.c
@@ -315,15 +315,13 @@  mmaxval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
-
     }
   else
     {
@@ -508,14 +506,13 @@  smaxval_r8 (gfc_array_r8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_i1.c b/libgfortran/generated/minloc1_16_i1.c
index 7bca02e91de..541d71fe214 100644
--- a/libgfortran/generated/minloc1_16_i1.c
+++ b/libgfortran/generated/minloc1_16_i1.c
@@ -339,15 +339,13 @@  mminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_i1 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_i16.c b/libgfortran/generated/minloc1_16_i16.c
index 1876871f7ca..baaf02597b6 100644
--- a/libgfortran/generated/minloc1_16_i16.c
+++ b/libgfortran/generated/minloc1_16_i16.c
@@ -339,15 +339,13 @@  mminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_i2.c b/libgfortran/generated/minloc1_16_i2.c
index 061a7928912..e4f78b65de3 100644
--- a/libgfortran/generated/minloc1_16_i2.c
+++ b/libgfortran/generated/minloc1_16_i2.c
@@ -339,15 +339,13 @@  mminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_i2 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_i4.c b/libgfortran/generated/minloc1_16_i4.c
index 297d7c53605..c561d71319e 100644
--- a/libgfortran/generated/minloc1_16_i4.c
+++ b/libgfortran/generated/minloc1_16_i4.c
@@ -339,15 +339,13 @@  mminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_i4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_i8.c b/libgfortran/generated/minloc1_16_i8.c
index d0bfb654596..ebdb68dd3c5 100644
--- a/libgfortran/generated/minloc1_16_i8.c
+++ b/libgfortran/generated/minloc1_16_i8.c
@@ -339,15 +339,13 @@  mminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_i8 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_r10.c b/libgfortran/generated/minloc1_16_r10.c
index 8fc8399ad43..98d3fb3879b 100644
--- a/libgfortran/generated/minloc1_16_r10.c
+++ b/libgfortran/generated/minloc1_16_r10.c
@@ -339,15 +339,13 @@  mminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_r10 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_r16.c b/libgfortran/generated/minloc1_16_r16.c
index 3efb7fbb9cd..ad445a42dfa 100644
--- a/libgfortran/generated/minloc1_16_r16.c
+++ b/libgfortran/generated/minloc1_16_r16.c
@@ -339,15 +339,13 @@  mminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_r16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_r17.c b/libgfortran/generated/minloc1_16_r17.c
index bcffa58b2a0..339d9ad9662 100644
--- a/libgfortran/generated/minloc1_16_r17.c
+++ b/libgfortran/generated/minloc1_16_r17.c
@@ -339,15 +339,13 @@  mminloc1_16_r17 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_r17 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_r4.c b/libgfortran/generated/minloc1_16_r4.c
index 6b25af9743f..780bcc267fd 100644
--- a/libgfortran/generated/minloc1_16_r4.c
+++ b/libgfortran/generated/minloc1_16_r4.c
@@ -339,15 +339,13 @@  mminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_r4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_r8.c b/libgfortran/generated/minloc1_16_r8.c
index f3f88c35cf0..124587f5fb3 100644
--- a/libgfortran/generated/minloc1_16_r8.c
+++ b/libgfortran/generated/minloc1_16_r8.c
@@ -339,15 +339,13 @@  mminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_16_r8 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_s1.c b/libgfortran/generated/minloc1_16_s1.c
index 3419055dc70..f4763dc6e64 100644
--- a/libgfortran/generated/minloc1_16_s1.c
+++ b/libgfortran/generated/minloc1_16_s1.c
@@ -322,15 +322,13 @@  mminloc1_16_s1 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_16_s1 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_16_s4.c b/libgfortran/generated/minloc1_16_s4.c
index aad2f87386f..ba0475a9ca0 100644
--- a/libgfortran/generated/minloc1_16_s4.c
+++ b/libgfortran/generated/minloc1_16_s4.c
@@ -322,15 +322,13 @@  mminloc1_16_s4 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_16_s4 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_i1.c b/libgfortran/generated/minloc1_4_i1.c
index 8e2ccace944..433a25a8ef8 100644
--- a/libgfortran/generated/minloc1_4_i1.c
+++ b/libgfortran/generated/minloc1_4_i1.c
@@ -339,15 +339,13 @@  mminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_i1 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_i16.c b/libgfortran/generated/minloc1_4_i16.c
index 3236418f64e..9d2c606186b 100644
--- a/libgfortran/generated/minloc1_4_i16.c
+++ b/libgfortran/generated/minloc1_4_i16.c
@@ -339,15 +339,13 @@  mminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_i16 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_i2.c b/libgfortran/generated/minloc1_4_i2.c
index f039cc2df88..73737011e9a 100644
--- a/libgfortran/generated/minloc1_4_i2.c
+++ b/libgfortran/generated/minloc1_4_i2.c
@@ -339,15 +339,13 @@  mminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_i2 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_i4.c b/libgfortran/generated/minloc1_4_i4.c
index 0eac1a8de9e..d18416ebcc4 100644
--- a/libgfortran/generated/minloc1_4_i4.c
+++ b/libgfortran/generated/minloc1_4_i4.c
@@ -339,15 +339,13 @@  mminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_i8.c b/libgfortran/generated/minloc1_4_i8.c
index b6fc26765c2..4f7dfdfdf73 100644
--- a/libgfortran/generated/minloc1_4_i8.c
+++ b/libgfortran/generated/minloc1_4_i8.c
@@ -339,15 +339,13 @@  mminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_i8 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_r10.c b/libgfortran/generated/minloc1_4_r10.c
index 3245be44d42..ff5af01130d 100644
--- a/libgfortran/generated/minloc1_4_r10.c
+++ b/libgfortran/generated/minloc1_4_r10.c
@@ -339,15 +339,13 @@  mminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_r10 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_r16.c b/libgfortran/generated/minloc1_4_r16.c
index a0ca94a653f..2d664467df3 100644
--- a/libgfortran/generated/minloc1_4_r16.c
+++ b/libgfortran/generated/minloc1_4_r16.c
@@ -339,15 +339,13 @@  mminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_r16 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_r17.c b/libgfortran/generated/minloc1_4_r17.c
index 56b438aea7d..711fd841d34 100644
--- a/libgfortran/generated/minloc1_4_r17.c
+++ b/libgfortran/generated/minloc1_4_r17.c
@@ -339,15 +339,13 @@  mminloc1_4_r17 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_r17 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_r4.c b/libgfortran/generated/minloc1_4_r4.c
index 922cca690e0..0739d9bd178 100644
--- a/libgfortran/generated/minloc1_4_r4.c
+++ b/libgfortran/generated/minloc1_4_r4.c
@@ -339,15 +339,13 @@  mminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_r4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_r8.c b/libgfortran/generated/minloc1_4_r8.c
index 7316d6e2663..d625195e432 100644
--- a/libgfortran/generated/minloc1_4_r8.c
+++ b/libgfortran/generated/minloc1_4_r8.c
@@ -339,15 +339,13 @@  mminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_4_r8 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_s1.c b/libgfortran/generated/minloc1_4_s1.c
index da8e49a8029..13ebc76524d 100644
--- a/libgfortran/generated/minloc1_4_s1.c
+++ b/libgfortran/generated/minloc1_4_s1.c
@@ -322,15 +322,13 @@  mminloc1_4_s1 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_4_s1 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_4_s4.c b/libgfortran/generated/minloc1_4_s4.c
index ca708992ede..5c9a5900237 100644
--- a/libgfortran/generated/minloc1_4_s4.c
+++ b/libgfortran/generated/minloc1_4_s4.c
@@ -322,15 +322,13 @@  mminloc1_4_s4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_4_s4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_i1.c b/libgfortran/generated/minloc1_8_i1.c
index de8603cc1f2..fab5619979f 100644
--- a/libgfortran/generated/minloc1_8_i1.c
+++ b/libgfortran/generated/minloc1_8_i1.c
@@ -339,15 +339,13 @@  mminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_i1 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_i16.c b/libgfortran/generated/minloc1_8_i16.c
index 01a4e37869a..742e2ea73b2 100644
--- a/libgfortran/generated/minloc1_8_i16.c
+++ b/libgfortran/generated/minloc1_8_i16.c
@@ -339,15 +339,13 @@  mminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_i16 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_i2.c b/libgfortran/generated/minloc1_8_i2.c
index e020bfe3b49..defef3c653c 100644
--- a/libgfortran/generated/minloc1_8_i2.c
+++ b/libgfortran/generated/minloc1_8_i2.c
@@ -339,15 +339,13 @@  mminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_i2 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_i4.c b/libgfortran/generated/minloc1_8_i4.c
index f5093f13bc0..3e696aafcac 100644
--- a/libgfortran/generated/minloc1_8_i4.c
+++ b/libgfortran/generated/minloc1_8_i4.c
@@ -339,15 +339,13 @@  mminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_i4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_i8.c b/libgfortran/generated/minloc1_8_i8.c
index 5b3a327abc5..9a017433ee6 100644
--- a/libgfortran/generated/minloc1_8_i8.c
+++ b/libgfortran/generated/minloc1_8_i8.c
@@ -339,15 +339,13 @@  mminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_r10.c b/libgfortran/generated/minloc1_8_r10.c
index 280840f33e6..18f294f2180 100644
--- a/libgfortran/generated/minloc1_8_r10.c
+++ b/libgfortran/generated/minloc1_8_r10.c
@@ -339,15 +339,13 @@  mminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_r10 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_r16.c b/libgfortran/generated/minloc1_8_r16.c
index fd0ee3e6c7b..1dd45dead26 100644
--- a/libgfortran/generated/minloc1_8_r16.c
+++ b/libgfortran/generated/minloc1_8_r16.c
@@ -339,15 +339,13 @@  mminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_r16 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_r17.c b/libgfortran/generated/minloc1_8_r17.c
index dcb3f929842..85dc6cb04fe 100644
--- a/libgfortran/generated/minloc1_8_r17.c
+++ b/libgfortran/generated/minloc1_8_r17.c
@@ -339,15 +339,13 @@  mminloc1_8_r17 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_r17 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_r4.c b/libgfortran/generated/minloc1_8_r4.c
index e6025482211..6d7764a5eb7 100644
--- a/libgfortran/generated/minloc1_8_r4.c
+++ b/libgfortran/generated/minloc1_8_r4.c
@@ -339,15 +339,13 @@  mminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_r4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_r8.c b/libgfortran/generated/minloc1_8_r8.c
index e18185fc6fe..e17d3c881c0 100644
--- a/libgfortran/generated/minloc1_8_r8.c
+++ b/libgfortran/generated/minloc1_8_r8.c
@@ -339,15 +339,13 @@  mminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -547,14 +545,13 @@  sminloc1_8_r8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_s1.c b/libgfortran/generated/minloc1_8_s1.c
index 6e26878fc02..0449575a5a3 100644
--- a/libgfortran/generated/minloc1_8_s1.c
+++ b/libgfortran/generated/minloc1_8_s1.c
@@ -322,15 +322,13 @@  mminloc1_8_s1 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_8_s1 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minloc1_8_s4.c b/libgfortran/generated/minloc1_8_s4.c
index 14e5c9e7395..682b89b2765 100644
--- a/libgfortran/generated/minloc1_8_s4.c
+++ b/libgfortran/generated/minloc1_8_s4.c
@@ -322,15 +322,13 @@  mminloc1_8_s4 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -503,14 +501,13 @@  sminloc1_8_s4 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minval1_s1.c b/libgfortran/generated/minval1_s1.c
index 3a1cde20f93..9c577ed004c 100644
--- a/libgfortran/generated/minval1_s1.c
+++ b/libgfortran/generated/minval1_s1.c
@@ -318,15 +318,13 @@  mminval1_s1 (gfc_array_s1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
-
     }
   else
     {
@@ -496,14 +494,13 @@  sminval1_s1 (gfc_array_s1 * const restrict retarray,
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]
       		 * string_len;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/minval1_s4.c b/libgfortran/generated/minval1_s4.c
index 83987fd1f25..9a30bf0bfb5 100644
--- a/libgfortran/generated/minval1_s4.c
+++ b/libgfortran/generated/minval1_s4.c
@@ -318,15 +318,13 @@  mminval1_s4 (gfc_array_s4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
-
     }
   else
     {
@@ -496,14 +494,13 @@  sminval1_s4 (gfc_array_s4 * const restrict retarray,
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]
       		 * string_len;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_UINTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minval_i1.c b/libgfortran/generated/minval_i1.c
index 4b3d19e15f2..174161af4d4 100644
--- a/libgfortran/generated/minval_i1.c
+++ b/libgfortran/generated/minval_i1.c
@@ -315,15 +315,13 @@  mminval_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/minval_i16.c b/libgfortran/generated/minval_i16.c
index de746524499..b220391e4f8 100644
--- a/libgfortran/generated/minval_i16.c
+++ b/libgfortran/generated/minval_i16.c
@@ -315,15 +315,13 @@  mminval_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/minval_i2.c b/libgfortran/generated/minval_i2.c
index 8bcaeb7b866..3a050c1eb82 100644
--- a/libgfortran/generated/minval_i2.c
+++ b/libgfortran/generated/minval_i2.c
@@ -315,15 +315,13 @@  mminval_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/minval_i4.c b/libgfortran/generated/minval_i4.c
index a45aaae0bc6..194967d2f92 100644
--- a/libgfortran/generated/minval_i4.c
+++ b/libgfortran/generated/minval_i4.c
@@ -315,15 +315,13 @@  mminval_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/minval_i8.c b/libgfortran/generated/minval_i8.c
index 481b5d093d2..07acc60d4a0 100644
--- a/libgfortran/generated/minval_i8.c
+++ b/libgfortran/generated/minval_i8.c
@@ -315,15 +315,13 @@  mminval_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/minval_r10.c b/libgfortran/generated/minval_r10.c
index e0f7c78a2af..d49244c1dff 100644
--- a/libgfortran/generated/minval_r10.c
+++ b/libgfortran/generated/minval_r10.c
@@ -315,15 +315,13 @@  mminval_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_r10 (gfc_array_r10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
diff --git a/libgfortran/generated/minval_r16.c b/libgfortran/generated/minval_r16.c
index 41feafb17db..50305430d60 100644
--- a/libgfortran/generated/minval_r16.c
+++ b/libgfortran/generated/minval_r16.c
@@ -315,15 +315,13 @@  mminval_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_r16 (gfc_array_r16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/minval_r17.c b/libgfortran/generated/minval_r17.c
index d928240bf1a..2479a864af3 100644
--- a/libgfortran/generated/minval_r17.c
+++ b/libgfortran/generated/minval_r17.c
@@ -315,15 +315,13 @@  mminval_r17 (gfc_array_r17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_r17 (gfc_array_r17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
     }
   else
     {
diff --git a/libgfortran/generated/minval_r4.c b/libgfortran/generated/minval_r4.c
index 7d16b6f5c93..ceca490cfcd 100644
--- a/libgfortran/generated/minval_r4.c
+++ b/libgfortran/generated/minval_r4.c
@@ -315,15 +315,13 @@  mminval_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_r4 (gfc_array_r4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/minval_r8.c b/libgfortran/generated/minval_r8.c
index 7a2cb031115..091cb74d30d 100644
--- a/libgfortran/generated/minval_r8.c
+++ b/libgfortran/generated/minval_r8.c
@@ -315,15 +315,13 @@  mminval_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
-
     }
   else
     {
@@ -508,14 +506,13 @@  sminval_r8 (gfc_array_r8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
diff --git a/libgfortran/generated/product_c10.c b/libgfortran/generated/product_c10.c
index 992313feabe..b888769130d 100644
--- a/libgfortran/generated/product_c10.c
+++ b/libgfortran/generated/product_c10.c
@@ -301,15 +301,13 @@  mproduct_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_c10 (gfc_array_c10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
     }
   else
     {
diff --git a/libgfortran/generated/product_c16.c b/libgfortran/generated/product_c16.c
index 468c6aa86de..b783367ff05 100644
--- a/libgfortran/generated/product_c16.c
+++ b/libgfortran/generated/product_c16.c
@@ -301,15 +301,13 @@  mproduct_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_c16 (gfc_array_c16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
     }
   else
     {
diff --git a/libgfortran/generated/product_c17.c b/libgfortran/generated/product_c17.c
index e7221738b59..e89e9eea0c3 100644
--- a/libgfortran/generated/product_c17.c
+++ b/libgfortran/generated/product_c17.c
@@ -301,15 +301,13 @@  mproduct_c17 (gfc_array_c17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_c17 (gfc_array_c17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
     }
   else
     {
diff --git a/libgfortran/generated/product_c4.c b/libgfortran/generated/product_c4.c
index 57875ad2984..08b2878930b 100644
--- a/libgfortran/generated/product_c4.c
+++ b/libgfortran/generated/product_c4.c
@@ -301,15 +301,13 @@  mproduct_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_c4 (gfc_array_c4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
     }
   else
     {
diff --git a/libgfortran/generated/product_c8.c b/libgfortran/generated/product_c8.c
index fb8a2574542..cb721e50b65 100644
--- a/libgfortran/generated/product_c8.c
+++ b/libgfortran/generated/product_c8.c
@@ -301,15 +301,13 @@  mproduct_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_c8 (gfc_array_c8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
     }
   else
     {
diff --git a/libgfortran/generated/product_i1.c b/libgfortran/generated/product_i1.c
index ed13fcf37e4..8af7d63c654 100644
--- a/libgfortran/generated/product_i1.c
+++ b/libgfortran/generated/product_i1.c
@@ -301,15 +301,13 @@  mproduct_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/product_i16.c b/libgfortran/generated/product_i16.c
index 53544bea8f0..de9b7fb503a 100644
--- a/libgfortran/generated/product_i16.c
+++ b/libgfortran/generated/product_i16.c
@@ -301,15 +301,13 @@  mproduct_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/product_i2.c b/libgfortran/generated/product_i2.c
index aef0fc47d4f..bb0283286c1 100644
--- a/libgfortran/generated/product_i2.c
+++ b/libgfortran/generated/product_i2.c
@@ -301,15 +301,13 @@  mproduct_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/product_i4.c b/libgfortran/generated/product_i4.c
index 16c6f6e10ae..9491031c3a8 100644
--- a/libgfortran/generated/product_i4.c
+++ b/libgfortran/generated/product_i4.c
@@ -301,15 +301,13 @@  mproduct_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/product_i8.c b/libgfortran/generated/product_i8.c
index 66f581f4b2d..49d09318335 100644
--- a/libgfortran/generated/product_i8.c
+++ b/libgfortran/generated/product_i8.c
@@ -301,15 +301,13 @@  mproduct_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/product_r10.c b/libgfortran/generated/product_r10.c
index 8c79ff88a6f..47af031fe90 100644
--- a/libgfortran/generated/product_r10.c
+++ b/libgfortran/generated/product_r10.c
@@ -301,15 +301,13 @@  mproduct_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_r10 (gfc_array_r10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
diff --git a/libgfortran/generated/product_r16.c b/libgfortran/generated/product_r16.c
index 0f5027be42f..3ecafc170e3 100644
--- a/libgfortran/generated/product_r16.c
+++ b/libgfortran/generated/product_r16.c
@@ -301,15 +301,13 @@  mproduct_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_r16 (gfc_array_r16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/product_r17.c b/libgfortran/generated/product_r17.c
index 37134cbb089..8f79c8c9c65 100644
--- a/libgfortran/generated/product_r17.c
+++ b/libgfortran/generated/product_r17.c
@@ -301,15 +301,13 @@  mproduct_r17 (gfc_array_r17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_r17 (gfc_array_r17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
     }
   else
     {
diff --git a/libgfortran/generated/product_r4.c b/libgfortran/generated/product_r4.c
index 9a8eefb5124..f9b09b3c6dc 100644
--- a/libgfortran/generated/product_r4.c
+++ b/libgfortran/generated/product_r4.c
@@ -301,15 +301,13 @@  mproduct_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_r4 (gfc_array_r4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/product_r8.c b/libgfortran/generated/product_r8.c
index 5112b90f5f2..ff6aa522176 100644
--- a/libgfortran/generated/product_r8.c
+++ b/libgfortran/generated/product_r8.c
@@ -301,15 +301,13 @@  mproduct_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  sproduct_r8 (gfc_array_r8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
diff --git a/libgfortran/generated/sum_c10.c b/libgfortran/generated/sum_c10.c
index d6a5db64fca..45018f88c6f 100644
--- a/libgfortran/generated/sum_c10.c
+++ b/libgfortran/generated/sum_c10.c
@@ -301,15 +301,13 @@  msum_c10 (gfc_array_c10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_c10 (gfc_array_c10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_10));
     }
   else
     {
diff --git a/libgfortran/generated/sum_c16.c b/libgfortran/generated/sum_c16.c
index 156382d2f33..df4297c5a84 100644
--- a/libgfortran/generated/sum_c16.c
+++ b/libgfortran/generated/sum_c16.c
@@ -301,15 +301,13 @@  msum_c16 (gfc_array_c16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_c16 (gfc_array_c16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_16));
     }
   else
     {
diff --git a/libgfortran/generated/sum_c17.c b/libgfortran/generated/sum_c17.c
index c00b0b84d5d..65322e78989 100644
--- a/libgfortran/generated/sum_c17.c
+++ b/libgfortran/generated/sum_c17.c
@@ -301,15 +301,13 @@  msum_c17 (gfc_array_c17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_c17 (gfc_array_c17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_17));
     }
   else
     {
diff --git a/libgfortran/generated/sum_c4.c b/libgfortran/generated/sum_c4.c
index b750a91f940..11ce95d53c3 100644
--- a/libgfortran/generated/sum_c4.c
+++ b/libgfortran/generated/sum_c4.c
@@ -301,15 +301,13 @@  msum_c4 (gfc_array_c4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_c4 (gfc_array_c4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_4));
     }
   else
     {
diff --git a/libgfortran/generated/sum_c8.c b/libgfortran/generated/sum_c8.c
index 19b03c07504..16b9ed40e92 100644
--- a/libgfortran/generated/sum_c8.c
+++ b/libgfortran/generated/sum_c8.c
@@ -301,15 +301,13 @@  msum_c8 (gfc_array_c8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_c8 (gfc_array_c8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_COMPLEX_8));
     }
   else
     {
diff --git a/libgfortran/generated/sum_i1.c b/libgfortran/generated/sum_i1.c
index 2df0ec11a87..c2df9619f98 100644
--- a/libgfortran/generated/sum_i1.c
+++ b/libgfortran/generated/sum_i1.c
@@ -301,15 +301,13 @@  msum_i1 (gfc_array_i1 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_i1 (gfc_array_i1 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_1));
     }
   else
     {
diff --git a/libgfortran/generated/sum_i16.c b/libgfortran/generated/sum_i16.c
index 0b7179b595d..d4b3d970e51 100644
--- a/libgfortran/generated/sum_i16.c
+++ b/libgfortran/generated/sum_i16.c
@@ -301,15 +301,13 @@  msum_i16 (gfc_array_i16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_i16 (gfc_array_i16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_16));
     }
   else
     {
diff --git a/libgfortran/generated/sum_i2.c b/libgfortran/generated/sum_i2.c
index 3149e5fe5e5..044361c6167 100644
--- a/libgfortran/generated/sum_i2.c
+++ b/libgfortran/generated/sum_i2.c
@@ -301,15 +301,13 @@  msum_i2 (gfc_array_i2 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_i2 (gfc_array_i2 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_2));
     }
   else
     {
diff --git a/libgfortran/generated/sum_i4.c b/libgfortran/generated/sum_i4.c
index 5cf5f95bf0f..b37393e4c70 100644
--- a/libgfortran/generated/sum_i4.c
+++ b/libgfortran/generated/sum_i4.c
@@ -301,15 +301,13 @@  msum_i4 (gfc_array_i4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_i4 (gfc_array_i4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_4));
     }
   else
     {
diff --git a/libgfortran/generated/sum_i8.c b/libgfortran/generated/sum_i8.c
index a020ba63349..235a98e5fb7 100644
--- a/libgfortran/generated/sum_i8.c
+++ b/libgfortran/generated/sum_i8.c
@@ -301,15 +301,13 @@  msum_i8 (gfc_array_i8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_i8 (gfc_array_i8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_INTEGER_8));
     }
   else
     {
diff --git a/libgfortran/generated/sum_r10.c b/libgfortran/generated/sum_r10.c
index f02f9816b7d..4e2071fa570 100644
--- a/libgfortran/generated/sum_r10.c
+++ b/libgfortran/generated/sum_r10.c
@@ -301,15 +301,13 @@  msum_r10 (gfc_array_r10 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_r10 (gfc_array_r10 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_10));
     }
   else
     {
diff --git a/libgfortran/generated/sum_r16.c b/libgfortran/generated/sum_r16.c
index 43439ef385c..47571d9b010 100644
--- a/libgfortran/generated/sum_r16.c
+++ b/libgfortran/generated/sum_r16.c
@@ -301,15 +301,13 @@  msum_r16 (gfc_array_r16 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_r16 (gfc_array_r16 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_16));
     }
   else
     {
diff --git a/libgfortran/generated/sum_r17.c b/libgfortran/generated/sum_r17.c
index 97af0d73a77..d479f200a80 100644
--- a/libgfortran/generated/sum_r17.c
+++ b/libgfortran/generated/sum_r17.c
@@ -301,15 +301,13 @@  msum_r17 (gfc_array_r17 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_r17 (gfc_array_r17 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_17));
     }
   else
     {
diff --git a/libgfortran/generated/sum_r4.c b/libgfortran/generated/sum_r4.c
index 5a4e06a5545..227ea34124f 100644
--- a/libgfortran/generated/sum_r4.c
+++ b/libgfortran/generated/sum_r4.c
@@ -301,15 +301,13 @@  msum_r4 (gfc_array_r4 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_r4 (gfc_array_r4 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_4));
     }
   else
     {
diff --git a/libgfortran/generated/sum_r8.c b/libgfortran/generated/sum_r8.c
index 00f7cdba540..d0d0c111d4c 100644
--- a/libgfortran/generated/sum_r8.c
+++ b/libgfortran/generated/sum_r8.c
@@ -301,15 +301,13 @@  msum_r8 (gfc_array_r8 * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
-
     }
   else
     {
@@ -466,14 +464,13 @@  ssum_r8 (gfc_array_r8 * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (GFC_REAL_8));
     }
   else
     {
diff --git a/libgfortran/m4/ifunction-s.m4 b/libgfortran/m4/ifunction-s.m4
index 16615aa290f..bc5ce55e81c 100644
--- a/libgfortran/m4/ifunction-s.m4
+++ b/libgfortran/m4/ifunction-s.m4
@@ -303,15 +303,13 @@  m'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
-
     }
   else
     {
@@ -467,14 +465,13 @@  s'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {
diff --git a/libgfortran/m4/ifunction-s2.m4 b/libgfortran/m4/ifunction-s2.m4
index 4d31c208e05..22ba00899d7 100644
--- a/libgfortran/m4/ifunction-s2.m4
+++ b/libgfortran/m4/ifunction-s2.m4
@@ -304,15 +304,13 @@  void
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
-
     }
   else
     {
@@ -468,14 +466,13 @@  void
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1]
       		 * string_len;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {
diff --git a/libgfortran/m4/ifunction.m4 b/libgfortran/m4/ifunction.m4
index c64217ec5db..c80aa86c890 100644
--- a/libgfortran/m4/ifunction.m4
+++ b/libgfortran/m4/ifunction.m4
@@ -291,15 +291,13 @@  m'name`'rtype_qual`_'atype_code` ('rtype` * const restrict retarray,
       retarray->offset = 0;
       retarray->dtype.rank = rank;
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
-
     }
   else
     {
@@ -455,14 +453,13 @@  void
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {
diff --git a/libgfortran/m4/ifunction_logical.m4 b/libgfortran/m4/ifunction_logical.m4
index 0568387e343..cb576f3472e 100644
--- a/libgfortran/m4/ifunction_logical.m4
+++ b/libgfortran/m4/ifunction_logical.m4
@@ -91,14 +91,13 @@  name`'rtype_qual`_'atype_code (rtype * const restrict retarray,
 
       alloc_size = GFC_DESCRIPTOR_STRIDE(retarray,rank-1) * extent[rank-1];
 
+      retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
       if (alloc_size == 0)
 	{
 	  /* Make sure we have a zero-sized array.  */
 	  GFC_DIMENSION_SET(retarray->dim[0], 0, -1, 1);
 	  return;
 	}
-      else
-	retarray->base_addr = xmallocarray (alloc_size, sizeof (rtype_name));
     }
   else
     {