This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/46182] Run time check for invalid use of unallocated allocatable variables
- From: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 26 Oct 2010 14:06:57 +0000
- Subject: [Bug libfortran/46182] Run time check for invalid use of unallocated allocatable variables
- Auto-submitted: auto-generated
- References: <bug-46182-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46182
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2010-10-26 14:06:55 UTC ---
Forwarded from http://gcc.gnu.org/ml/gcc-bugs/2010-10/msg02167.html
> > It would be nice to have a run time check for such invalid use of
> > unallocated allocatable variables (such as -fcheck=use_unalloc).
> If you use an unallocated variable you get a segmentation fault.
> Isn't this a sufficient runtime check ?
Well! You can say the same thing for -fcheck=bounds if writing outside array
bounds gives you a segmentation fault! Nevertheless nobody will argue that this
check is useless: it can save you hours of debugging to locate the line(s) in
which you do it.
Segmentation faults tell you that there is something wrong, but not why and/or
where (not counting gfortran bugs). It took me some time to understand it for a
less than 20 line code in which I had the bad idea of using a copy and paste
from a valid line to an invalid one (this can happen to anybody with kloc!-)