aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/matchexp.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2006-05-15 17:16:26 +0000
committerPaul Thomas <pault@gcc.gnu.org>2006-05-15 17:16:26 +0000
commitb6398823e7ff715272f35ceae58da3d3219523cc (patch)
treefedad2a76662472ff4fb41499498b3e8a81eb3b3 /gcc/fortran/matchexp.c
parenta01456333d6e310a0ba2f46ed1ade2d46a8a789b (diff)
downloadgcc-b6398823e7ff715272f35ceae58da3d3219523cc.zip
gcc-b6398823e7ff715272f35ceae58da3d3219523cc.tar.gz
gcc-b6398823e7ff715272f35ceae58da3d3219523cc.tar.bz2
re PR fortran/25090 (Bad automatic character length)
2006-05-15 Paul Thomas <pault@gcc.gnu.org> PR fortran/25090 * resolve.c: Static resolving_index_expr initialized. (entry_parameter): New function to emit errors for variables that are not entry parameters. (gfc_resolve_expr): Call entry_parameter, when resolving variables, if the namespace has entries and resolving_index_expr is set. (resolve_charlen): Set resolving_index_expr before the call to resolve_index_expr and reset it afterwards. (resolve_fl_variable): The same before and after the call to is_non_constant_shape_array, which ultimately makes a call to gfc_resolve_expr. PR fortran/25082 * resolve.c (resolve_code): Add error condition that the return expression must be scalar. PR fortran/24711 * matchexp.c (gfc_get_parentheses): New function. (match_primary): Remove inline code and call above. * gfortran.h: Provide prototype for gfc_get_parentheses. * resolve.c (resolve_array_ref): Call the above, when start is a derived type variable array reference. 2006-05-15 Paul Thomas <pault@gcc.gnu.org> PR fortran/25090 * gfortran.dg/entry_dummy_ref_1.f90: New test. PR fortran/25082 * gfortran.dg/scalar_return_1.f90: New test. PR fortran/24711 * gfortran.dg/derived_comp_array_ref_1.f90: New test. From-SVN: r113796
Diffstat (limited to 'gcc/fortran/matchexp.c')
-rw-r--r--gcc/fortran/matchexp.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c
index 0082149..b319c24 100644
--- a/gcc/fortran/matchexp.c
+++ b/gcc/fortran/matchexp.c
@@ -123,6 +123,26 @@ next_operator (gfc_intrinsic_op t)
}
+/* Call the INTRINSIC_PARENTHESES function. This is both
+ used explicitly, as below, or by resolve.c to generate
+ temporaries. */
+gfc_expr *
+gfc_get_parentheses (gfc_expr *e)
+{
+ gfc_expr *e2;
+
+ e2 = gfc_get_expr();
+ e2->expr_type = EXPR_OP;
+ e2->ts = e->ts;
+ e2->rank = e->rank;
+ e2->where = e->where;
+ e2->value.op.operator = INTRINSIC_PARENTHESES;
+ e2->value.op.op1 = e;
+ e2->value.op.op2 = NULL;
+ return e2;
+}
+
+
/* Match a primary expression. */
static match
@@ -167,18 +187,7 @@ match_primary (gfc_expr ** result)
if(!gfc_numeric_ts(&e->ts))
*result = e;
else
- {
- gfc_expr *e2 = gfc_get_expr();
-
- e2->expr_type = EXPR_OP;
- e2->ts = e->ts;
- e2->rank = e->rank;
- e2->where = where;
- e2->value.op.operator = INTRINSIC_PARENTHESES;
- e2->value.op.op1 = e;
- e2->value.op.op2 = NULL;
- *result = e2;
- }
+ *result = gfc_get_parentheses (e);
if (m != MATCH_YES)
{