diff options
author | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 22:20:44 +0000 |
---|---|---|
committer | burnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-11-27 22:20:44 +0000 |
commit | d115204161af3b52f016d207d9bc80c3e40500f1 (patch) | |
tree | b89e89d0758864c6437f331fd445a29614b32b29 /gcc | |
parent | 3729285ef1b5ea9ef42c953b904b41fb5ae0033e (diff) | |
download | gcc-d115204161af3b52f016d207d9bc80c3e40500f1.tar.gz |
2012-11-27 Tobias Burnus <burnus@net-b.de>
PR fortran/55476
* expr.c (gfc_check_pointer_assign): Fix check
pointer-might-outlive-target check for host_assoc.
2012-11-27 Tobias Burnus <burnus@net-b.de>
PR fortran/55476
* gfortran.dg/warn_target_lifetime_3.f90: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@193872 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/expr.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 | 29 |
4 files changed, 43 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2aa8d60e1f1..bc8d0d8d445 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2012-11-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/55476 + * expr.c (gfc_check_pointer_assign): Fix check + pointer-might-outlive-target check for host_assoc. + 2012-11-26 Eric Botcazou <ebotcazou@adacore.com> * trans-decl.c (gfc_finish_var_decl): Do not set DECL_RESTRICTED_P. diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 211f304164c..15570afb6ee 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3693,7 +3693,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue) warn = lvalue->symtree->n.sym->attr.dummy || lvalue->symtree->n.sym->attr.result || lvalue->symtree->n.sym->attr.function - || lvalue->symtree->n.sym->attr.host_assoc + || (lvalue->symtree->n.sym->attr.host_assoc + && lvalue->symtree->n.sym->ns + != rvalue->symtree->n.sym->ns) || lvalue->symtree->n.sym->attr.use_assoc || lvalue->symtree->n.sym->attr.in_common; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e065504c0f9..2d8350b2026 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-11-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/55476 + * gfortran.dg/warn_target_lifetime_3.f90: New. + 2012-11-27 Vladimir Makarov <vmakarov@redhat.com> PR rtl-optimization/55458 diff --git a/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 b/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 new file mode 100644 index 00000000000..9113a885fa6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 @@ -0,0 +1,29 @@ +! { dg-do compile } +! { dg-options "-Wall" } +! +! PR fortran/55476 +! +! Contribued by Janus Weil +! +subroutine test + integer, pointer :: p + integer, target :: t + p => t +contains + subroutine sub() + if (p /= 0) return + end subroutine +end subroutine + +module m + integer, pointer :: p2 +contains + subroutine test + integer, target :: t2 + p2 => t2 ! { dg-warning "Pointer at .1. in pointer assignment might outlive the pointer target" } + contains + subroutine sub() + if (p2 /= 0) return + end subroutine + end subroutine +end module m |