[Patch, Fortran] PR92898 - [9/10 Regression] ICE in gfc_check_is_contiguous, at fortran/check.c:7157

Thomas Koenig tkoenig@netcologne.de
Tue Dec 10 22:34:00 GMT 2019


Hello Harald,

> Index: gcc/fortran/check.c
> ===================================================================
> --- gcc/fortran/check.c	(Revision 279183)
> +++ gcc/fortran/check.c	(Arbeitskopie)
> @@ -7154,7 +7154,9 @@ bool
>   gfc_check_is_contiguous (gfc_expr *array)
>   {
>     if (array->expr_type == EXPR_NULL
> -      && array->symtree->n.sym->attr.pointer == 1)
> +      && (!array->symtree ||
> +	  (array->symtree->n.sym &&
> +	   array->symtree->n.sym->attr.pointer == 1)))

I have to admit I do not understand the original code here, nor
do I quite understand your fix.

Is there any circumstance where array->expr_type == EXPR_NULL, but
is_contiguous is valid?  What would go wrong if the other tests
were removed?


> Index: gcc/testsuite/gfortran.dg/pr91641.f90
> ===================================================================
> --- gcc/testsuite/gfortran.dg/pr91641.f90	(Revision 279183)
> +++ gcc/testsuite/gfortran.dg/pr91641.f90	(Arbeitskopie)
> @@ -1,7 +1,9 @@
>   ! { dg-do compile }
>   ! PR fortran/91641
> -! Code conyributed by Gerhard Steinmetz
> +! PR fortran/92898
> +! Code contributed by Gerhard Steinmetz
>   program p
>      real, pointer :: z(:)
>      print *, is_contiguous (null(z))    ! { dg-error "shall be an associated" }
> +   print *, is_contiguous (null())     ! { dg-error "shall be an associated" }
>   end

Sometimes, it is necessary to change test cases, when error messages
change.  If this is not the case, it is better to add new tests to
new test cases - this makes regression hunting much easier.

Regards

	Thomas



More information about the Fortran mailing list