http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55476
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-11-26
Summary|[4.8 Regression] Bogus |Bogus warning "Pointer
|warning "Pointer might |might outlive the pointer
|outlive the pointer target" |target"
Ever Confirmed|0 |1
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-11-26
22:06:53 UTC ---
Well, the warning is perfectly correct: The pointer *might* outlive the target
- it doesn't say that it has to ;-)
The problem is that:
lvalue->symtree->n.sym->attr.host_assoc
is true.
Draft patch:
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3695,3 +3695,5 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr
*rvalue)
|| 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