summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/achar_6.F90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/achar_6.F90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/achar_6.F90')
-rw-r--r--gcc/testsuite/gfortran.dg/achar_6.F9070
1 files changed, 70 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/achar_6.F90 b/gcc/testsuite/gfortran.dg/achar_6.F90
new file mode 100644
index 000000000..dd93c2747
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/achar_6.F90
@@ -0,0 +1,70 @@
+! { dg-do run }
+! { dg-options "-fbackslash" }
+
+#define TEST(x,y,z) \
+ call test (x, y, z, iachar(x), iachar(y), ichar(x), ichar(y))
+
+ TEST("a", 4_"a", 97)
+ TEST("\0", 4_"\0", 0)
+ TEST("\b", 4_"\b", 8)
+ TEST("\x80", 4_"\x80", int(z'80'))
+ TEST("\xFF", 4_"\xFF", int(z'FF'))
+
+#define TEST2(y,z) \
+ call test_bis (y, z, iachar(y), ichar(y))
+
+ TEST2(4_"\u0100", int(z'0100'))
+ TEST2(4_"\ufe00", int(z'fe00'))
+ TEST2(4_"\u106a", int(z'106a'))
+ TEST2(4_"\uff00", int(z'ff00'))
+ TEST2(4_"\uffff", int(z'ffff'))
+
+contains
+
+subroutine test (s1, s4, i, i1, i2, i3, i4)
+ character(kind=1,len=1) :: s1
+ character(kind=4,len=1) :: s4
+ integer :: i, i1, i2, i3, i4
+
+ if (i /= i1) call abort
+ if (i /= i2) call abort
+ if (i /= i3) call abort
+ if (i /= i4) call abort
+
+ if (iachar (s1) /= i) call abort
+ if (iachar (s4) /= i) call abort
+
+ if (ichar (s1) /= i) call abort
+ if (ichar (s4) /= i) call abort
+
+ if (achar(i, kind=1) /= s1) call abort
+ if (achar(i, kind=4) /= s4) call abort
+
+ if (char(i, kind=1) /= s1) call abort
+ if (char(i, kind=4) /= s4) call abort
+
+ if (iachar(achar(i, kind=1)) /= i) call abort
+ if (iachar(achar(i, kind=4)) /= i) call abort
+
+ if (ichar(char(i, kind=1)) /= i) call abort
+ if (ichar(char(i, kind=4)) /= i) call abort
+
+end subroutine test
+
+subroutine test_bis (s4, i, i2, i4)
+ character(kind=4,len=1) :: s4
+ integer :: i, i2, i4
+
+ if (i /= i2) call abort
+ if (i /= i4) call abort
+
+ if (iachar (s4) /= i) call abort
+ if (ichar (s4) /= i) call abort
+ if (achar(i, kind=4) /= s4) call abort
+ if (char(i, kind=4) /= s4) call abort
+ if (iachar(achar(i, kind=4)) /= i) call abort
+ if (ichar(char(i, kind=4)) /= i) call abort
+
+end subroutine test_bis
+
+end