This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Enable Hollerith constant and character arrayin format tag (take 3).
- From: Feng Wang <wf_cs at yahoo dot com>
- To: Feng Wang <wf_cs at yahoo dot com>, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 29 Jun 2005 21:17:11 +0800 (CST)
- Subject: Re: Enable Hollerith constant and character arrayin format tag (take 3).
More tests. ( Only five files allowed to attach )
And hope not to take too long this round.
--- Feng Wang <wf_cs@yahoo.com>写道:
> 1. Change to enable this feature under GFC_STD_LEGACY.
> 2. Fix a bug when matching Hollerith constants.
> 3. More tests.
>
> Tested on i686-linux with no regression.
>
> The original patch:
> http://gcc.gnu.org/ml/fortran/2005-05/msg00280.html
> http://gcc.gnu.org/ml/fortran/2005-03/msg00502.html
>
Best Regards,
Feng Wang
--
Creative Compiler Research Group,
National University of Defense Technology, China.
__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com
! { dg-do run }
! 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
! { dg-warning "Hollerith constant" "const" { target *-*-* } 15 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 15 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 16 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 16 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 17 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 18 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 19 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 21 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 21 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 22 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 22 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 23 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 23 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 24 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 24 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 27 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 27 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 28 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 28 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 29 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 29 }
! { dg-warning "Hollerith constant" "const" { target *-*-* } 30 }
! { dg-warning "Conversion" "conversion" { target *-*-* } 30 }
! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 37 }
! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 39 }
! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 43 }
! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 45 }
! { dg-warning "Character array in FORMAT tag" "" { target *-*-* } 47 }
! { dg-warning "Hollerith constant" "" { target *-*-* } 51 }
! { dg-do compile }
! { dg-options "-std=f95" }
! 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
! { dg-error "Hollerith constant" "const" { target *-*-* } 16 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 17 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 18 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 19 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 20 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 22 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 23 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 24 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 25 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 28 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 29 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 30 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 31 }
! { dg-error "Hollerith constant" "const" { target *-*-* } 52 }
! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 38 }
! { dg-error "Non-character in FORMAT tag" "" { target *-*-* } 40 }
! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 44 }
! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 46 }
! { dg-error "Character array in FORMAT tag" "" { target *-*-* } 48 }
! { 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