This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44044] [OOP] SELECT TYPE with class-valued function
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2010 10:05:52 -0000
- Subject: [Bug fortran/44044] [OOP] SELECT TYPE with class-valued function
- References: <bug-44044-16146@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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