From: Thomas Koenig Date: Tue, 27 Mar 2018 18:42:02 +0000 (+0000) Subject: re PR fortran/85084 (ICE: out of memory allocating 18446744073709551600 bytes ...) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ef22816c3b3f580addc60df340abda46cc6ba01c;p=gcc.git re PR fortran/85084 (ICE: out of memory allocating 18446744073709551600 bytes ...) 2018-03-27 Thomas Koenig PR fortran/85084 * frontend-passes.c (gfc_run_passes): Do not run front-end optimizations if a previous error occurred. 2018-03-27 Thomas Koenig PR fortran/85084 * gfortran.dg/matmul_rank_1.f90: New test. From-SVN: r258900 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fb0f04e47f0..b88b27ba784 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-03-27 Thomas Koenig + + PR fortran/85084 + * frontend-passes.c (gfc_run_passes): Do not run front-end + optimizations if a previous error occurred. + 2018-03-27 Thomas Koenig Harald Anlauf diff --git a/gcc/fortran/frontend-passes.c b/gcc/fortran/frontend-passes.c index 1ffd27d686a..6888224cd81 100644 --- a/gcc/fortran/frontend-passes.c +++ b/gcc/fortran/frontend-passes.c @@ -156,6 +156,10 @@ gfc_run_passes (gfc_namespace *ns) check_locus (ns); #endif + gfc_get_errors (&w, &e); + if (e > 0) + return; + if (flag_frontend_optimize || flag_frontend_loop_interchange) optimize_namespace (ns); @@ -168,10 +172,6 @@ gfc_run_passes (gfc_namespace *ns) expr_array.release (); } - gfc_get_errors (&w, &e); - if (e > 0) - return; - if (flag_realloc_lhs) realloc_strings (ns); } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 642bf15852b..b8d56f8532c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-27 Thomas Koenig + + PR fortran/85084 + * gfortran.dg/matmul_rank_1.f90: New test. + 2018-03-27 Thomas Koenig Harald Anlauf diff --git a/gcc/testsuite/gfortran.dg/matmul_rank_1.f90 b/gcc/testsuite/gfortran.dg/matmul_rank_1.f90 new file mode 100644 index 00000000000..f111b26018f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/matmul_rank_1.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-additional-options "-ffrontend-optimize" } +! PR 85044 - used to die on allocating a negative amount of memory. +! Test case by Gerhard Steinmetz. +program p + real :: a(3,3) = 1.0 + real :: b(33) + b = matmul(a, a) ! { dg-error "Incompatible ranks" } +end