[Bug fortran/107266] Reject kind=4 characters for BIND(C) – it invalid and generates wrong code
sgk at troutmask dot apl.washington.edu
gcc-bugzilla@gcc.gnu.org
Tue Oct 18 22:43:04 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107266
--- Comment #12 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Oct 18, 2022 at 05:29:58PM +0000, sgk at troutmask dot
apl.washington.edu wrote:
>
> % gfcx -c -std=f2018 a.f90
> a.f90:1:30:
>
> 1 | character(kind=4) function bar(x, y, z) bind(C)
> | 1
> Error: GNU Extension: Symbol 'bar' at (1) with type CHARACTER(KIND=4) cannot
> have the BIND(C) attribute
>
> The patch checks a *function* result variable for an interoperable
> CHARACTER kind.
>
BTW, Fortran standard contains
C1553 If proc-language-binding-spec is specified for a function,
the function result shall be an interoperable scalar variable.
So, accepting "character(kind=4) foo() bind(c)" is questionable
(unless kind=4 is C_CHAR, which it isn't).
More information about the Gcc-bugs
mailing list