[Bug fortran/126386] matmul in combination with multiplication and transpose fails to correctly reallocate result array

"tkoenig at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126386

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Single-character fix...

diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc
index 92678310ffd..70e8ec9e161 100644
--- a/gcc/fortran/frontend-passes.cc
+++ b/gcc/fortran/frontend-passes.cc
@@ -3566,7 +3566,7 @@ matmul_lhs_realloc (gfc_expr *c, gfc_expr *a, gfc_expr
*b,
       ar->start[0] = get_array_inq_function (GFC_ISYM_SIZE, a, 1);
       cond = build_logical_expr (INTRINSIC_NE,
                                 get_array_inq_function (GFC_ISYM_SIZE, c, 1),
-                                get_array_inq_function (GFC_ISYM_SIZE, a, 2));
+                                get_array_inq_function (GFC_ISYM_SIZE, a, 1));
       break;

     case A1B2:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.