This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ABSTRACT interfaces + PROCEDURE declarations


Hi Janus,

[E-Mail regards PROCEDURE patch only]

Janus Weil wrote:
> ... and here is the updated procedure declaration patch.
Some initial comments:

- ChangeLog is missing

- Test cases are missing


Does not compile here:

/home/tob/projects/gcc/gcc/fortran/resolve.c: In function 'resolve_symbol':
/home/tob/projects/gcc/gcc/fortran/resolve.c:7275: error: ISO C90
forbids mixed declarations and code

That are the lines:
      gfc_formal_arglist *curr_arg1 = sym->formal;
      gfc_formal_arglist *curr_arg2 = sym->interface->formal;
and
      int i=0;

/home/tob/projects/gcc/gcc/fortran/resolve.c: In function 'resolve_symbol':
/home/tob/projects/gcc/gcc/fortran/resolve.c:7277: error: ISO C90
forbids mixed declarations and code


You can place them in the "if" directly after the "{".



Testing:

I get an internal compiler error for PROCEDURE with implicit interfaces:

implicit none
procedure(REAL) :: proc
end

implicit none
procedure() :: proc
end

Both programs are valid Fortran 2003 programs. See e.g. last line of
Note 12.14 of Section 12.3.2.3 and 3rd/4th paragraph after C1218.


The following also fails with Unclassifiable statement:

module mod
  abstract interface
    subroutine sub() bind(c)
    end subroutine sub
    subroutine sub2()
    end subroutine sub2
  end interface
  procedure(sub), private :: a
  procedure(sub2),bind(C) :: a2 ! invalid as sub2 is not bind(C)
required in C1218
  procedure(sub), public, bind(c, name="myB") :: b
  procedure(sub), public, bind(c) :: c, d
  procedure(sub), public, bind(c, name="myEF") :: e, f  ! Invalid per C1218
end module mod


When you implement attributes (INTENT(...), SAVE, POINTER, PRIVATE ...)
allow also for POINTER but give an error stating that procedure pointers
have not been implemented yet. Note: INTENT and SAVE require POINTER.


Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]