diff options
author | Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de> | 2004-08-26 00:07:32 +0200 |
---|---|---|
committer | Tobias Schlüter <tobi@gcc.gnu.org> | 2004-08-26 00:07:32 +0200 |
commit | 6d1c50cce40910b7015fefa7ce6c632c750bda22 (patch) | |
tree | 964405ed0e0f03edc6848c42f8c9cc13a1404f4e /gcc/fortran/expr.c | |
parent | 4c124b4c6f4e9017f5682cede57bd84c1129da2a (diff) | |
download | gcc-6d1c50cce40910b7015fefa7ce6c632c750bda22.zip gcc-6d1c50cce40910b7015fefa7ce6c632c750bda22.tar.gz gcc-6d1c50cce40910b7015fefa7ce6c632c750bda22.tar.bz2 |
expr.c (gfc_check_assign): Add comment.
fortran/
* expr.c (gfc_check_assign): Add comment. Add new warning.
* trans-expr.c (gfc_conv_function_call): Correctly dereference
result of pointer valued function when not in pointer assignment.
testsuite/
* gfortran.dg/assignment_1.f90: New test.
From-SVN: r86585
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 99db76d..0539b65 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -1797,10 +1797,19 @@ gfc_check_assign (gfc_expr * lvalue, gfc_expr * rvalue, int conform) return FAILURE; } + /* This is a guaranteed segfault and possibly a typo: p = NULL() + instead of p => NULL() */ if (rvalue->expr_type == EXPR_NULL) gfc_warning ("NULL appears on right-hand side in assignment at %L", &rvalue->where); + /* This is possibly a typo: x = f() instead of x => f() */ + if (gfc_option.warn_surprising + && rvalue->expr_type == EXPR_FUNCTION + && rvalue->symtree->n.sym->attr.pointer) + gfc_warning ("POINTER valued function appears on right-hand side of " + "assignment at %L", &rvalue->where); + /* Check size of array assignments. */ if (lvalue->rank != 0 && rvalue->rank != 0 && gfc_check_conformance ("Array assignment", lvalue, rvalue) != SUCCESS) |