Bug 37222

Summary: [OOP] Checks when overriding type-bound procedures are incomplete
Product: gcc Reporter: Daniel Kraft <domob>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: burnus, gcc-bugs, janus
Priority: P3 Keywords: accepts-invalid
Version: unknown   
Target Milestone: ---   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2009-03-29 08:52:59

Description Daniel Kraft 2008-08-24 17:00:59 UTC
In 4.5.6.2 of the draft F2003 standard ("Type-bound procedure overriding") a list of conditions is given that an overriding type-bound procedure must satisfy; the checks that function result characteristics and characteristics of corresponding dummy arguments are the same are incomplete in the current implementation.  This corresponds to two FIXME's in resolve.c / check_typebound_overrid.

At the moment, only gfc_compare_types is called; among the items that fail to be checked are rank, array shape (if known), ALLOCATABLE/POINTER attributes and INTENT declarations.
Comment 1 janus 2011-09-10 15:02:33 UTC
(In reply to comment #0)
> At the moment, only gfc_compare_types is called; among the items that fail to
> be checked are rank, array shape (if known), ALLOCATABLE/POINTER attributes and
> INTENT declarations.

There are a few related PRs:
 * for the INTENT check there is PR47978
 * PR35831 concerns the shape check (originally for dummy procedure arguments, but it applies to TBP overriding in the same way)

This PR can be used to track some of the missing checks:
 * ALLOCATABLE/POINTER
 * string length
 * ...
Comment 2 janus 2011-09-11 20:43:13 UTC
(In reply to comment #1)
> This PR can be used to track some of the missing checks:
>  * ALLOCATABLE/POINTER
>  * string length
>  * ...

http://gcc.gnu.org/viewcvs?view=revision&revision=178767 fixes already most of this, but there are at least three FIXMEs left in 'check_dummy_characteristics'.
Comment 3 janus 2013-12-10 21:56:48 UTC
Basically all the checks in this area have been fixed by now.

One of the last todo items is a carry-over from PR 35831:
* improve gfc_dep_compare_expr to catch more cases (and/or enable the warnings in check_result_characteristics and check_dummy_characteristics, marked by FIXMEs)
Comment 4 Jürgen Reuter 2019-01-22 09:29:02 UTC
As Janus commented there is just one left-over (already fixed in the past six years?). So what is really left to do here?
Comment 5 janus 2019-01-22 09:41:52 UTC
(In reply to Jürgen Reuter from comment #4)
> As Janus commented there is just one left-over (already fixed in the past
> six years?). So what is really left to do here?

I don't think the left-over is actually fixed (at least the FIXME notes are still present in interface.c).

In any case, further improvement in this area is rather hard and yields only little gain, so I think it's reasonable to close this ten-year-old PR that presents no concrete test case (after all, the FIXMEs are still there for future reference).