http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56261



janus at gcc dot gnu.org changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

             Status|UNCONFIRMED                 |NEW

   Last reconfirmed|                            |2013-02-09

     Ever Confirmed|0                           |1



--- Comment #6 from janus at gcc dot gnu.org 2013-02-09 15:30:13 UTC ---

(In reply to comment #5)

> I sincerely hope that all the test cases in this PR are invalud. One should

> check the standard!



Whew, good luck:



F08, chapter 12.4.2.2:

A procedure other than a statement function shall have an explicit interface if

it is referenced and

(1) a reference to the procedure appears

    (a) with an argument keyword (12.5.2), or

    (b) in a context that requires it to be pure,

(2) the procedure has a dummy argument that

    (a) has the ALLOCATABLE, [...] attribute,

    (b) is an assumed-shape array,

    (c) is a coarray,

    (d) is of a parameterized derived type, or

    (e) is polymorphic,





It seems this is not something that the compiler is required to diagnose

(probably because that can be hard or impossible in certain cases), but the

programmer is responsible for checking this.



For comment 1, we should probably throw a warning (at least), but for comment 4

and 5 there is not much we can do, I guess.



In general I would advise against using procedure pointers without interface

(and EXTERNAL declarations), in particular in OOP code (but also in other

cases, because the compiler cannot do any type checking of the arguments, etc).





In summary: All test cases shown here are invalid, the compiler is not strictly

required to detect this, but we should at least throw a warning where possible

(e.g. comment 0 and 1).

Reply via email to