This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, Fortran] PR54301 - add warning for pointer might outlive its target


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]