diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 61f4a20b5fb930726c877b35ba1b7b4a5b23cdbd..56a0ed94b1122e3e96b8f9a2c5b7ca846c7193c1 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-28  Janus Weil  <janus@gcc.gnu.org>
+
+	PR fortran/81770
+	* expr.c (gfc_check_pointer_assign): Improve the check whether pointer
+	may outlive pointer target.
+
 2017-08-27  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
 	PR fortran/81974
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 64af02cc29b9e1b630468a7d4e12cf2b8a0c350b..5a101a8e3431802075b9b530dd78cb2c0bfe87e7 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3806,7 +3806,8 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
   if (warn_target_lifetime
       && rvalue->expr_type == EXPR_VARIABLE
       && !rvalue->symtree->n.sym->attr.save
-      && !attr.pointer && !rvalue->symtree->n.sym->attr.host_assoc
+      && !rvalue->symtree->n.sym->attr.pointer && !attr.pointer
+      && !rvalue->symtree->n.sym->attr.host_assoc
       && !rvalue->symtree->n.sym->attr.in_common
       && !rvalue->symtree->n.sym->attr.use_assoc
       && !rvalue->symtree->n.sym->attr.dummy)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 01b801feba1250b5e641fe471f6d754f26cc1b20..cfe90904f6d649e00b3c521243bb3cdc65ec16ae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2017-08-28  Janus Weil  <janus@gcc.gnu.org>
+
+	PR fortran/81770
+	* gfortran.dg/warn_target_lifetime_3.f90: Fix a typo.
+	* gfortran.dg/warn_target_lifetime_4.f90: New testcase.
+
 2017-08-28  Steve Ellcey  <sellcey@cavium.com>
 
 	* gfortran.dg/dec_init_1.f90 (dummy): Use ichar in print statement.
diff --git a/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90 b/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
index 6c8ea5b945834126a88b46704b2f3729ad6c1869..0ef1e2d19c7db754c8fcf446c90632951133de0c 100644
--- a/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
+++ b/gcc/testsuite/gfortran.dg/warn_target_lifetime_3.f90
@@ -3,7 +3,7 @@
 !
 ! PR fortran/55476
 !
-! Contribued by  Janus Weil
+! Contributed by Janus Weil
 !
 subroutine test
   integer, pointer :: p
diff --git a/gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90 b/gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90
new file mode 100644
index 0000000000000000000000000000000000000000..d2972a922836a79519c62086bbd0a3cb03c44f3b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/warn_target_lifetime_4.f90
@@ -0,0 +1,28 @@
+! { dg-do compile }
+! { dg-options "-Wtarget-lifetime" }
+!
+! PR fortran/81770: [5/6/7 Regression] Bogus warning: Pointer in pointer assignment might outlive the pointer target
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+module m
+
+   type t
+      integer, allocatable :: l
+   end type
+
+contains
+
+   subroutine sub(c_in, list)
+      type(t), target, intent(in)  :: c_in
+      integer, pointer, intent(out) :: list
+
+      type(t), pointer :: container
+
+      container => c_in
+
+      list => container%l
+
+   end subroutine
+
+end