From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7257 invoked by alias); 16 Jun 2014 16:06:04 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 6995 invoked by uid 48); 16 Jun 2014 16:05:58 -0000 From: "mrestelli at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/61527] New: class/extends, multiple generic assignment, accept invalid Date: Mon, 16 Jun 2014 16:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.10.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mrestelli at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-06/txt/msg01391.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61527 Bug ID: 61527 Summary: class/extends, multiple generic assignment, accept invalid Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mrestelli at gmail dot com Hi, I see that gfortran accepts the following code (even with strict debug flags) which is ambiguous in the resolution of the generic. The code is correctly rejected if disp2 uses CLASS(t2) instead of TYPE(t2), while with TYPE(T2) the code compiles and DISP2 is called, which I think should not be allowed. $ gfortran --version GNU Fortran (GCC) 4.10.0 20140613 (experimental) module m implicit none private public :: t1, t2, disp type :: t1 integer :: i = 1 end type t1 type, extends(t1) :: t2 real :: r = 2.0 end type t2 interface disp module procedure disp1, disp2 end interface contains subroutine disp1(x) class(t1), intent(in) :: x write(*,*) "Disp 1: ",x%i end subroutine disp1 subroutine disp2(x) type(t2), intent(in) :: x ! <- accepted !class(t2), intent(in) :: x ! <- rejected write(*,*) "Disp 2: ",x%r end subroutine disp2 end module m program p use m implicit none type(t1) :: a type(t2) :: b call disp(a) call disp(b) end program p