This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR54301 - add warning for pointer might outlive its target
- From: Tobias Burnus <burnus at net-b dot de>
- To: Thomas Koenig <tkoenig at netcologne dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Sun, 19 Aug 2012 21:27:04 +0200
- Subject: Re: [Patch, Fortran] PR54301 - add warning for pointer might outlive its target
- References: <50311112.3060908@net-b.de> <50313C4B.4040801@netcologne.de>
Am 19.08.2012 21:19, schrieb Thomas Koenig:
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
I would exclude pointers on the lhs of the pointer assignment,
I assume you mean RHS â excluding LHS pointers in pointer assignments is
kind of difficult ;-)
RHS pointers are excluded via:
+ if (gfc_option.warn_target_lifetime
+ && rvalue->expr_type == EXPR_VARIABLE
+ && !rvalue->symtree->n.sym->attr.save
+ && !attr.pointer && !rvalue->symtree->n.sym->attr.host_assoc
the attr is set via:
attr = gfc_expr_attr (rvalue);
to make sure that warnings for code such as
are not emitted.
There is no warning with the patch.
Tobias