From: Harald Anlauf Date: Sun, 8 Dec 2024 21:30:32 +0000 (+0100) Subject: Fortran: fix two minor front-end GMP memleaks X-Git-Tag: basepoints/gcc-16~3500 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4525729b747827afa62320696709ca499904860;p=thirdparty%2Fgcc.git Fortran: fix two minor front-end GMP memleaks gcc/fortran/ChangeLog: * expr.cc (find_array_section): Do not initialize GMP variables twice. --- diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index a997bdae726a..a349d989d6c4 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -1613,7 +1613,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) /* Zero-sized arrays have no shape and no elements, stop early. */ if (!begin->shape) { - mpz_init_set_ui (nelts, 0); + mpz_set_ui (nelts, 0); break; } @@ -1714,7 +1714,7 @@ find_array_section (gfc_expr *expr, gfc_ref *ref) constructor. */ for (idx = 0; idx < (int) mpz_get_si (nelts); idx++) { - mpz_init_set_ui (ptr, 0); + mpz_set_ui (ptr, 0); incr_ctr = true; for (d = 0; d < rank; d++)