This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Bug fortran/32732] [Bind C] Character scalars are passed as arrays


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]