This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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 Steve,

i think it's safe to ignore the fsym->backend_decl if it's null, because, in the case of main, it won't have been processed yet. the gfc_conv_scalar_char_value should still be able to at least modify the expression for the actual arg in this case. i've attached a new patch for trans-expr.c that now generates the following dump for MAIN__ in value_6:

MAIN__ ()
{
  static int4 options.3[7] = {68, 127, 0, 0, 0, 1, 0};

  _gfortran_set_options (7, (void *) &options.3);
  test (97);
}

please give the attached patch a try. i have NOT regtested it, but plan to now. the new patch may conflict with the previous one, so it may be simpler to modify the few lines by hand, or revert the other.

thanks.
Chris

On Thu, 2 Aug 2007, Christopher D. Rickett wrote:

hi Steve,

thanks for looking into this. i'm seeing the same problem. the following is what -fdump-tree-original gives for MAIN__ for value_6:

MAIN__ ()
{
 static int4 options.3[7] = {68, 127, 0, 0, 0, 1, 0};

 _gfortran_set_options (7, (void *) &options.3);
 test ("a", 1);
}

i'll see if i can find a way around this.
Chris

On Thu, 2 Aug 2007, Steve Ellcey wrote:

So I did some investigating into why this patch didn't fix value_6.f03.
It looks like the problem is with the call from main to test.  Main is
still passing 'a' as an array of char instead of just a char.

It looks like gfc_conv_function_call is not calling
gfc_conv_scalar_char_value at the call to test in this test case.
Looking at the if statement protecting that call, I see:

                 if (fsym->ts.type == BT_CHARACTER             /* TRUE */
                     && fsym->backend_decl != NULL             /* FALSE */
                     && fsym->ts.is_c_interop                  /* TRUE */
                     && fsym->ns->proc_name != NULL            /* TRUE */
                     && fsym->ns->proc_name->attr.is_bind_c)   /* TRUE */

So the problem is that fsym->backend_decl is NULL.  I am not sure how
to address this.

Steve Ellcey
sje@cup.hp.com

Attachment: icb_trans-expr.diff
Description: Text document


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