[PATCH, fortran] character length (PR fortran/21730)
Feng Wang
wf_cs@yahoo.com
Thu Jul 14 03:00:00 GMT 2005
--- 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
More information about the Fortran
mailing list