diff options
author | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-25 22:07:32 +0000 |
---|---|---|
committer | tobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-25 22:07:32 +0000 |
commit | fa06900405a051b23855e24aa9d2d3b0504c51e9 (patch) | |
tree | 964405ed0e0f03edc6848c42f8c9cc13a1404f4e /gcc/fortran/expr.c | |
parent | 43daa21e7c3b20f510ed5e16e2aef1b806d69d2b (diff) | |
download | ppe42-gcc-fa06900405a051b23855e24aa9d2d3b0504c51e9.tar.gz ppe42-gcc-fa06900405a051b23855e24aa9d2d3b0504c51e9.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86585 138bc75d-0d04-0410-961f-82ee72b054a4
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 99db76d908c..0539b6568ac 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) |