diff options
author | fengwang <fengwang@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-07 07:54:58 +0000 |
---|---|---|
committer | fengwang <fengwang@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-07-07 07:54:58 +0000 |
commit | 169f9d09e5d61b72aebc64c5a6632bc376ba2081 (patch) | |
tree | 7bfda0a20b79d65d1ac562cb286d5799c84e43db /gcc/testsuite/gfortran.dg/hollerith_legacy.f90 | |
parent | bbe50a5a148bb7e80ca9447e91950e7be867ea9f (diff) | |
download | gcc-169f9d09e5d61b72aebc64c5a6632bc376ba2081.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101688 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/hollerith_legacy.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/hollerith_legacy.f90 | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/hollerith_legacy.f90 b/gcc/testsuite/gfortran.dg/hollerith_legacy.f90 new file mode 100644 index 00000000000..561430cf7c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/hollerith_legacy.f90 @@ -0,0 +1,61 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } +! PR15966, PR18781 & PR16531 +implicit none +complex*16 x(2) +complex*8 a(2,2) +character*4 z +character z1(4) +character*4 z2(2,2) +character*80 line +integer*4 i +logical*4 l +real*4 r +character*8 c + +data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/ +data a /8H(i3),abc, 0, 4H(i4), 8H (i9)/ +data z/4h(i5)/ +data z1/1h(,1hi,1h6,1h)/ +data z2/4h(i7),'xxxx','xxxx','xxxx'/ + +z2 (1,2) = 4h(i8) +i = 4hHell +l = 4Ho wo +r = 4Hrld! +write (line, '(3A4)') i, l, r +if (line .ne. 'Hello world!') call abort +i = 2Hab +r = 2Hab +l = 2Hab +c = 2Hab +write (line, '(3A4, 8A)') i, l, r, c +if (line .ne. 'ab ab ab ab ') call abort + +write(line, '(4A8, "!")' ) x +if (line .ne. 'abcdefghijklmnopqrstuvwxyz012345!') call abort + +write (line, a) 3 +if (line .ne. ' 3') call abort +write (line, a (1,2)) 4 +if (line .ne. ' 4') call abort +write (line, z) 5 +if (line .ne. ' 5') call abort +write (line, z1) 6 +if (line .ne. ' 6') call abort +write (line, z2) 7 +if (line .ne. ' 7') call abort +write (line, z2 (1,2)) 8 +if (line .ne. ' 8') call abort +write (line, '(16A)') z2 +if (line .ne. '(i7)xxxx(i8)xxxx') call abort +call test (8h hello) +end + +subroutine test (h) +integer*8 h +character*80 line + +write (line, '(8a)') h +if (line .ne. ' hello') call abort +end subroutine |