This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
- From: Steve Ellcey <sje at cup dot hp dot com>
- To: crickett at lanl dot gov
- Cc: burnus at net-b dot de, fortran at gcc dot gnu dot org
- Date: Mon, 30 Jul 2007 15:49:47 -0700 (PDT)
- Subject: Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
> thanks for trying it out. i'm quite at a loss now as to why it's failing;
> i thought that fixing the array_type still being seen in
> gfc_conv_function_call would do it. now i'm not even sure where to start
> looking... the only thing i could think to do now is to run cc1 through
> gdb and figure out what the C frontend is doing with characters that isn't
> happening on the fortran side. it would be good to see the debug_tree
> output for the tree created by cc1, but that would be a bit more work for
> you. i'll see if i can figure out where to put the call to debug_tree and
> maybe pass it on to you.
>
> thanks again for all of the help.
> Chris
I wonder if we have to do more than change the type. If I understand
the code correctly we have converted the type of the formal parameter in
the call from an array of char to just a char. But the actual argument
to the call (the variable or constant being passed) is still an array of
char. Do we need code to change the actual argument so we wind up
passing "array[1]" instead of "array", i.e. to pass in just the first
element of the array instead of the entire array.
In C, if I have
char s[10];
call foo(s);
That is different then
char s[10];
call foo(s[0]);
Regardless of what prototype foo has and what type we claim the argument
to foo is.
Steve Ellcey
sje@cup.hp.com