diff options
author | Feng Wang <fengwang@nudt.edu.cn> | 2005-07-07 07:54:58 +0000 |
---|---|---|
committer | Feng Wang <fengwang@gcc.gnu.org> | 2005-07-07 07:54:58 +0000 |
commit | d3642f893a731c246c8e7d8e8542abbd238daac6 (patch) | |
tree | 7bfda0a20b79d65d1ac562cb286d5799c84e43db /gcc/fortran/intrinsic.c | |
parent | 378f73afe05d3dbce185f9ab74f0c24e53f4b218 (diff) | |
download | gcc-d3642f893a731c246c8e7d8e8542abbd238daac6.zip gcc-d3642f893a731c246c8e7d8e8542abbd238daac6.tar.gz gcc-d3642f893a731c246c8e7d8e8542abbd238daac6.tar.bz2 |
For the 60th anniversary of Chinese people��s Anti-Japan war victory.
2005-07-07 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/16531
PR fortran/15966
PR fortran/18781
* arith.c (gfc_hollerith2int, gfc_hollerith2real,
gfc_hollerith2complex, gfc_hollerith2character, gfc_hollerith2logical):
New functions.
(eval_intrinsic): Don't evaluate if Hollerith constant arguments exist.
* arith.h (gfc_hollerith2int, gfc_hollerith2real,
gfc_hollerith2complex, gfc_hollerith2character, gfc_hollerith2logical):
Add prototypes.
* expr.c (free_expr0): Free memery allocated for Hollerith constant.
(gfc_copy_expr): Allocate and copy string if Expr is from Hollerith.
(gfc_check_assign): Enable conversion from Hollerith to other.
* gfortran.h (bt): Add BT_HOLLERITH.
(gfc_expr): Add from_H flag.
* intrinsic.c (gfc_type_letter): Return 'h' for BT_HOLLERITH.
(add_conversions): Add conversions from Hollerith constant to other.
(do_simplify): Don't simplify if Hollerith constant arguments exist.
* io.c (resolve_tag): Enable array in FORMAT tag under GFC_STD_GNU.
* misc.c (gfc_basetype_name): Return "HOLLERITH" for BT_HOLLERITH.
(gfc_type_name): Print "HOLLERITH" for BT_HOLLERITH.
* primary.c (match_hollerith_constant): New function.
(gfc_match_literal_constant): Add match Hollerith before Integer.
* simplify.c (gfc_convert_constant): Add conversion from Hollerith
to other.
* trans-const.c (gfc_conv_constant_to_tree): Use VIEW_CONVERT_EXPR to
convert Hollerith constant to tree.
* trans-io.c (gfc_convert_array_to_string): Get array's address and
length to set string expr.
(set_string): Deal with array assigned Hollerith constant and character
array.
* gfortran.texi: Document Hollerith constants as extention support.
2005-07-07 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/16531
PR fortran/15966
PR fortran/18781
* gfortran.dg/hollerith.f90: New.
* gfortran.dg/hollerith2.f90: New.
* gfortran.dg/hollerith3.f90: New.
* gfortran.dg/hollerith4.f90: New.
* gfortran.dg/hollerith_f95.f90: New.
* gfortran.dg/hollerith_legacy.f90: New.
* gfortran.dg/g77/cpp4.F: New. Port from g77.
2005-07-07 Feng Wang <fengwang@nudt.edu.cn>
PR fortran/16531
* io/transfer.c (formatted_transfer): Enable FMT_A on other types to
support Hollerith constants.
From-SVN: r101688
Diffstat (limited to 'gcc/fortran/intrinsic.c')
-rw-r--r-- | gcc/fortran/intrinsic.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 05452c2..67d95df 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -79,6 +79,10 @@ gfc_type_letter (bt type) c = 'c'; break; + case BT_HOLLERITH: + c = 'h'; + break; + default: c = 'u'; break; @@ -2327,6 +2331,31 @@ add_conversions (void) BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_F77); } + if ((gfc_option.allow_std & GFC_STD_LEGACY) != 0) + { + /* Hollerith-Integer conversions. */ + for (i = 0; gfc_integer_kinds[i].kind != 0; i++) + add_conv (BT_HOLLERITH, gfc_default_character_kind, + BT_INTEGER, gfc_integer_kinds[i].kind, GFC_STD_LEGACY); + /* Hollerith-Real conversions. */ + for (i = 0; gfc_real_kinds[i].kind != 0; i++) + add_conv (BT_HOLLERITH, gfc_default_character_kind, + BT_REAL, gfc_real_kinds[i].kind, GFC_STD_LEGACY); + /* Hollerith-Complex conversions. */ + for (i = 0; gfc_real_kinds[i].kind != 0; i++) + add_conv (BT_HOLLERITH, gfc_default_character_kind, + BT_COMPLEX, gfc_real_kinds[i].kind, GFC_STD_LEGACY); + + /* Hollerith-Character conversions. */ + add_conv (BT_HOLLERITH, gfc_default_character_kind, BT_CHARACTER, + gfc_default_character_kind, GFC_STD_LEGACY); + + /* Hollerith-Logical conversions. */ + for (i = 0; gfc_logical_kinds[i].kind != 0; i++) + add_conv (BT_HOLLERITH, gfc_default_character_kind, + BT_LOGICAL, gfc_logical_kinds[i].kind, GFC_STD_LEGACY); + } + /* Real/Complex - Real/Complex conversions. */ for (i = 0; gfc_real_kinds[i].kind != 0; i++) for (j = 0; gfc_real_kinds[j].kind != 0; j++) @@ -2713,6 +2742,16 @@ do_simplify (gfc_intrinsic_sym * specific, gfc_expr * e) gfc_expr *result, *a1, *a2, *a3, *a4, *a5; gfc_actual_arglist *arg; + /* Check the arguments if there are Hollerith constants. We deal with + them at run-time. */ + for (arg = e->value.function.actual; arg != NULL; arg = arg->next) + { + if (arg->expr && arg->expr->from_H) + { + result = NULL; + goto finish; + } + } /* Max and min require special handling due to the variable number of args. */ if (specific->simplify.f1 == gfc_simplify_min) |