summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/matmul_5.f9011
-rw-r--r--libgfortran/ChangeLog15
-rw-r--r--libgfortran/generated/matmul_c10.c3
-rw-r--r--libgfortran/generated/matmul_c16.c3
-rw-r--r--libgfortran/generated/matmul_c4.c3
-rw-r--r--libgfortran/generated/matmul_c8.c3
-rw-r--r--libgfortran/generated/matmul_i1.c3
-rw-r--r--libgfortran/generated/matmul_i16.c3
-rw-r--r--libgfortran/generated/matmul_i2.c3
-rw-r--r--libgfortran/generated/matmul_i4.c3
-rw-r--r--libgfortran/generated/matmul_i8.c3
-rw-r--r--libgfortran/generated/matmul_r10.c3
-rw-r--r--libgfortran/generated/matmul_r16.c3
-rw-r--r--libgfortran/generated/matmul_r4.c3
-rw-r--r--libgfortran/generated/matmul_r8.c3
-rw-r--r--libgfortran/m4/matmul.m43
17 files changed, 59 insertions, 14 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b8de460e8d5..edbe7edd628 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-07-09 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/32336
+ * gfortran.dg/matmul_5.f90: New test case.
+
2007-07-09 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/fesd-any.c: Move to gcc.dg/debug/dwarf2 directory.
diff --git a/gcc/testsuite/gfortran.dg/matmul_5.f90 b/gcc/testsuite/gfortran.dg/matmul_5.f90
new file mode 100644
index 00000000000..b67601f40f4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/matmul_5.f90
@@ -0,0 +1,11 @@
+! { dg-do run }
+! { dg-shouldfail "dimension of array B incorrect in MATMUL intrinsic" }
+program main
+ real, dimension(:,:), allocatable :: a
+ real, dimension(:), allocatable :: b
+ allocate (a(2,2), b(3))
+ call random_number(a)
+ call random_number(b)
+ print *,matmul(a,b)
+end program main
+! { dg-output "Fortran runtime error: dimension of array B incorrect in MATMUL intrinsic.*" }
diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 7b6f3e567cd..154d241f651 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,18 @@
+2007-07-09 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR libfortran/32336
+ * m4/matmul.m4: When the dimension of b is incorrect,
+ raise a runtime error instead of a failed assertion.
+ * generated/matmul_i1.c: Regenerated.
+ * generated/matmul_i2.c: Regenerated.
+ * generated/matmul_i4.c: Regenerated.
+ * generated/matmul_i8.c: Regenerated.
+ * generated/matmul_i16.c: Regenerated.
+ * generated/matmul_r4.c: Regenerated.
+ * generated/matmul_r8.c: Regenerated.
+ * generated/matmul_r10.c: Regenerated.
+ * generated/matmul_r16.c: Regenerated.
+
2007-07-08 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libgfortran/32678
diff --git a/libgfortran/generated/matmul_c10.c b/libgfortran/generated/matmul_c10.c
index 5e3b281245c..d7d4c650a98 100644
--- a/libgfortran/generated/matmul_c10.c
+++ b/libgfortran/generated/matmul_c10.c
@@ -169,7 +169,8 @@ matmul_c10 (gfc_array_c10 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_c16.c b/libgfortran/generated/matmul_c16.c
index f7301114b37..e9ad2d439c0 100644
--- a/libgfortran/generated/matmul_c16.c
+++ b/libgfortran/generated/matmul_c16.c
@@ -169,7 +169,8 @@ matmul_c16 (gfc_array_c16 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_c4.c b/libgfortran/generated/matmul_c4.c
index f2984ab48ab..753e535df79 100644
--- a/libgfortran/generated/matmul_c4.c
+++ b/libgfortran/generated/matmul_c4.c
@@ -169,7 +169,8 @@ matmul_c4 (gfc_array_c4 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_c8.c b/libgfortran/generated/matmul_c8.c
index 65cc0a52c4b..23aea6a4fc3 100644
--- a/libgfortran/generated/matmul_c8.c
+++ b/libgfortran/generated/matmul_c8.c
@@ -169,7 +169,8 @@ matmul_c8 (gfc_array_c8 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_i1.c b/libgfortran/generated/matmul_i1.c
index ce98de17950..ae035076bed 100644
--- a/libgfortran/generated/matmul_i1.c
+++ b/libgfortran/generated/matmul_i1.c
@@ -169,7 +169,8 @@ matmul_i1 (gfc_array_i1 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_i16.c b/libgfortran/generated/matmul_i16.c
index a193669d108..38756dc9010 100644
--- a/libgfortran/generated/matmul_i16.c
+++ b/libgfortran/generated/matmul_i16.c
@@ -169,7 +169,8 @@ matmul_i16 (gfc_array_i16 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_i2.c b/libgfortran/generated/matmul_i2.c
index b86839e379b..7287b6b745a 100644
--- a/libgfortran/generated/matmul_i2.c
+++ b/libgfortran/generated/matmul_i2.c
@@ -169,7 +169,8 @@ matmul_i2 (gfc_array_i2 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_i4.c b/libgfortran/generated/matmul_i4.c
index 69b9b487a81..d5eed998311 100644
--- a/libgfortran/generated/matmul_i4.c
+++ b/libgfortran/generated/matmul_i4.c
@@ -169,7 +169,8 @@ matmul_i4 (gfc_array_i4 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_i8.c b/libgfortran/generated/matmul_i8.c
index 23a87a904f7..4ab55471c9e 100644
--- a/libgfortran/generated/matmul_i8.c
+++ b/libgfortran/generated/matmul_i8.c
@@ -169,7 +169,8 @@ matmul_i8 (gfc_array_i8 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_r10.c b/libgfortran/generated/matmul_r10.c
index e4dfd74ef03..9f7fb4b654e 100644
--- a/libgfortran/generated/matmul_r10.c
+++ b/libgfortran/generated/matmul_r10.c
@@ -169,7 +169,8 @@ matmul_r10 (gfc_array_r10 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_r16.c b/libgfortran/generated/matmul_r16.c
index ec760f2d3d8..6a8f220a447 100644
--- a/libgfortran/generated/matmul_r16.c
+++ b/libgfortran/generated/matmul_r16.c
@@ -169,7 +169,8 @@ matmul_r16 (gfc_array_r16 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_r4.c b/libgfortran/generated/matmul_r4.c
index cf2f45fb125..e4a45801edc 100644
--- a/libgfortran/generated/matmul_r4.c
+++ b/libgfortran/generated/matmul_r4.c
@@ -169,7 +169,8 @@ matmul_r4 (gfc_array_r4 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/generated/matmul_r8.c b/libgfortran/generated/matmul_r8.c
index c746f6c3519..e823a756a97 100644
--- a/libgfortran/generated/matmul_r8.c
+++ b/libgfortran/generated/matmul_r8.c
@@ -169,7 +169,8 @@ matmul_r8 (gfc_array_r8 * const restrict retarray,
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{
diff --git a/libgfortran/m4/matmul.m4 b/libgfortran/m4/matmul.m4
index 3156fdcac0c..6235f63e2b0 100644
--- a/libgfortran/m4/matmul.m4
+++ b/libgfortran/m4/matmul.m4
@@ -171,7 +171,8 @@ sinclude(`matmul_asm_'rtype_code`.m4')dnl
xcount = a->dim[0].ubound + 1 - a->dim[0].lbound;
}
- assert(count == b->dim[0].ubound + 1 - b->dim[0].lbound);
+ if (count != b->dim[0].ubound + 1 - b->dim[0].lbound)
+ runtime_error ("dimension of array B incorrect in MATMUL intrinsic");
if (GFC_DESCRIPTOR_RANK (b) == 1)
{