procedure declaration
Tobias Burnus
burnus@net-b.de
Sun Jun 24 16:10:00 GMT 2007
Hi Janus,
Some remarks which I saw when glancing over the patch can be find below.
Additionally, your patch gives errors when running "make check-gfortran"
(paths relative to gcc/testsuite):
gfortran.dg/alloc_comp_constraint_5.f90
-> Internal Error :gfc_variable_attr(): Bad array reference
gfortran.dg/assumed_size_refs_1.f90
-> Missing upper-bound error for "p => m"
gfortran.dg/auto_char_dummy_array_1.f90
-> Different types in pointer assignment when assigning "NULL()"
FAIL: gfortran.dg/change_symbol_attributes_1.f90 -O (test for excess
errors)
FAIL: gfortran.dg/char_initialiser_actual.f90 -O0 (test for excess errors)
[...]
Janus Weil wrote:
> Index: gcc/fortran/interface.c
> [...]
> +/* Match an F2003 abstract interface. */
>
"a F2003"
> Index: gcc/fortran/symbol.c
> ===================================================================
> + && sym->attr.if_source != IFSRC_DECL
> + && sym->attr.procedure==0)
>
Spacing problems: The second line should have same whitespace as the first.
> +add_formal_arg (gfc_formal_arglist **head,
> + gfc_formal_arglist **tail,
> + gfc_formal_arglist *formal_arg,
> + gfc_symbol *param_sym)
>
I would use:
+add_formal_arg (gfc_formal_arglist **head, gfc_formal_arglist **tail,
+ gfc_formal_arglist *formal_arg, gfc_symbol *param_sym)
which saves some space.
Regarding the test program: Using NAG f95 I get the following errors:
Error: x.f90, line 27: Inappropriate use of symbol PROC1
detected at PROC1@=
Error: x.f90, line 35: Duplicate subprogram name PROC2
detected at FUNCTION@PROC2
Error: x.f90, line 37: Inappropriate use of symbol PROC2
detected at PROC2@=
The task is now not only to fix the test program but also to catch this
problem as well. (The error message can be different).
The following version of the program works here with NAG f95 and g95. In
gfortran it fails with:
print *,proc2(4.0)
Error: Function 'proc2' at (1) has no IMPLICIT type
--------------------------
program test
implicit none
abstract interface
integer function absint(x)
real x
end function absint
end interface
procedure(absint) :: proc1
procedure(fun) :: proc2
print *,proc1(2.0)
print *,fun(3.0)
print *,proc2(4.0)
contains
real function fun(a)
real a
fun=a*a
end function fun
end program
integer function proc1(x)
real x
proc1 = 2*int(x)
end function proc1
real function proc2(a)
real a
proc2=2*a*a
end function proc2
--------------------------
Tobias
More information about the Fortran
mailing list