------- Comment #4 from burnus at gcc dot gnu dot org 2010-05-10 10:05 ------- (In reply to comment #2) > ... should give a runtime error, since fun(0) evaluates to NULL. > > F08 section 16.5.1.6 demands that, if the selector is a pointer, it should be > associated. > In the same way, having an allocatable selector which is not allocated, should > also give a runtime error.
"If the selector has the POINTER attribute, it shall be associated" "If the selector is allocatable, it shall be allocated" Note: Those are not constraints, which the compiler has to diagnose but constraints to the programmer. The compiler might diagnose those, but I think it should not do so by default. Similarly to ptr = 5 where gfortran also does not do any checking. (Some checks are done for -fcheck=pointer, though not for this one.) You can add a check using -fcheck=* but doing a general check I do not like for performance / code-size reasons. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44044