[Patch fortran] PR 68567 - ICE on using wrong defined arrays (different cases/messages)

Dominique d'Humières dominiq@lps.ens.fr
Wed Apr 3 15:01:00 GMT 2019


Hi Steve,

Do you agree with the following packaging of your patch for pr68567?

2019-04-03  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/68567
	* expr.c (gfc_reduce_init_expr): Add extra check to avoid dereferencing a null
	pointer.

2019-04-03  Dominique d'Humieres  <dominiq@gcc.gnu.org>

	PR fortran/68567
	* gfortran.dg/parameter_array_error_1.f90: New test.

--- ../_clean/gcc/fortran/expr.c	2019-04-03 11:00:55.000000000 +0200
+++ gcc/fortran/expr.c	2019-04-02 20:55:20.000000000 +0200
@@ -3003,7 +3003,7 @@ gfc_reduce_init_expr (gfc_expr *expr)
     t = gfc_check_init_expr (expr);
   gfc_init_expr_flag = false;
 
-  if (!t)
+  if (!t || !expr)
     return false;
 
   if (expr->expr_type == EXPR_ARRAY)

! { dg-do compile }
! PR68567
! Contributed by Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de>
!
program p
   integer, parameter :: a(:) = [2, 1] ! { dg-error "cannot be automatic or of deferred shape" }
end

Tested on darwin for more than two years.

TIA

Dominique



More information about the Gcc-patches mailing list