Hi,
Here is the patch with some of the null pointer tests removed.
This is regression-tested. ChangeLog and test case are as in
https://gcc.gnu.org/pipermail/fortran/2020-April/054193.html .
The list of test cases that fail without the remaining NULL
check is below. Is this OK for trunk?
Best regards,
Linus König
FAIL: gfortran.dg/bound_8.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/bound_8.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/bound_8.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/bound_8.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (test for excess errors)
FAIL: gfortran.dg/bound_8.f90 -O3 -g (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -O3 -g (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/bound_8.f90 -Os (internal compiler error)
FAIL: gfortran.dg/bound_8.f90 -Os (test for excess errors)
FAIL: gfortran.dg/bound_2.f90 -Os (internal compiler error)
FAIL: gfortran.dg/bound_2.f90 -Os (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -O3 -g (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/bound_7.f90 -Os (internal compiler error)
FAIL: gfortran.dg/bound_7.f90 -Os (test for excess errors)
FAIL: gfortran.dg/intrinsic_size_3.f90 -O (internal compiler error)
FAIL: gfortran.dg/intrinsic_size_3.f90 -O (test for excess errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O0 (internal compiler error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O0 (test for excess errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O1 (internal compiler error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O1 (test for excess errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O2 (internal compiler error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O2 (test for excess errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (internal
compiler error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess
errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O3 -g (internal compiler
error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -O3 -g (test for excess errors)
FAIL: gfortran.dg/parameter_array_init_2.f90 -Os (internal compiler error)
FAIL: gfortran.dg/parameter_array_init_2.f90 -Os (test for excess errors)
FAIL: gfortran.dg/pr77429.f90 -O (internal compiler error)
FAIL: gfortran.dg/pr77429.f90 -O (test for errors, line 6)
FAIL: gfortran.dg/pr77429.f90 -O (test for excess errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O0 (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O0 (test for excess errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O1 (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O1 (test for excess errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O2 (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O2 (test for excess errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (internal
compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O3 -fomit-frame-pointer
-funroll-loops -fpeel-loops -ftracer -finline-functions (test for excess
errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O3 -g (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -O3 -g (test for excess errors)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -Os (internal compiler error)
FAIL: gfortran.dg/realloc_on_assign_1.f03 -Os (test for excess errors)
FAIL: gfortran.dg/shape_7.f90 -O (internal compiler error)
FAIL: gfortran.dg/shape_7.f90 -O (test for excess errors)
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 23b5a2b4439..ca149c0dd00 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -12607,6 +12607,7 @@ resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag)
{
gfc_error ("Array pointer %qs at %L must have a deferred shape or "
"assumed rank", sym->name, &sym->declared_at);
+ sym->error = 1;
return false;
}
}
diff --git a/gcc/fortran/simplify.c b/gcc/fortran/simplify.c
index 66ed925c10d..f5953f801b8 100644
--- a/gcc/fortran/simplify.c
+++ b/gcc/fortran/simplify.c
@@ -4093,6 +4093,10 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr
*kind, int upper)
gfc_array_spec *as;
int d;
+ /* Do not attempt to resolve if error has already been issued. */
+ if (array->symtree && array->symtree->n.sym->error)
+ return NULL;
+
if (array->ts.type == BT_CLASS)
return NULL;