diff mbox series

ICE on wrong code [PR94192]

Message ID 637338bf-e3b4-764e-9f4c-f230585be820@sig-st.de
State New
Headers show
Series ICE on wrong code [PR94192] | expand

Commit Message

Linus König April 11, 2020, 2:27 p.m. UTC
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)

Comments

Fritz Reese April 13, 2020, 5:41 p.m. UTC | #1
On Sat, Apr 11, 2020 at 10:27 AM Linus König <link@sig-st.de> wrote:
>
> 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 .

Thanks. Sorry I missed the ChangeLog entry and tests in my previous
email. Those look good.


> The list of test cases that fail without the remaining NULL
> check is below. Is this OK for trunk?

Thank you for the test listing.

I apologize for being pedantic, but the remaining NULL check is still
superfluous. The check can be removed simply by moving the new code
past the BT_CLASS and EXPR_VARIABLE checks, just before the loop, like
in my previous diffs. The idea is that when array->expr_type is
EXPR_VARIABLE, array->symtree is guaranteed not to be NULL. If this
invariant was violated, there are at least five functions in
simplify.c alone which would segfault, including simplify_bound, even
with this patch. Therefore I prefer not to check array->symtree for
NULL before the EXPR_VARIABLE test.

With that change I will OK the patch. If you and the regression tests
concur, I can commit for you. I believe this is appropriate for
backporting to 8 and 9 as well. Thanks again for your work.

---
Fritz
diff mbox series

Patch

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;