[Fortran-Experiments] Merge to r120360
Christopher D. Rickett
crickett@lanl.gov
Wed Feb 21 23:04:00 GMT 2007
>> i didn't think that this was an error. the syntax rule for
>> subroutine-stmt and constraints listed in the annex D didn't specify
>> that the parens are required if you have bind(c) (at least not that i
>> see). do you know of a location where the standard makes the requirement?
> Yes, R1232 in 12.5.2.2; you need to follow the "[ ]":
>
> R1232
> subroutine-stmt is [ prefix ]
> SUBROUTINE subroutine-name
> [ ( [ dummy-arg-list ] ) [ proc-language-binding-spec ] ]
>
> That is: The () are required if "proc-language-binding-spec" is present.
i realized that i looked over the rule you pointed out too fast. my
second response agreed with you and i'll try and get this fixed soon.
>
>
> I found another bunch of small problems:
> -----------------------------------
> module x
> use iso_c_binding
> contains
> function foo() bind(c,name="xx")
> integer(c_int),bind(c,name="xy") :: foo
> ! NAG f95: "BIND(C) for non-variable FOO"
> ! g95: "Duplicate BIND attribute specified"
> ! gfortran: Accepted
> foo = 5_c_int
> end function foo
i should be catching this now, and it is included in my next patch. one
of the things i forgot to do was check in gfc_add_is_bind_c to see if the
is_bind_c was already set. this is now done and reported as an error.
i'll verify that the above code works before submitting the patch.
>
> function test()
> integer(c_int) :: test
> bind(c,name="kk") :: test
> ! NAG f95: "BIND(C) for non-variable TEST"
> ! gfortran, g95: Accepted
> test = 5_c_int
> end function test
i'll look into this. shouldn't test be allowed in the bind(c...)
statement? that seems like it should be ok.
> function bar() bind(c)
> integer(c_int) :: bar
> bind(c,name="zx") :: bar
> bar = 5_c_int
> end function bar
> end module x
> -----------------------------------
>
> foo and test should be clear.
> For "bar", this error is ok:
> Error: Variable 'bar' already declared as bind(c) at (1)
> However, I don't understand the error:
> Error: Unexpected junk in formal argument list at (1)
this seems strange. i'll look into this also. thanks for pointing these
out.
Chris
More information about the Fortran
mailing list