From 7b95e2a837bd2a1998223d900f71c9269870791e Mon Sep 17 00:00:00 2001 From: Feng Wang Date: Tue, 11 Jul 2006 04:09:40 +0000 Subject: [PATCH] re PR fortran/28213 (ICE: Hollerith constant) 2006-07-11 Feng Wang PR fortran/28213 * gfortran.dg/hollerith4.f90: Test hollerith constants used in I/O list. 2006-07-11 Feng Wang PR fortran/28213 * trans-io.c (ransfer_expr): Deal with Hollerith constants used in I/O list. From-SVN: r115326 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-io.c | 1 + gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.dg/hollerith4.f90 | 21 +++++++++++++++------ 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index a822228cd14..87cfa487f99 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2006-07-11 Feng Wang + + PR fortran/28213 + * trans-io.c (ransfer_expr): Deal with Hollerith constants used in + I/O list. + 2006-07-07 Kazu Hirata * intrinsic.texi: Fix typos. diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 6a0dac03ec4..70b93682d7f 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -1700,6 +1700,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) break; case BT_CHARACTER: + case BT_HOLLERITH: if (se->string_length) arg2 = se->string_length; else diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9203c1566da..54af3356681 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-07-11 Feng Wang + + PR fortran/28213 + * gfortran.dg/hollerith4.f90: Test hollerith constants used in I/O + list. + 2006-07-07 Lee Millward PR c++/27820 diff --git a/gcc/testsuite/gfortran.dg/hollerith4.f90 b/gcc/testsuite/gfortran.dg/hollerith4.f90 index b89018509ee..bd2b411f3b1 100644 --- a/gcc/testsuite/gfortran.dg/hollerith4.f90 +++ b/gcc/testsuite/gfortran.dg/hollerith4.f90 @@ -1,5 +1,6 @@ ! { dg-do run } -! Test Hollerith constant assigned to allocatable array +! Test Hollerith constants assigned to allocatable array +! and used in I/O list. integer, allocatable :: c (:,:) character (len = 20) ch @@ -14,16 +15,24 @@ write (ch, c) 'Hello' if (ch .ne. "Hell") call abort() write (ch, c (1,2)) 'Hello' if (ch .ne. "Hello") call abort() -end -! { dg-warning "Hollerith constant" "const" { target *-*-* } 8 } -! { dg-warning "Conversion" "conversion" { target *-*-* } 8 } +write (ch, *) 5Hhello +if (ch .ne. " hello") call abort() +write (ch, "(A5)") 5Hhello +if (ch .ne. "hello") call abort() + +end ! { dg-warning "Hollerith constant" "const" { target *-*-* } 9 } ! { dg-warning "Conversion" "conversion" { target *-*-* } 9 } -! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 13 } +! { dg-warning "Hollerith constant" "const" { target *-*-* } 10 } +! { dg-warning "Conversion" "conversion" { target *-*-* } 10 } -! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 15 } +! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 14 } +! { dg-warning "Non-character in FORMAT tag" "" { target *-*-* } 16 } + +! { dg-warning "Hollerith constant" "const" { target *-*-* } 19 } +! { dg-warning "Hollerith constant" "const" { target *-*-* } 21 }