summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/enum_10.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/enum_10.f90
downloadcbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2
cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.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/enum_10.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/enum_10.f9064
1 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/enum_10.f90 b/gcc/testsuite/gfortran.dg/enum_10.f90
new file mode 100644
index 000000000..99a16901c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/enum_10.f90
@@ -0,0 +1,64 @@
+! { dg-do run }
+! { dg-additional-sources enum_10.c }
+! { dg-options "-fshort-enums -w" }
+! { dg-options "-fshort-enums -w -Wl,--no-enum-size-warning" { target arm*-*-linux*eabi } }
+! Make sure short enums are indeed interoperable with the
+! corresponding C type.
+
+module enum_10
+enum, bind( c )
+ enumerator :: one1 = 1, two1, max1 = huge(1_1)
+end enum
+
+enum, bind( c )
+ enumerator :: one2 = 1, two2, max2 = huge(1_2)
+end enum
+
+enum, bind( c )
+ enumerator :: one4 = 1, two4, max4 = huge(1_4)
+end enum
+end module enum_10
+
+use enum_10
+
+interface f1
+ subroutine f1(i,j)
+ use enum_10
+ integer (kind(max1)) :: i
+ integer :: j
+ end subroutine f1
+end interface
+
+
+interface f2
+ subroutine f2(i,j)
+ use enum_10
+ integer (kind(max2)) :: i
+ integer :: j
+ end subroutine f2
+end interface
+
+
+interface f4
+ subroutine f4(i,j)
+ use enum_10
+ integer (kind(max4)) :: i
+ integer :: j
+ end subroutine f4
+end interface
+
+
+call f1 (one1, 1)
+call f1 (two1, 2)
+call f1 (max1, huge(1_1)+0) ! Adding 0 to get default integer
+
+call f2 (one2, 1)
+call f2 (two2, 2)
+call f2 (max2, huge(1_2)+0)
+
+call f4 (one4, 1)
+call f4 (two4, 2)
+call f4 (max4, huge(1_4)+0)
+end
+
+! { dg-final { cleanup-modules "enum_10" } }