* Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
[not found] ` <Pine.LNX.4.64.0708031352400.14774@lennox.lanl.gov>
@ 2007-08-03 21:04 ` FX Coudert
2007-08-03 21:15 ` Christopher D. Rickett
0 siblings, 1 reply; 4+ messages in thread
From: FX Coudert @ 2007-08-03 21:04 UTC (permalink / raw)
To: Christopher D. Rickett
Cc: Steve Ellcey, Tobias Burnus, Fortran List, GCC-patches list
Hi Christopher,
> 2007-08-03 Christopher D. Rickett <crickett@lanl.gov>
>
> PR fortran/32732
> * trans-expr.c (gfc_conv_scalar_char_value): Convert the tree and
> actual arg expressions for scalar characters passed by-value to
> bind(c) routines.
> (gfc_conv_function_call): Call gfc_conv_scalar_char_value.
> * trans.h: Add prototype for gfc_conv_scalar_char_value.
> * trans-decl.c (generate_local_decl): Convert by-value character
> dummy args of bind(c) procedures using
> gfc_conv_scalar_char_value.
I'm willing to review that one, but I must confess that I got
completely lost at some point of this huge thread on the mailing-
list. Perhaps you could give us a short two-sentences explaining
again (sorry) the reason behind the patch; this could even end up as
comments in the code, for future reference (this business appears to
be tricky, I'm sure it will resurface at some later point in the
compiler's very long life!).
PS: I believe you forgot to CC the gcc-patches list in your initial
submission
Thanks in advance,
FX
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
2007-08-03 21:04 ` [Bug fortran/32732] [Bind C] Character scalars are passed as arrays FX Coudert
@ 2007-08-03 21:15 ` Christopher D. Rickett
2007-08-03 21:24 ` Steve Kargl
0 siblings, 1 reply; 4+ messages in thread
From: Christopher D. Rickett @ 2007-08-03 21:15 UTC (permalink / raw)
To: FX Coudert; +Cc: Steve Ellcey, Tobias Burnus, Fortran List, GCC-patches list
hi FX,
i did forget to CC the gcc-patches list. thanks for forwarding it.
the problem this patch addresses is the way character args are passed
by-value to a bind(c) procedure. in non-bind(c), character scalars of any
length are passed as an array type, which means an address. this doesn't
work for bind(c) procedures with a character dummy (of len 1) if it's
called by a C routine. C will promote char to an integer type node for
passing it as a parameter. therefore, bind(c) procedures needed to change
both the expected type of any by-value character dummies, and the type of
the expression for the actual. i realize that i forgot to put a comment
block at the top of gfc_conv_scalar_char_value; that should be done as i'm
sure this issue will resurface.
does that help? also, i think Steve Kargl was willing/planning to review
the patch, so you may need to check with him.
thanks.
Chris
On Fri, 3 Aug 2007, FX Coudert wrote:
> Hi Christopher,
>
>> 2007-08-03 Christopher D. Rickett <crickett@lanl.gov>
>>
>> PR fortran/32732
>> * trans-expr.c (gfc_conv_scalar_char_value): Convert the tree and
>> actual arg expressions for scalar characters passed by-value to
>> bind(c) routines.
>> (gfc_conv_function_call): Call gfc_conv_scalar_char_value.
>> * trans.h: Add prototype for gfc_conv_scalar_char_value.
>> * trans-decl.c (generate_local_decl): Convert by-value character
>> dummy args of bind(c) procedures using
>> gfc_conv_scalar_char_value.
>
> I'm willing to review that one, but I must confess that I got completely lost
> at some point of this huge thread on the mailing-list. Perhaps you could give
> us a short two-sentences explaining again (sorry) the reason behind the
> patch; this could even end up as comments in the code, for future reference
> (this business appears to be tricky, I'm sure it will resurface at some later
> point in the compiler's very long life!).
>
> PS: I believe you forgot to CC the gcc-patches list in your initial
> submission
>
> Thanks in advance,
> FX
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
2007-08-03 21:15 ` Christopher D. Rickett
@ 2007-08-03 21:24 ` Steve Kargl
2007-08-03 21:30 ` FX Coudert
0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2007-08-03 21:24 UTC (permalink / raw)
To: Christopher D. Rickett
Cc: FX Coudert, Steve Ellcey, Tobias Burnus, Fortran List, GCC-patches list
On Fri, Aug 03, 2007 at 03:15:25PM -0600, Christopher D. Rickett wrote:
>
> the problem this patch addresses is the way character args are passed
> by-value to a bind(c) procedure. in non-bind(c), character scalars of any
> length are passed as an array type, which means an address. this doesn't
> work for bind(c) procedures with a character dummy (of len 1) if it's
> called by a C routine. C will promote char to an integer type node for
> passing it as a parameter. therefore, bind(c) procedures needed to change
> both the expected type of any by-value character dummies, and the type of
> the expression for the actual. i realize that i forgot to put a comment
> block at the top of gfc_conv_scalar_char_value; that should be done as i'm
> sure this issue will resurface.
>
> does that help? also, i think Steve Kargl was willing/planning to review
> the patch, so you may need to check with him.
>
I've been following the iterations between you and Steve E., I'm
somewhat familiar with the testing that's been done. I can deal
with this patch sometime tomorrow, so if FX beats me to a review
and commit I won't be upset.
--
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays
2007-08-03 21:24 ` Steve Kargl
@ 2007-08-03 21:30 ` FX Coudert
0 siblings, 0 replies; 4+ messages in thread
From: FX Coudert @ 2007-08-03 21:30 UTC (permalink / raw)
To: Steve Kargl; +Cc: Fortran List, GCC-patches list
> I can deal
> with this patch sometime tomorrow, so if FX beats me to a review
> and commit I won't be upset.
It's actually better if you review it since you followed the thread;
I think I'll manage to find something for me to do in our bug
database :)
FX
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-08-03 21:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <200708031554.IAA04995@hpsje.cup.hp.com>
[not found] ` <Pine.LNX.4.64.0708031053170.14774@lennox.lanl.gov>
[not found] ` <Pine.LNX.4.64.0708031352400.14774@lennox.lanl.gov>
2007-08-03 21:04 ` [Bug fortran/32732] [Bind C] Character scalars are passed as arrays FX Coudert
2007-08-03 21:15 ` Christopher D. Rickett
2007-08-03 21:24 ` Steve Kargl
2007-08-03 21:30 ` FX Coudert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).