This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR34079 - BIND(C) and characters - unneeded character length passed
- From: Tobias Burnus <burnus at net-b dot de>
- To: FX Coudert <fxcoudert at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>, "Christopher D. Rickett" <crickett at lanl dot gov>
- Date: Sat, 17 Nov 2007 09:01:55 +0100
- Subject: Re: [Patch, Fortran] PR34079 - BIND(C) and characters - unneeded character length passed
- References: <473C608B.9000202@net-b.de> <E83F445C-36C8-4363-BBE0-E5621426263E@gmail.com>
Hi FX,
FX Coudert wrote:
> subroutine foo(x) bind(c)
> character(len=1) :: x
> function bar(x) bind(c)
> character(len=1) :: x, bar
>
> foo (x, _x) /* there shouldn't be a _x here */
>
> bar (__result, .__result, x, _x) /* there should be neither _x nor
> .__result here */
I thought we fixed this before!
The prototype should be
void foo(char *x)
and
char bar(char *x)
Thus for bar we should return the character variable and not create a
result variable. For non-character variables, we do it correctly.
Tobias