re PR fortran/33917 (Rejects valid PROCEDURE declarations)

2007-11-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33917
        * interface.c (check_sym_interfaces): Disallow PROCEDURE-declared
        procedures for MODULE PROCEDURE.
        * decl.c (match_procedure_in_interface): Do not mark as procedure.

2007-11-08  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33917
        * gfortran.dg/proc_decl_5.f90: New.
        * gfortran.dg/proc_decl_6.f90: New.

From-SVN: r130002
This commit is contained in:
Tobias Burnus 2007-11-08 16:28:30 +01:00 committed by Tobias Burnus
parent ce796131e1
commit abf86978b3
6 changed files with 61 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2007-11-08 Tobias Burnus <burnus@net-b.de>
PR fortran/33917
* interface.c (check_sym_interfaces): Disallow PROCEDURE-declared
procedures for MODULE PROCEDURE.
* decl.c (match_procedure_in_interface): Do not mark as procedure.
2007-11-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/33881

View File

@ -4091,8 +4091,6 @@ match_procedure_in_interface (void)
if (gfc_add_interface (sym) == FAILURE)
return MATCH_ERROR;
sym->attr.procedure = 1;
if (gfc_match_eos () == MATCH_YES)
break;
if (gfc_match_char (',') != MATCH_YES)

View File

@ -1137,7 +1137,9 @@ check_sym_interfaces (gfc_symbol *sym)
for (p = sym->generic; p; p = p->next)
{
if (p->sym->attr.mod_proc && p->sym->attr.if_source != IFSRC_DECL)
if (p->sym->attr.mod_proc
&& (p->sym->attr.if_source != IFSRC_DECL
|| p->sym->attr.procedure))
{
gfc_error ("'%s' at %L is not a module procedure",
p->sym->name, &p->where);

View File

@ -1,3 +1,9 @@
2007-11-08 Tobias Burnus <burnus@net-b.de>
PR fortran/33917
* gfortran.dg/proc_decl_5.f90: New.
* gfortran.dg/proc_decl_6.f90: New.
2007-11-08 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/32575

View File

@ -0,0 +1,28 @@
! { dg-do run }
! PR fortran/33945
!
! PROCEDURE in the interface was wrongly rejected
module modproc
implicit none
interface bar
procedure x
end interface bar
procedure(sub) :: x
interface
integer function sub()
end function sub
end interface
end module modproc
integer function x()
implicit none
x = -5
end function x
program test
use modproc
implicit none
if(x() /= -5) call abort()
end program test
! { dg-final { cleanup-modules "modproc" } }

View File

@ -0,0 +1,17 @@
! { dg-do compile }
! PR fortran/33945
!
! MODULE PROCEDURE in the interface was wrongly accepted
module modproc2
implicit none
interface
subroutine x
end subroutine x
end interface
procedure(x) :: y
interface bar
module procedure y ! { dg-error "not a module procedure" }
end interface bar
end module modproc2
end