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

Tobias Burnus burnus@net-b.de
Sun Aug 19 19:27:00 GMT 2012


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



More information about the Fortran mailing list