gcc/fortran/ChangeLog:
PR fortran/95352
* simplify.c (simplify_bound_dim): Add check for NULL pointer
before trying to access structure member.
José Rui Faustino de Sousa <jrfsousa@gmail.com>
gcc/testsuite/ChangeLog:
* gfortran.dg/PR95352.f90: New test.
|| (coarray && d == as->rank + as->corank
&& (!upper || flag_coarray == GFC_FCOARRAY_SINGLE)))
{
- if (as->lower[d-1]->expr_type == EXPR_CONSTANT)
+ if (as->lower[d-1] && as->lower[d-1]->expr_type == EXPR_CONSTANT)
{
gfc_free_expr (result);
return gfc_copy_expr (as->lower[d-1]);
--- /dev/null
+! { dg-do compile }
+!
+! Test the fix for PR95352
+!
+
+module ice6_m
+
+ implicit none
+
+contains
+
+ function ice6_s(a) result(ierr)
+ integer, intent(in) :: a(..)
+
+ integer :: ierr
+
+ integer :: lb
+
+ select rank(a)
+ rank(*)
+ lb = lbound(a, dim=1)
+ if(lbound(a, dim=1)/=lb) ierr = -1
+ end select
+ return
+ end function ice6_s
+
+end module ice6_m