diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-01-29 06:08:07 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-01-29 06:08:07 +0000 |
commit | 2990f854e5290b9b23b6f6aeea977d958d80eb58 (patch) | |
tree | c493858c5802a7c1b40e9a3197f20794ee88cc60 /gcc/fortran/expr.c | |
parent | 21c4a6a73277ef6fec1ad1940109aaa1144a0fee (diff) | |
download | gcc-2990f854e5290b9b23b6f6aeea977d958d80eb58.zip gcc-2990f854e5290b9b23b6f6aeea977d958d80eb58.tar.gz gcc-2990f854e5290b9b23b6f6aeea977d958d80eb58.tar.bz2 |
[multiple changes]
2006-01-28 Paul Thomas <pault@gcc.gnu.org>
PR fortran/17911
* expr.c (gfc_check_assign, gfc_check_pointer_assign): Emit error if
the lvalue is a use associated procedure.
PR fortran/20895
PR fortran/25030
* expr.c (gfc_check_pointer_assign): Emit error if lvalue and rvalue
character lengths are not the same. Use gfc_dep_compare_expr for the
comparison.
* gfortran.h: Add prototype for gfc_dep_compare_expr.
* dependency.h: Remove prototype for gfc_dep_compare_expr.
2006-01-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/17911
* gfortran.dg/procedure_lvalue.f90: New test.
PR fortran/20895
PR fortran/25030
* gfortran.dg/char_pointer_assign_2.f90: New test.
* gfortran.dg/char_result_1.f90: Correct unequal charlen pointer
assignment to be consistent with standard.
* gfortran.dg/char_result_2.f90: The same.
* gfortran.dg/char_result_8.f90: The same.
From-SVN: r110365
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 11bf277..0e699c2 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1859,6 +1859,14 @@ gfc_check_assign (gfc_expr * lvalue, gfc_expr * rvalue, int conform) return FAILURE; } + if (sym->attr.flavor == FL_PROCEDURE && sym->attr.use_assoc) + { + gfc_error ("'%s' in the assignment at %L cannot be an l-value " + "since it is a procedure", sym->name, &lvalue->where); + return FAILURE; + } + + if (rvalue->rank != 0 && lvalue->rank != rvalue->rank) { gfc_error ("Incompatible ranks %d and %d in assignment at %L", @@ -1944,6 +1952,15 @@ gfc_check_pointer_assign (gfc_expr * lvalue, gfc_expr * rvalue) return FAILURE; } + if (lvalue->symtree->n.sym->attr.flavor == FL_PROCEDURE + && lvalue->symtree->n.sym->attr.use_assoc) + { + gfc_error ("'%s' in the pointer assignment at %L cannot be an " + "l-value since it is a procedure", + lvalue->symtree->n.sym->name, &lvalue->where); + return FAILURE; + } + attr = gfc_variable_attr (lvalue, NULL); if (!attr.pointer) { @@ -1980,6 +1997,16 @@ gfc_check_pointer_assign (gfc_expr * lvalue, gfc_expr * rvalue) return FAILURE; } + if (lvalue->ts.type == BT_CHARACTER + && lvalue->ts.cl->length && rvalue->ts.cl->length + && abs (gfc_dep_compare_expr (lvalue->ts.cl->length, + rvalue->ts.cl->length)) == 1) + { + gfc_error ("Different character lengths in pointer " + "assignment at %L", &lvalue->where); + return FAILURE; + } + attr = gfc_expr_attr (rvalue); if (!attr.target && !attr.pointer) { |