https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97345
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anlauf at gcc dot gnu.org
--- Comment #2 from anlauf at gcc dot gnu.org ---
Visual inspection of function do_subscript() suggests the following patch:
diff --git a/gcc/fortran/frontend-passes.cc b/gcc/fortran/frontend-passes.cc
index 612c12d233d..6731de64539 100644
--- a/gcc/fortran/frontend-passes.cc
+++ b/gcc/fortran/frontend-passes.cc
@@ -2892,7 +2892,12 @@ do_subscript (gfc_expr **e)
cmp = mpz_cmp (do_end, do_start);
if ((sgn > 0 && cmp < 0) || (sgn < 0 && cmp > 0))
- break;
+ {
+ mpz_clear (do_start);
+ mpz_clear (do_end);
+ mpz_clear (do_step);
+ break;
+ }
}
/* May have to correct the end value if the step does not equal
@@ -2965,6 +2970,10 @@ do_subscript (gfc_expr **e)
mpz_clear (val);
}
}
+
+ mpz_clear (do_start);
+ mpz_clear (do_end);
+ mpz_clear (do_step);
}
}
}
Can this be committed without a testcase after regtesting?
Or how should a testcase look like?