aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/testsuite/ChangeLog8
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_1.f9020
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_2.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_3.f9023
-rw-r--r--gcc/testsuite/gfortran.dg/widechar_IO_4.f9018
5 files changed, 88 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 333db9a..dd044c2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-13 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ PR fortran/35863
+ * gfortran.dg/widechar_IO_1.f90: New test.
+ * gfortran.dg/widechar_IO_2.f90: New test.
+ * gfortran.dg/widechar_IO_3.f90: New test.
+ * gfortran.dg/widechar_IO_4.f90: New test.
+
2008-06-13 Tobias Burnus <burnus@net-b.de>
PR fortran/36476
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_1.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
new file mode 100644
index 0000000..0fe479c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_1.f90
@@ -0,0 +1,20 @@
+! { dg-do run }
+! Wide chracter I/O test 1, formatted and mixed kind
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program test1
+ integer, parameter :: k4 = 4
+ character(len=10,kind=4) :: wide
+ character(len=10,kind=1) :: thin
+ character(kind=1,len=25) :: buffer
+ wide=k4_"Goodbye!"
+ thin="Hello!"
+ write(buffer, '(a)') wide
+ if (buffer /= "Goodbye!") call abort
+ open(10, form="formatted", access="stream", status="scratch")
+ write(10, '(a)') thin
+ rewind(10)
+ read(10, '(a)') wide
+ if (wide /= k4_"Hello!") call abort
+ write(buffer,*) thin, ">",wide,"<"
+ if (buffer /= " Hello! >Hello! <") call abort
+end program test1
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_2.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_2.f90
new file mode 100644
index 0000000..6b13e4f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_2.f90
@@ -0,0 +1,19 @@
+! { dg-do run }
+! Wide chracter I/O test 2, formatted array write and read
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program chkdata
+ integer, parameter :: k4=4
+ character(len=7, kind=k4), dimension(3) :: mychar
+ character(50) :: buffer
+ mychar(1) = k4_"abc1234"
+ mychar(2) = k4_"def5678"
+ mychar(3) = k4_"ghi9012"
+ buffer = ""
+ write(buffer,'(3(a))') mychar(2:3), mychar(1)
+ if (buffer /= "def5678ghi9012abc1234") call abort
+ write(buffer,'(3(a))') mychar
+ if (buffer /= "abc1234def5678ghi9012") call abort
+ mychar = ""
+ read(buffer,'(3(a))') mychar
+ if (any(mychar.ne.[ k4_"abc1234",k4_"def5678",k4_"ghi9012" ])) call abort
+end program chkdata
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_3.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90
new file mode 100644
index 0000000..6f4a10c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_3.f90
@@ -0,0 +1,23 @@
+! { dg-do run }
+! Wide chracter I/O test 3, unformatted arrays
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+program test1
+ integer, parameter :: k4 = 4
+ character(len=10,kind=4) :: wide
+ character(len=10,kind=4), dimension(5,7) :: widearray
+ wide = k4_"abcdefg"
+ widearray = k4_"1234abcd"
+ open(10, form="unformatted", status="scratch")
+ write(10) wide
+ rewind(10)
+ wide = "wrong"
+ read(10) wide
+ if (wide /= k4_"abcdefg") call abort
+ rewind(10)
+ write(10) widearray(2:4,3:7)
+ widearray(2:4,3:7)=""
+ rewind(10)
+ read(10) widearray(2:4,3:7)
+ close(10)
+ if (any(widearray.ne.k4_"1234abcd")) call abort
+end program test1
diff --git a/gcc/testsuite/gfortran.dg/widechar_IO_4.f90 b/gcc/testsuite/gfortran.dg/widechar_IO_4.f90
new file mode 100644
index 0000000..e108b15
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/widechar_IO_4.f90
@@ -0,0 +1,18 @@
+! { dg-do run }
+! { dg-options -fbackslash }
+! Wide chracter I/O test 4, formatted ISO-8859-1 characters in string
+! Test case developed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
+! Compile with -fbackslash
+integer, parameter :: k4 = 4
+character(kind=1,len=15) :: buffer
+character(kind=1, len=1) :: c1, c2
+character(kind=4,len=20) :: str = k4_'X\xF8öABC' ! ISO-8859-1 encoded string
+buffer = ""
+write(buffer,'(3a)')':',trim(str),':'
+if (buffer.ne.':X\xF8öABC: ') call abort
+str = ""
+read(buffer,'(3a)') c1,str(1:6),c2
+if (c1.ne.':') call abort
+if (str.ne.k4_'X\xF8öAB') call abort
+if (c2.ne.'C') call abort
+end