> One hard part is avoiding duplicate warnings. Replacing the address with 0 > is a convenient way to do that, so I did it both for my new warning and > for the existing C/C++ ones. The patch breaks > gfortran.dg/warn_target_lifetime_2.f90 because it ends up warning twice. I > didn't touch that front-end because I don't know fortran, and the warning > message "Pointer at .1. in pointer assignment might outlive the pointer > target" doesn't seem very confident that the thing really is broken enough > to be replaced by 0. I only tested (bootstrap+regression) the default > languages, so ada/go may have a similar issue, to be handled if the > approach seems ok.
Ada is designed to make such a thing impossible (although you can work around the design with kludges like 'Unrestricted_Access) so the compiler will stop. -- Eric Botcazou