[Bug fortran/99840] [9/10/11 Regression] ICE in gfc_simplify_matmul, at fortran/simplify.c:4777
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 30 20:05:30 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99840
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
Patch. Check if a or b is zero-sized.
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 388aca7c38c..6c5259c648d 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4728,7 +4728,9 @@ gfc_simplify_matmul (gfc_expr *matrix_a, gfc_expr
*matrix_b)
int stride_a, offset_a, stride_b, offset_b;
if (!is_constant_array_expr (matrix_a)
- || !is_constant_array_expr (matrix_b))
+ || gfc_is_size_zero_array (matrix_a)
+ || !is_constant_array_expr (matrix_b)
+ || gfc_is_size_zero_array (matrix_b))
return NULL;
/* MATMUL should do mixed-mode arithmetic. Set the result type. */
More information about the Gcc-bugs
mailing list