Hi Martin, On 12/10/19 2:04 PM, Martin Liška wrote:
The patch is about early bail out in gfc_dep_compare_expr function when one of the arguments (and not both at the same time) is null. I'm not sure, it's a proper fix however.
I think it is the best one can do. Technically, one could replace the comparison by "length == 1 || "" == x(1:)" but I am not sure whether that would be be advantageous in general (esp. when taking implementation time into account); in any case, that's independent of the ICE.
The caller in this example is "are_identical_variables": if (gfc_dep_compare_expr (r1->u.ss.end, r2->u.ss.end) != 0) return false; comparing the string end. And "-2 if the relationship could not be determined".
Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed?
Yes; it looks good to me – thanks! Tobias
gcc/fortran/ChangeLog: 2019-12-10 Martin Liska <mli...@suse.cz> PR fortran/92874 * dependency.c (gfc_dep_compare_expr): Bail out when one of the arguments is null. gcc/testsuite/ChangeLog: 2019-12-10 Martin Liska <mli...@suse.cz> PR fortran/92874 * gfortran.dg/pr92874.f90: New test. --- gcc/fortran/dependency.c | 2 ++ gcc/testsuite/gfortran.dg/pr92874.f90 | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/pr92874.f90