This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
re: [PATCH, fortran] character length (PR fortran/21730)
- From: Feng Wang <wf_cs at yahoo dot com>
- To: David Edelsohn <dje at watson dot ibm dot com>, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 Jul 2005 11:00:19 +0800 (CST)
- Subject: re: [PATCH, fortran] character length (PR fortran/21730)
--- David Edelsohn <dje@watson.ibm.com>写道:
> Gfortran currently assigns an initializer to a symbol if the two
> are conforming, but character initializers are not truncated or padded to
> match a fixed character length target. This patch calls
> gfc_set_constant_character_len() to adjust the initializer so that it
> conforms to the target character length.
>
> Bootstrapped. Okay if no regressions?
>
> Thanks, David
>
>
> PR fortran/21730
> * decl.c (do_parm): Adjust character initializer to character length
> of symbol before assigning.
>
> Index: decl.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/fortran/decl.c,v
> retrieving revision 1.37
> diff -c -p -r1.37 decl.c
> *** decl.c 6 Jul 2005 22:12:12 -0000 1.37
> --- decl.c 13 Jul 2005 17:35:16 -0000
> *************** do_parm (void)
> *** 3101,3106 ****
> --- 3101,3116 ----
> goto cleanup;
> }
>
> + if (sym->ts.type == BT_CHARACTER
> + && sym->ts.cl != NULL
> + && sym->ts.cl->length != NULL
> + && sym->ts.cl->length->expr_type == EXPR_CONSTANT
> + && init->expr_type == EXPR_CONSTANT
> + && init->ts.type == BT_CHARACTER
> + && init->ts.kind == 1)
> + gfc_set_constant_character_len (
> + mpz_get_si (sym->ts.cl->length->value.integer), init);
> +
> sym->value = init;
> return MATCH_YES;
>
Yes, right spot. But I think character arrays should also be handled. See
PR21730 comment.
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
___________________________________________________________
雅虎邮箱超强增值服务-2G超大空间、pop3收信、无限量邮件提醒
http://cn.mail.yahoo.com/mail_alert/promo1.html