aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorMark Eggleston <markeggleston@gcc.gnu.org>2020-03-23 14:42:20 +0000
committerMark Eggleston <markeggleston@gcc.gnu.org>2020-03-23 14:42:20 +0000
commitb0d84ecc55f3ea86764b119040c5ffde36cd0524 (patch)
tree73d9ff77b120458df6091a1c83710812d515c6ce /gcc/fortran/match.c
parent4897bb0045dd68474176be9aafb4d77bac4b363a (diff)
downloadgcc-b0d84ecc55f3ea86764b119040c5ffde36cd0524.zip
gcc-b0d84ecc55f3ea86764b119040c5ffde36cd0524.tar.gz
gcc-b0d84ecc55f3ea86764b119040c5ffde36cd0524.tar.bz2
fortran: ICE in gfc_match_assignment PR93600
This patch builds on the original patch by Steve Kargl that fixed the ICE and produced an "Unclassifiable statement at (1)" error. The processing of parameter variables now correctly handles zero length arrays used with %kind and %len. A side affect is that "Unclassifiable" error now says "Assignment to constant expression at (1)". It also fixes PR93365. gcc/fortran/ChangeLog: PR fortran/93600 * expr.c (simplify_parameter_variable): Check whether the ref chain contains INQUIRY_LEN or INQUIRY_KIND and set inquiry boolean. When an empty array has been identified and a new new EXPR_ARRAY expression has been created only return that expression if inquiry is not set. This allows the new expression to drop through to be simplified into a EXPR_CONSTANT representing %kind or %len. * match.c (gfc_match_assignment): If lvalue doesn't have a symtree free both lvalue and rvalue expressions and return an error. * resolv.c (gfc_resolve_ref): Ensure that code to handle INQUIRY_LEN is only performed for arrays with deferred types. gcc/testsuite/ChangeLog: PR fortran/93365 PR fortran/93600 * gfortran.dg/pr93365.f90: New test. * gfortran.dg/pr93600_1.f90: New test. * gfortran.dg/pr93600_2.f90: New test.
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 753a5f1..3a0c097 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1373,6 +1373,14 @@ gfc_match_assignment (void)
return m;
}
+ if (!lvalue->symtree)
+ {
+ gfc_free_expr (lvalue);
+ gfc_free_expr (rvalue);
+ return MATCH_ERROR;
+ }
+
+
gfc_set_sym_referenced (lvalue->symtree->n.sym);
new_st.op = EXEC_ASSIGN;