aboutsummaryrefslogtreecommitdiff
path: root/libgfortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2017-05-08 17:56:13 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2017-05-08 17:56:13 +0000
commitfd9910392bc2854ecc5c91fd6f089fa4e66edb44 (patch)
tree644a36f58118c3fd22c9a3fc368ec218e1e7d524 /libgfortran
parentd16d5eac2a0132adcd9e88ae288bedd03abfc513 (diff)
downloadgcc-fd9910392bc2854ecc5c91fd6f089fa4e66edb44.zip
gcc-fd9910392bc2854ecc5c91fd6f089fa4e66edb44.tar.gz
gcc-fd9910392bc2854ecc5c91fd6f089fa4e66edb44.tar.bz2
re PR libfortran/80602 (Reduce stack usage for blocked matmul)
2017-05-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80602 * m4/matmul_internal.m4: 'matmul_name`: Change t1 to a VLA of the required size. * generated/matmul_c10.c: Regenerated. * generated/matmul_c16.c: Regenerated. * generated/matmul_c4.c: Regenerated. * generated/matmul_c8.c: Regenerated. * generated/matmul_i1.c: Regenerated. * generated/matmul_i16.c: Regenerated. * generated/matmul_i2.c: Regenerated. * generated/matmul_i4.c: Regenerated. * generated/matmul_i8.c: Regenerated. * generated/matmul_r10.c: Regenerated. * generated/matmul_r16.c: Regenerated. * generated/matmul_r4.c: Regenerated. * generated/matmul_r8.c: Regenerated. 2017-05-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/80602 * gfortran.dg/matmul_15.f90: New test case. From-SVN: r247753
Diffstat (limited to 'libgfortran')
-rw-r--r--libgfortran/ChangeLog19
-rw-r--r--libgfortran/Makefile.in5
-rw-r--r--libgfortran/generated/matmul_c10.c70
-rw-r--r--libgfortran/generated/matmul_c16.c70
-rw-r--r--libgfortran/generated/matmul_c4.c70
-rw-r--r--libgfortran/generated/matmul_c8.c70
-rw-r--r--libgfortran/generated/matmul_i1.c70
-rw-r--r--libgfortran/generated/matmul_i16.c70
-rw-r--r--libgfortran/generated/matmul_i2.c70
-rw-r--r--libgfortran/generated/matmul_i4.c70
-rw-r--r--libgfortran/generated/matmul_i8.c70
-rw-r--r--libgfortran/generated/matmul_r10.c70
-rw-r--r--libgfortran/generated/matmul_r16.c70
-rw-r--r--libgfortran/generated/matmul_r4.c70
-rw-r--r--libgfortran/generated/matmul_r8.c70
-rw-r--r--libgfortran/m4/matmul_internal.m414
16 files changed, 814 insertions, 134 deletions
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index ad8d95c..e29301a 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,22 @@
+2017-05-08 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/80602
+ * m4/matmul_internal.m4: 'matmul_name`: Change
+ t1 to a VLA of the required size.
+ * generated/matmul_c10.c: Regenerated.
+ * generated/matmul_c16.c: Regenerated.
+ * generated/matmul_c4.c: Regenerated.
+ * generated/matmul_c8.c: Regenerated.
+ * generated/matmul_i1.c: Regenerated.
+ * generated/matmul_i16.c: Regenerated.
+ * generated/matmul_i2.c: Regenerated.
+ * generated/matmul_i4.c: Regenerated.
+ * generated/matmul_i8.c: Regenerated.
+ * generated/matmul_r10.c: Regenerated.
+ * generated/matmul_r16.c: Regenerated.
+ * generated/matmul_r4.c: Regenerated.
+ * generated/matmul_r8.c: Regenerated.
+
2017-04-11 Jerry DeLisle <jvdelisle@gcc.gnu.org>
* close.c: Fix white space in pointer declarations and comment
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 05b183d..4914a6f 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -137,8 +137,9 @@ am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \
$(top_srcdir)/../ltversion.m4 $(top_srcdir)/../lt~obsolete.m4 \
$(top_srcdir)/acinclude.m4 $(top_srcdir)/../config/acx.m4 \
$(top_srcdir)/../config/no-executables.m4 \
- $(top_srcdir)/../config/math.m4 $(top_srcdir)/../libtool.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/../config/math.m4 \
+ $(top_srcdir)/../config/ax_check_define.m4 \
+ $(top_srcdir)/../libtool.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
index c8e7a6c..55f8fe9 100644
--- a/libgfortran/generated/matmul_c10.c
+++ b/libgfortran/generated/matmul_c10.c
@@ -286,8 +286,7 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_c10_avx (gfc_array_c10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_c10_avx2 (gfc_array_c10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_c10_avx512f (gfc_array_c10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_c10_vanilla (gfc_array_c10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
index adbf1c8..bc90296 100644
--- a/libgfortran/generated/matmul_c16.c
+++ b/libgfortran/generated/matmul_c16.c
@@ -286,8 +286,7 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_c16_avx (gfc_array_c16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_c16_avx2 (gfc_array_c16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_c16_avx512f (gfc_array_c16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_c16_vanilla (gfc_array_c16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index ff0e76a..1241800 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -286,8 +286,7 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_c4_avx (gfc_array_c4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_c4_avx2 (gfc_array_c4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_c4_avx512f (gfc_array_c4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_c4_vanilla (gfc_array_c4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index 483ebf1..aafa3be 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -286,8 +286,7 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_c8_avx (gfc_array_c8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_c8_avx2 (gfc_array_c8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_c8_avx512f (gfc_array_c8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_c8_vanilla (gfc_array_c8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_COMPLEX_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_COMPLEX_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_COMPLEX_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c
index 51cfcc0..bbf84a9 100644
--- a/libgfortran/generated/matmul_i1.c
+++ b/libgfortran/generated/matmul_i1.c
@@ -286,8 +286,7 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_1 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_1 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_i1_avx (gfc_array_i1 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_1 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_1 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_1 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_i1_avx2 (gfc_array_i1 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_1 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_1 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_1 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_i1_avx512f (gfc_array_i1 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_1 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_1 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_1 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_i1_vanilla (gfc_array_i1 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_1 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_i1 (gfc_array_i1 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_1 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_1 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_i1 (gfc_array_i1 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_1 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
index 90a422f..1394aba 100644
--- a/libgfortran/generated/matmul_i16.c
+++ b/libgfortran/generated/matmul_i16.c
@@ -286,8 +286,7 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_i16_avx (gfc_array_i16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_i16_avx2 (gfc_array_i16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_i16_avx512f (gfc_array_i16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_i16_vanilla (gfc_array_i16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_i16 (gfc_array_i16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_i16 (gfc_array_i16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c
index 58be84f..9ffe75b 100644
--- a/libgfortran/generated/matmul_i2.c
+++ b/libgfortran/generated/matmul_i2.c
@@ -286,8 +286,7 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_2 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_2 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_i2_avx (gfc_array_i2 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_2 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_2 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_2 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_i2_avx2 (gfc_array_i2 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_2 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_2 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_2 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_i2_avx512f (gfc_array_i2 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_2 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_2 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_2 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_i2_vanilla (gfc_array_i2 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_2 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_i2 (gfc_array_i2 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_2 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_2 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_i2 (gfc_array_i2 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_2 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index 1e724d54..eab6c77 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -286,8 +286,7 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_i4_avx (gfc_array_i4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_i4_avx2 (gfc_array_i4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_i4_avx512f (gfc_array_i4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_i4_vanilla (gfc_array_i4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_i4 (gfc_array_i4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_i4 (gfc_array_i4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index f5ed84f..4dee0ab 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -286,8 +286,7 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_i8_avx (gfc_array_i8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_i8_avx2 (gfc_array_i8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_i8_avx512f (gfc_array_i8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_i8_vanilla (gfc_array_i8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_i8 (gfc_array_i8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_INTEGER_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_INTEGER_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_i8 (gfc_array_i8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_INTEGER_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
index 8f76fac..4b66a84 100644
--- a/libgfortran/generated/matmul_r10.c
+++ b/libgfortran/generated/matmul_r10.c
@@ -286,8 +286,7 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_r10_avx (gfc_array_r10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_r10_avx2 (gfc_array_r10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_r10_avx512f (gfc_array_r10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_r10_vanilla (gfc_array_r10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_10 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_10 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_10 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
index 6a7687f..fcef45b 100644
--- a/libgfortran/generated/matmul_r16.c
+++ b/libgfortran/generated/matmul_r16.c
@@ -286,8 +286,7 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_r16_avx (gfc_array_r16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_r16_avx2 (gfc_array_r16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_r16_avx512f (gfc_array_r16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_r16_vanilla (gfc_array_r16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_16 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_16 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_16 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index dbb31b0..0996c69 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -286,8 +286,7 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_r4_avx (gfc_array_r4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_r4_avx2 (gfc_array_r4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_r4_avx512f (gfc_array_r4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_r4_vanilla (gfc_array_r4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_4 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_4 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_4 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index 23efed2..1d75e5c 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -286,8 +286,7 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -311,6 +310,17 @@ matmul_r8_avx (gfc_array_r8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -829,8 +839,7 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -854,6 +863,17 @@ matmul_r8_avx2 (gfc_array_r8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1372,8 +1392,7 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1397,6 +1416,17 @@ matmul_r8_avx512f (gfc_array_r8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -1911,8 +1941,7 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -1936,6 +1965,17 @@ matmul_r8_vanilla (gfc_array_r8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
@@ -2508,8 +2548,7 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
i1, i2, i3, i4, i5, i6;
/* Local variables */
- GFC_REAL_8 t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ GFC_REAL_8 f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -2533,6 +2572,17 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ GFC_REAL_8 t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)
diff --git a/libgfortran/m4/matmul_internal.m4 b/libgfortran/m4/matmul_internal.m4
index d35968b..3783956 100644
--- a/libgfortran/m4/matmul_internal.m4
+++ b/libgfortran/m4/matmul_internal.m4
@@ -202,8 +202,7 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
i1, i2, i3, i4, i5, i6;
/* Local variables */
- 'rtype_name` t1[65536], /* was [256][256] */
- f11, f12, f21, f22, f31, f32, f41, f42,
+ 'rtype_name` f11, f12, f21, f22, f31, f32, f41, f42,
f13, f14, f23, f24, f33, f34, f43, f44;
index_type i, j, l, ii, jj, ll;
index_type isec, jsec, lsec, uisec, ujsec, ulsec;
@@ -227,6 +226,17 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
if (m == 0 || n == 0 || k == 0)
return;
+ /* Adjust size of t1 to what is needed. */
+ index_type t1_dim;
+ t1_dim = (a_dim1-1) * 256 + b_dim1;
+ if (t1_dim > 65536)
+ t1_dim = 65536;
+
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wvla"
+ 'rtype_name` t1[t1_dim]; /* was [256][256] */
+#pragma GCC diagnostic pop
+
/* Empty c first. */
for (j=1; j<=n; j++)
for (i=1; i<=m; i++)