aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/simplify.c
diff options
context:
space:
mode:
authorHarald Anlauf <anlauf@gmx.de>2021-04-01 07:49:32 +0200
committerHarald Anlauf <anlauf@gmx.de>2021-04-01 07:49:32 +0200
commitd7cef070bf43bfb3f3d77bac42eadea06c4b0281 (patch)
treec70e4882c328bd07653b9d3df48bc2385672d3ea /gcc/fortran/simplify.c
parent95d217ab52d31dc06fda42fc136dea165909e88b (diff)
downloadgcc-d7cef070bf43bfb3f3d77bac42eadea06c4b0281.zip
gcc-d7cef070bf43bfb3f3d77bac42eadea06c4b0281.tar.gz
gcc-d7cef070bf43bfb3f3d77bac42eadea06c4b0281.tar.bz2
PR fortran/99840 - ICE in gfc_simplify_matmul, at fortran/simplify.c:4777
The simplification of the transposition of a constant array shall properly initialize and set the shape of the result. gcc/fortran/ChangeLog: PR fortran/99840 * simplify.c (gfc_simplify_transpose): Properly initialize resulting shape. gcc/testsuite/ChangeLog: PR fortran/99840 * gfortran.dg/transpose_5.f90: New test.
Diffstat (limited to 'gcc/fortran/simplify.c')
-rw-r--r--gcc/fortran/simplify.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 388aca7..c27b47a 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -8123,8 +8123,8 @@ gfc_simplify_transpose (gfc_expr *matrix)
&matrix->where);
result->rank = 2;
result->shape = gfc_get_shape (result->rank);
- mpz_set (result->shape[0], matrix->shape[1]);
- mpz_set (result->shape[1], matrix->shape[0]);
+ mpz_init_set (result->shape[0], matrix->shape[1]);
+ mpz_init_set (result->shape[1], matrix->shape[0]);
if (matrix->ts.type == BT_CHARACTER)
result->ts.u.cl = matrix->ts.u.cl;