diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-08 13:41:08 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-08 13:41:08 +0000 |
commit | 38d7dddbb4d5cb4ba6a0cf4a8998b8ea2e5820a6 (patch) | |
tree | 88335b706b5071f059bdce822601ba05626dffcf /gcc/fortran/expr.c | |
parent | 31cc05e3151dbdb82ad322b5a2fc3911b11cf016 (diff) | |
download | ppe42-gcc-38d7dddbb4d5cb4ba6a0cf4a8998b8ea2e5820a6.tar.gz ppe42-gcc-38d7dddbb4d5cb4ba6a0cf4a8998b8ea2e5820a6.zip |
fortran/
* expr.c (gfc_copy_expr): Don't copy 'op1' and 'op2' for
EXPR_SUBSTRING.
(gfc_is_constant_expr): Check 'ref' to determine if substring
reference is constant.
(gfc_simplify_expr): Simplify 'ref' instead of 'op1' and 'op2'.
(check_init_expr, check_restricted): Check 'ref' instead of 'op1'
and 'op2'.
* module.c (mio_expr): Read / write 'ref' instead of 'op1' and 'op2'.
testsuite/
* gfortran.dg/substr_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94735 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 87ce3e5fcbc..3898f7afd63 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -393,9 +393,6 @@ gfc_copy_expr (gfc_expr * p) q->value.character.string = s; memcpy (s, p->value.character.string, p->value.character.length + 1); - - q->op1 = gfc_copy_expr (p->op1); - q->op2 = gfc_copy_expr (p->op2); break; case EXPR_CONSTANT: @@ -699,7 +696,8 @@ gfc_is_constant_expr (gfc_expr * e) break; case EXPR_SUBSTRING: - rv = gfc_is_constant_expr (e->op1) && gfc_is_constant_expr (e->op2); + rv = (gfc_is_constant_expr (e->ref->u.ss.start) + && gfc_is_constant_expr (e->ref->u.ss.end)); break; case EXPR_STRUCTURE: @@ -1115,12 +1113,10 @@ gfc_simplify_expr (gfc_expr * p, int type) break; case EXPR_SUBSTRING: - if (gfc_simplify_expr (p->op1, type) == FAILURE - || gfc_simplify_expr (p->op2, type) == FAILURE) + if (simplify_ref_chain (p->ref, type) == FAILURE) return FAILURE; /* TODO: evaluate constant substrings. */ - break; case EXPR_OP: @@ -1439,11 +1435,11 @@ check_init_expr (gfc_expr * e) break; case EXPR_SUBSTRING: - t = check_init_expr (e->op1); + t = check_init_expr (e->ref->u.ss.start); if (t == FAILURE) break; - t = check_init_expr (e->op2); + t = check_init_expr (e->ref->u.ss.end); if (t == SUCCESS) t = gfc_simplify_expr (e, 0); @@ -1662,11 +1658,11 @@ check_restricted (gfc_expr * e) break; case EXPR_SUBSTRING: - t = gfc_specification_expr (e->op1); + t = gfc_specification_expr (e->ref->u.ss.start); if (t == FAILURE) break; - t = gfc_specification_expr (e->op2); + t = gfc_specification_expr (e->ref->u.ss.end); if (t == SUCCESS) t = gfc_simplify_expr (e, 0); |