summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/lto
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gfortran.dg/lto')
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091015-1_0.f8
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091015-1_1.f4
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091015-1_2.f5
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091016-1_0.f9012
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091028-1_0.f909
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091028-1_1.c11
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091028-2_0.f909
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20091028-2_1.c11
-rw-r--r--gcc/testsuite/gfortran.dg/lto/lto.exp57
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr40724_0.f3
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr40724_1.f3
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr40725_0.f0316
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr40725_1.c12
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41069_0.f907
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41069_1.f9010
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41069_2.f909
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41521_0.f909
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41521_1.f909
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr41764_0.f13
19 files changed, 217 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/lto/20091015-1_0.f b/gcc/testsuite/gfortran.dg/lto/20091015-1_0.f
new file mode 100644
index 00000000000..f47e1a4ac6c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091015-1_0.f
@@ -0,0 +1,8 @@
+! { dg-lto-do link }
+! We expect some warnings about mismatched symbol types
+! { dg-extra-ld-options "-w" }
+
+ subroutine dalie6s(iqmod6,nz,wx,cor6d)
+ common/dascr/iscrda(100),rscrri(100),iscrri(100),idao
+ call daall(iscrda,100,'$$IS ',no,nv)
+ end
diff --git a/gcc/testsuite/gfortran.dg/lto/20091015-1_1.f b/gcc/testsuite/gfortran.dg/lto/20091015-1_1.f
new file mode 100644
index 00000000000..7a64ffa6786
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091015-1_1.f
@@ -0,0 +1,4 @@
+ SUBROUTINE DAALL(IC,L,CCC,NO,NV)
+ COMMON /main1/ eps
+ END
+
diff --git a/gcc/testsuite/gfortran.dg/lto/20091015-1_2.f b/gcc/testsuite/gfortran.dg/lto/20091015-1_2.f
new file mode 100644
index 00000000000..5bfd02227fa
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091015-1_2.f
@@ -0,0 +1,5 @@
+ program test
+ common/main1/ eps(2)
+ dimension cor6d(2,2)
+ call dalie6s(iqmod6,1,wx,cor6d)
+ end
diff --git a/gcc/testsuite/gfortran.dg/lto/20091016-1_0.f90 b/gcc/testsuite/gfortran.dg/lto/20091016-1_0.f90
new file mode 100644
index 00000000000..c26ad90fbe2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091016-1_0.f90
@@ -0,0 +1,12 @@
+! { dg-lto-do link }
+! { dg-lto-options {{-flto -g -fPIC -shared} {-O -flto -g -fPIC -shared}} }
+
+ FUNCTION makenumberstring(x)
+ IMPLICIT NONE
+ REAL, INTENT(IN) :: x
+ CHARACTER(len=20) :: makenumberstring
+ INTEGER :: xx
+ xx = x**2 ! << ICE
+ makenumberstring = ''
+ END FUNCTION
+
diff --git a/gcc/testsuite/gfortran.dg/lto/20091028-1_0.f90 b/gcc/testsuite/gfortran.dg/lto/20091028-1_0.f90
new file mode 100644
index 00000000000..57c1b1f6028
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091028-1_0.f90
@@ -0,0 +1,9 @@
+! { dg-lto-do link }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+
+SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
+ DataHandle, Element, VarName, Data, code )
+ CALL int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, 1, &
+ DataHandle, DummyData, DummyCount, code )
+END SUBROUTINE int_gen_ti_header_char
+
diff --git a/gcc/testsuite/gfortran.dg/lto/20091028-1_1.c b/gcc/testsuite/gfortran.dg/lto/20091028-1_1.c
new file mode 100644
index 00000000000..b3afc23fb8e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091028-1_1.c
@@ -0,0 +1,11 @@
+extern void bcopy(const void *, void *, __SIZE_TYPE__ n);
+char *p;
+int int_gen_ti_header_c_ (char * hdrbuf, int * hdrbufsize,
+ int * itypesize, int * typesize,
+ int * DataHandle, char * Data,
+ int * Count, int * code)
+{
+ bcopy (typesize, p, sizeof(int)) ;
+ bcopy (Data, p, *Count * *typesize) ;
+}
+
diff --git a/gcc/testsuite/gfortran.dg/lto/20091028-2_0.f90 b/gcc/testsuite/gfortran.dg/lto/20091028-2_0.f90
new file mode 100644
index 00000000000..57c1b1f6028
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091028-2_0.f90
@@ -0,0 +1,9 @@
+! { dg-lto-do link }
+! { dg-extra-ld-options "-r -nostdlib -finline-functions" }
+
+SUBROUTINE int_gen_ti_header_char( hdrbuf, hdrbufsize, itypesize, &
+ DataHandle, Element, VarName, Data, code )
+ CALL int_gen_ti_header_c ( hdrbuf, hdrbufsize, itypesize, 1, &
+ DataHandle, DummyData, DummyCount, code )
+END SUBROUTINE int_gen_ti_header_char
+
diff --git a/gcc/testsuite/gfortran.dg/lto/20091028-2_1.c b/gcc/testsuite/gfortran.dg/lto/20091028-2_1.c
new file mode 100644
index 00000000000..496aaf11220
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20091028-2_1.c
@@ -0,0 +1,11 @@
+extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n);
+char *p;
+int int_gen_ti_header_c_ (char * hdrbuf, int * hdrbufsize,
+ int * itypesize, int * typesize,
+ int * DataHandle, char * Data,
+ int * Count, int * code)
+{
+ memcpy (typesize, p, sizeof(int)) ;
+ memcpy (Data, p, *Count * *typesize) ;
+}
+
diff --git a/gcc/testsuite/gfortran.dg/lto/lto.exp b/gcc/testsuite/gfortran.dg/lto/lto.exp
new file mode 100644
index 00000000000..a3707ddbd6b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/lto.exp
@@ -0,0 +1,57 @@
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+#
+# Contributed by Diego Novillo <dnovillo@google.com>
+
+
+# Test link-time optimization across multiple files.
+#
+# Programs are broken into multiple files. Each one is compiled
+# separately with LTO information. The final executable is generated
+# by collecting all the generated object files using regular LTO or WHOPR.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# Load procedures from common libraries.
+load_lib standard.exp
+load_lib gfortran-dg.exp
+
+# Load the language-independent compabibility support procedures.
+load_lib lto.exp
+
+lto_init
+
+
+# Define an identifier for use with this suite to avoid name conflicts
+# with other lto tests running at the same time.
+set sid "f_lto"
+
+# If LTO has not been enabled, bail.
+if { ![check_effective_target_lto] } {
+ return
+}
+
+# Main loop.
+foreach src [lsort [glob -nocomplain $srcdir/$subdir/*_0.\[fF\]{,90,95,03,08} ]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $src] then {
+ continue
+ }
+
+ lto-execute $src $sid
+}
diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_0.f b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f
new file mode 100644
index 00000000000..2d7a9864e40
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f
@@ -0,0 +1,3 @@
+ subroutine f
+ print *, "Hello World"
+ end
diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_1.f b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f
new file mode 100644
index 00000000000..ed8f31020dd
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f
@@ -0,0 +1,3 @@
+ program test
+ call f
+ end
diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03
new file mode 100644
index 00000000000..2f33a0f5bf4
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03
@@ -0,0 +1,16 @@
+module bind_c_dts_2
+use, intrinsic :: iso_c_binding
+implicit none
+type, bind(c) :: my_c_type_1
+ integer(c_int) :: j
+end type my_c_type_1
+contains
+ subroutine sub0(my_type, expected_j) bind(c)
+ type(my_c_type_1) :: my_type
+ integer(c_int), value :: expected_j
+ if (my_type%j .ne. expected_j) then
+ call abort ()
+ end if
+ end subroutine sub0
+end module bind_c_dts_2
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_1.c b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c
new file mode 100644
index 00000000000..7de46b8a988
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c
@@ -0,0 +1,12 @@
+typedef struct c_type_1
+{
+ int j;
+} c_type_1_t;
+void sub0(c_type_1_t *c_type, int expected_j);
+int main(int argc, char **argv)
+{
+ c_type_1_t c_type;
+ c_type.j = 11;
+ sub0(&c_type, c_type.j);
+ return 0;
+}
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90
new file mode 100644
index 00000000000..4e7d65939c8
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90
@@ -0,0 +1,7 @@
+! { dg-lto-do link }
+SUBROUTINE mltfftsg ( a, ldax, lday )
+ INTEGER, PARAMETER :: dbl = SELECTED_REAL_KIND ( 14, 200 )
+ INTEGER, INTENT ( IN ) :: ldax, lday
+ COMPLEX ( dbl ), INTENT ( INOUT ) :: a ( ldax, lday )
+END SUBROUTINE mltfftsg
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90
new file mode 100644
index 00000000000..0c4e05d66d3
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90
@@ -0,0 +1,10 @@
+SUBROUTINE S(zin)
+ COMPLEX(8), DIMENSION(3,3,3) :: zin
+ INTEGER :: m,n
+ CALL mltfftsg ( zin, m, n )
+END SUBROUTINE
+
+COMPLEX(8), DIMENSION(3,3,3) :: zin
+CALL s(zin)
+END
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90
new file mode 100644
index 00000000000..121603eaa60
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90
@@ -0,0 +1,9 @@
+SUBROUTINE fftsg3d ( n, zout )
+ INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 )
+ INTEGER, DIMENSION(*), INTENT(IN) :: n
+ COMPLEX(KIND=dp), DIMENSION(*), INTENT(INOUT) :: zout
+ INTEGER :: nx
+ nx = n ( 1 )
+ CALL mltfftsg ( zout, nx, nx )
+END SUBROUTINE fftsg3d
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41521_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr41521_0.f90
new file mode 100644
index 00000000000..d882779263d
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41521_0.f90
@@ -0,0 +1,9 @@
+! { dg-lto-do link }
+! { dg-lto-options {{-g -flto} {-g -O -flto}} }
+program species
+integer spk(2)
+real eval(2)
+spk = 2
+call atom(1.1,spk,eval)
+end program
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41521_1.f90 b/gcc/testsuite/gfortran.dg/lto/pr41521_1.f90
new file mode 100644
index 00000000000..897e7aded0a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41521_1.f90
@@ -0,0 +1,9 @@
+subroutine atom(sol,k,eval)
+real, intent(in) :: sol
+integer, intent(in) :: k(2)
+real, intent(out) :: eval(2)
+real t1
+ t1=sqrt(dble(k(1)**2)-(sol)**2)
+ eval(1)=sol**2/sqrt(t1)-sol**2
+end subroutine
+
diff --git a/gcc/testsuite/gfortran.dg/lto/pr41764_0.f b/gcc/testsuite/gfortran.dg/lto/pr41764_0.f
new file mode 100644
index 00000000000..fd231508383
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr41764_0.f
@@ -0,0 +1,13 @@
+! { dg-lto-do link }
+! FIXME: This test used to fail with gold and -fuse-linker-plugin. It is
+! here for people testing with RUNTESTFLAGS=-fuse-linker-plugin, but it would
+! be nice to create "dg-effective-target-supports linker-plugin" and use it.
+ PROGRAM INIRAN
+ INTEGER IX, IY, IZ
+ COMMON /XXXRAN/ IX, IY, IZ
+ END
+ BLOCKDATA RAEWIN
+ INTEGER IX, IY, IZ
+ COMMON /XXXRAN/ IX, IY, IZ
+ DATA IX, IY, IZ / 1974, 235, 337 /
+ END