summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/lto
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/lto
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/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/20100110-1_0.f9019
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20100222-1_0.f0335
-rw-r--r--gcc/testsuite/gfortran.dg/lto/20100222-1_1.c25
-rw-r--r--gcc/testsuite/gfortran.dg/lto/lto.exp58
-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.f0317
-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
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f9034
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr45586_0.f9029
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr46036_0.f9014
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr46629_0.f9015
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr46911_0.f6
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr47839_0.f908
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr47839_1.f907
29 files changed, 411 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 000000000..f47e1a4ac
--- /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 000000000..7a64ffa67
--- /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 000000000..5bfd02227
--- /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 000000000..a882da042
--- /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 -r -nostdlib} {-O -flto -g -fPIC -r -nostdlib}} }
+
+ 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 000000000..57c1b1f60
--- /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 000000000..b3afc23fb
--- /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 000000000..57c1b1f60
--- /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 000000000..496aaf112
--- /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/20100110-1_0.f90 b/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90
new file mode 100644
index 000000000..d3caa61da
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20100110-1_0.f90
@@ -0,0 +1,19 @@
+! { dg-lto-do link }
+! { dg-lto-options {{ -O1 -flto }} }
+! { dg-suppress-ld-options "-O1" }
+
+ SUBROUTINE ylm4(ylm)
+ COMPLEX, INTENT (OUT):: ylm(1)
+ INTEGER l,m
+ COMPLEX ylms
+ REAL, ALLOCATABLE, SAVE :: ynorm(:)
+ ylms = 0
+ DO m = 1, 1
+ DO l = m, 1
+ ylm(m) = conjg(ylms)*ynorm(m)
+ ENDDO
+ ENDDO
+ END SUBROUTINE ylm4
+
+ PROGRAM test
+ END
diff --git a/gcc/testsuite/gfortran.dg/lto/20100222-1_0.f03 b/gcc/testsuite/gfortran.dg/lto/20100222-1_0.f03
new file mode 100644
index 000000000..fece78154
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20100222-1_0.f03
@@ -0,0 +1,35 @@
+! { dg-lto-do run }
+! This testcase tests c_funloc and c_funptr from iso_c_binding. It uses
+! functions defined in c_funloc_tests_3_funcs.c.
+module c_funloc_tests_3
+ implicit none
+contains
+ function ffunc(j) bind(c)
+ use iso_c_binding, only: c_funptr, c_int
+ integer(c_int) :: ffunc
+ integer(c_int), value :: j
+ ffunc = -17*j
+ end function ffunc
+end module c_funloc_tests_3
+program main
+ use iso_c_binding, only: c_funptr, c_funloc
+ use c_funloc_tests_3, only: ffunc
+ implicit none
+ interface
+ function returnFunc() bind(c,name="returnFunc")
+ use iso_c_binding, only: c_funptr
+ type(c_funptr) :: returnFunc
+ end function returnFunc
+ subroutine callFunc(func,pass,compare) bind(c,name="callFunc")
+ use iso_c_binding, only: c_funptr, c_int
+ type(c_funptr), value :: func
+ integer(c_int), value :: pass,compare
+ end subroutine callFunc
+ end interface
+ type(c_funptr) :: p
+ p = returnFunc()
+ call callFunc(p, 13,3*13)
+ p = c_funloc(ffunc)
+ call callFunc(p, 21,-17*21)
+end program main
+! { dg-final { cleanup-modules "c_funloc_tests_3" } }
diff --git a/gcc/testsuite/gfortran.dg/lto/20100222-1_1.c b/gcc/testsuite/gfortran.dg/lto/20100222-1_1.c
new file mode 100644
index 000000000..994da0a50
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/20100222-1_1.c
@@ -0,0 +1,25 @@
+/* These functions support the test case c_funloc_tests_3. */
+#include <stdlib.h>
+#include <stdio.h>
+
+int printIntC(int i)
+{
+ return 3*i;
+}
+
+int (*returnFunc(void))(int)
+{
+ return &printIntC;
+}
+
+void callFunc(int(*func)(int), int pass, int compare)
+{
+ int result = (*func)(pass);
+ if(result != compare)
+ {
+ printf("FAILED: Got %d, expected %d\n", result, compare);
+ abort();
+ }
+ else
+ printf("SUCCESS: Got %d, expected %d\n", result, compare);
+}
diff --git a/gcc/testsuite/gfortran.dg/lto/lto.exp b/gcc/testsuite/gfortran.dg/lto/lto.exp
new file mode 100644
index 000000000..e211426db
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/lto.exp
@@ -0,0 +1,58 @@
+# 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 no-mathlib
+
+# 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
+}
+
+lto_finish
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 000000000..2d7a9864e
--- /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 000000000..ed8f31020
--- /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 000000000..db783159a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03
@@ -0,0 +1,17 @@
+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
+
+! { dg-final { cleanup-modules "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 000000000..7de46b8a9
--- /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 000000000..4e7d65939
--- /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 000000000..0c4e05d66
--- /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 000000000..121603eaa
--- /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 000000000..d88277926
--- /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 000000000..897e7aded
--- /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 000000000..fd2315083
--- /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
diff --git a/gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90
new file mode 100644
index 000000000..52e2bb1e6
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr45586-2_0.f90
@@ -0,0 +1,34 @@
+! { dg-lto-do link }
+!
+! PR fortran/45586 (comment 53)
+!
+
+MODULE M1
+ INTEGER, PARAMETER :: dp=8
+ TYPE realspace_grid_type
+ REAL(KIND=dp), DIMENSION ( :, :, : ), ALLOCATABLE :: r
+ END TYPE realspace_grid_type
+ TYPE realspace_grid_p_type
+ TYPE(realspace_grid_type), POINTER :: rs_grid
+ END TYPE realspace_grid_p_type
+ TYPE realspaces_grid_p_type
+ TYPE(realspace_grid_p_type), DIMENSION(:), POINTER :: rs
+ END TYPE realspaces_grid_p_type
+END MODULE
+
+MODULE M2
+ USE M1
+CONTAINS
+ SUBROUTINE S1()
+ INTEGER :: i,j
+ TYPE(realspaces_grid_p_type), DIMENSION(:), POINTER :: rs_gauge
+ REAL(dp), DIMENSION(:, :, :), POINTER :: y
+ y=>rs_gauge(i)%rs(j)%rs_grid%r
+ END SUBROUTINE
+END MODULE
+
+USE M2
+ CALL S1()
+END
+
+! { dg-final { cleanup-modules "m1 m2" } }
diff --git a/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90
new file mode 100644
index 000000000..84f3633df
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr45586_0.f90
@@ -0,0 +1,29 @@
+! { dg-lto-do link }
+ MODULE M1
+ INTEGER, PARAMETER :: dp=8
+ TYPE realspace_grid_type
+
+ REAL(KIND=dp), DIMENSION ( :, :, : ), ALLOCATABLE :: r
+
+ END TYPE realspace_grid_type
+ END MODULE
+
+ MODULE M2
+ USE m1
+ CONTAINS
+ SUBROUTINE S1(x)
+ TYPE(realspace_grid_type), POINTER :: x
+ REAL(dp), DIMENSION(:, :, :), POINTER :: y
+ y=>x%r
+ y=0
+
+ END SUBROUTINE
+ END MODULE
+
+ USE M2
+ TYPE(realspace_grid_type), POINTER :: x
+ ALLOCATE(x)
+ ALLOCATE(x%r(10,10,10))
+ CALL S1(x)
+ write(6,*) x%r
+ END
diff --git a/gcc/testsuite/gfortran.dg/lto/pr46036_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr46036_0.f90
new file mode 100644
index 000000000..558c7edc2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr46036_0.f90
@@ -0,0 +1,14 @@
+! { dg-lto-do link }
+! { dg-lto-options {{ -O -flto -ftree-vectorize }} }
+
+function no_of_edges(self) result(res)
+ integer(kind=kind(1)) :: edge_bit_string
+ integer(kind=kind(1)) :: res
+ integer(kind=kind(1)) :: e
+ do e = 0, 11
+ if (.not. btest(edge_bit_string,e)) cycle
+ res = res + 1
+ end do
+end function no_of_edges
+
+end program
diff --git a/gcc/testsuite/gfortran.dg/lto/pr46629_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr46629_0.f90
new file mode 100644
index 000000000..0b34418e7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr46629_0.f90
@@ -0,0 +1,15 @@
+! PR middle-end/46629
+! { dg-lto-do assemble }
+! { dg-lto-options {{ -O2 -flto -ftree-vectorize }} }
+! { dg-lto-options {{ -O2 -flto -ftree-vectorize -march=x86-64 }} { target i?86-*-* x86_64-*-* } }
+
+subroutine foo
+ character(len=6), save :: c
+ real, save :: d(0:100)
+ integer, save :: x, n, i
+ n = x
+ print *, c
+ do i = 2, n
+ d(i) = -d(i-1)
+ end do
+end
diff --git a/gcc/testsuite/gfortran.dg/lto/pr46911_0.f b/gcc/testsuite/gfortran.dg/lto/pr46911_0.f
new file mode 100644
index 000000000..fce959750
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr46911_0.f
@@ -0,0 +1,6 @@
+! { dg-lto-do link }
+! { dg-lto-options {{ -O2 -flto -g }} }
+! { dg-extra-ld-options "-r -nostdlib" }
+ common/main1/ eps(2)
+ call dalie6s(iqmod6,1,wx,cor6d)
+ end
diff --git a/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
new file mode 100644
index 000000000..9ea931528
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr47839_0.f90
@@ -0,0 +1,8 @@
+! { dg-lto-do link }
+! { dg-lto-options {{ -g -flto }} }
+! { dg-extra-ld-options "-r -nostdlib" }
+
+MODULE globalvar_mod
+integer :: xstop
+CONTAINS
+END MODULE globalvar_mod
diff --git a/gcc/testsuite/gfortran.dg/lto/pr47839_1.f90 b/gcc/testsuite/gfortran.dg/lto/pr47839_1.f90
new file mode 100644
index 000000000..5c94ff17b
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr47839_1.f90
@@ -0,0 +1,7 @@
+MODULE PEC_mod
+CONTAINS
+SUBROUTINE PECapply(Ex)
+USE globalvar_mod, ONLY : xstop
+real(kind=8), dimension(1:xstop), intent(inout) :: Ex
+END SUBROUTINE PECapply
+END MODULE PEC_mod