[Patch, Fortran] PR54301 - add warning for pointer might outlive its target
Tobias Burnus
burnus@net-b.de
Sun Aug 19 16:15:00 GMT 2012
As suggested in the draft Fortran appendix to ISO/IEC Technical Report
24772 "Guidance for Avoiding Vulnerabilities through Language Selection
and Use"*
"Future standardization efforts should consider:"
...
"* Requiring that processors have the ability to detect and report the
occurrence within a submitted program unit of pointer assignment of
a pointer whose lifetime is known to be longer than the lifetime of the
target."
The new flag -Wtarget-lifetime implements this; it is enabled by -Wall.
(Well, at least kind of; the suggested requirement is only implementable
by a complicated run-time check. However, the attached compile-time
warning is a good approximation, which should help to find real bugs
with only few false positives.)
Build and regtested on x86-64-gnu-linux.
OK for the trunk?
Tobias
* See
http://gcc.gnu.org/wiki/GFortranStandards#ISO.2BAC8-IEC_Project_22.24772:_Guidance_for_Avoiding_Vulnerabilities_through_Language_Selection_and_Use
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer-outlive.diff
Type: text/x-patch
Size: 6594 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20120819/64e4bdd4/attachment.bin>
More information about the Fortran
mailing list