summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog238
-rw-r--r--gcc/testsuite/g++.dg/20090107-1.C12
-rw-r--r--gcc/testsuite/g++.dg/20090121-1.C19
-rw-r--r--gcc/testsuite/g++.dg/README1
-rw-r--r--gcc/testsuite/g++.dg/dg.exp1
-rw-r--r--gcc/testsuite/g++.dg/ipa/20090113-1.C25
-rw-r--r--gcc/testsuite/g++.dg/lto/20080709_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20080829_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20080904_0.C37
-rw-r--r--gcc/testsuite/g++.dg/lto/20080907_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-1_0.C36
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-2_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080908-3_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20080909-1_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080910-1_0.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/20080912-1_0.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20080912_0.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20080915_0.C29
-rw-r--r--gcc/testsuite/g++.dg/lto/20080916_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20080917_0.C29
-rw-r--r--gcc/testsuite/g++.dg/lto/20080924_0.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20080926_0.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081008_0.C36
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022.h8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20081022_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20081023_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109-1_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109-2_0.C15
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109_0.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20081109_1.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118-1_0.C27
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118-1_1.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20081118_1.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1.h8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1_0.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119-1_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119_0.C24
-rw-r--r--gcc/testsuite/g++.dg/lto/20081119_1.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-1_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-1_1.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-2_0.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20081120-2_1.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20081123_0.C8
-rw-r--r--gcc/testsuite/g++.dg/lto/20081123_1.C16
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125.h15
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125_0.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081125_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20081127_0.C2
-rw-r--r--gcc/testsuite/g++.dg/lto/20081127_1.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20081203_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20081203_1.C4
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-1_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-1_1.C3
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-2_0.C10
-rw-r--r--gcc/testsuite/g++.dg/lto/20081204-2_1.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20081209_0.C18
-rw-r--r--gcc/testsuite/g++.dg/lto/20081209_1.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1.h6
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1_0.C19
-rw-r--r--gcc/testsuite/g++.dg/lto/20081211-1_1.C6
-rw-r--r--gcc/testsuite/g++.dg/lto/20081217-1_0.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20081217-2_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20081219_0.C72
-rw-r--r--gcc/testsuite/g++.dg/lto/20081219_1.C42
-rw-r--r--gcc/testsuite/g++.dg/lto/20090106_0.C203
-rw-r--r--gcc/testsuite/g++.dg/lto/20090112_0.C11
-rw-r--r--gcc/testsuite/g++.dg/lto/20090128_0.C88
-rw-r--r--gcc/testsuite/g++.dg/lto/20090221_0.C53
-rw-r--r--gcc/testsuite/g++.dg/lto/20090302_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20090302_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20090303_0.C22
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1.h22
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1_0.C34
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311-1_1.C28
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311_0.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20090311_1.C13
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312.h2
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312_0.C14
-rw-r--r--gcc/testsuite/g++.dg/lto/20090312_1.C21
-rw-r--r--gcc/testsuite/g++.dg/lto/20090313_0.C5
-rw-r--r--gcc/testsuite/g++.dg/lto/20090313_1.C12
-rw-r--r--gcc/testsuite/g++.dg/lto/20090315_0.C9
-rw-r--r--gcc/testsuite/g++.dg/lto/20090315_1.C7
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-1_0.C58
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-2_0.C20
-rw-r--r--gcc/testsuite/g++.dg/lto/20091002-3_0.C15
-rw-r--r--gcc/testsuite/g++.dg/lto/README35
-rw-r--r--gcc/testsuite/g++.dg/lto/lto.exp58
-rw-r--r--gcc/testsuite/g++.dg/lto/pr40818_0.C11
-rw-r--r--gcc/testsuite/g++.dg/opt/thunk3-1.C6
-rw-r--r--gcc/testsuite/g++.dg/opt/thunk4.C63
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c4
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c1
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/execute.exp2
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp2
-rw-r--r--gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp2
-rw-r--r--gcc/testsuite/gcc.dg/20081223-1.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20080908_0.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/20080917_0.c29
-rw-r--r--gcc/testsuite/gcc.dg/lto/20080924_0.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081024_0.c26
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081109_0.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081111_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081111_1.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081112_0.c14
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081112_1.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081115_0.c32
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081115_1.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081115_2.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081118_0.c28
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081118_1.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081118_2.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081120-1_0.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081120-1_1.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081120-2_0.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081120-2_1.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081125_0.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081125_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081126_0.c8
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081201-1_0.c33
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081201-1_1.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081201-1_2.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081201-2_0.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081201-2_1.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081202-1_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081202-1_1.c10
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081202-2_0.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081202-2_1.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081204-1_0.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081204-1_1.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081204-2_0.c5
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081210-1_0.c21
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081212-1_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081222_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081222_0.h1
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081222_1.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081224_0.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081224_0.h3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20081224_1.c2
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090116_0.c12
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090120_0.c14
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090126-1_0.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090126-2_0.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090206-1_0.c10
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090206-2_0.c18
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090210_0.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090210_1.c22
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090213_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090213_1.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218-1_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218-1_1.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218-2_0.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218-2_1.c19
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218_0.c7
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218_1.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218_2.c6
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090218_3.c3
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090219_0.c28
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090312_0.c43
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090312_1.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090313_0.c9
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090706-1_0.c42
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090706-2_0.c16
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090717_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090717_1.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090729_0.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090729_1.c4
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090812_0.c11
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090812_1.c26
-rw-r--r--gcc/testsuite/gcc.dg/lto/20090914-1_0.c13
-rw-r--r--gcc/testsuite/gcc.dg/lto/README35
-rw-r--r--gcc/testsuite/gcc.dg/lto/lto.exp57
-rw-r--r--gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp2
-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/lib/c-torture.exp9
-rw-r--r--gcc/testsuite/lib/gcc-dg.exp13
-rw-r--r--gcc/testsuite/lib/lto.exp501
-rw-r--r--gcc/testsuite/lib/target-supports.exp8
-rw-r--r--gcc/testsuite/lib/torture-options.exp10
212 files changed, 3655 insertions, 8 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 50c63625d8f..699be089ef0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,241 @@
+2009-10-03 Ben Elliston <bje@au.ibm.com>
+ Bill Maddox <maddox@google.com>
+ Cary Coutant <ccoutant@google.com>
+ Chris Demetriou <cgd@google.com>
+ Diego Novillo <dnovillo@google.com>
+ Doug Kwan <dougkwan@google.com>
+ Jan Hubicka <jh@suse.cz>
+ Ollie Wild <aaw@google.com>
+ Rafael Espindola <espindola@google.com>
+ Richard Guenther <rguenther@suse.de>
+ Simon Baldwin <simonb@google.com>
+
+ * g++.dg/20090107-1.C: New.
+ * g++.dg/20090121-1.C: New.
+ * g++.dg/ipa/20090113-1.C: New.
+ * g++.dg/lto: New directory.
+ * g++.dg/lto/20080829_0.C: New.
+ * g++.dg/lto/20080904_0.C: New.
+ * g++.dg/lto/20080907_0.C: New.
+ * g++.dg/lto/20080908-1_0.C: New.
+ * g++.dg/lto/20080908-2_0.C: New.
+ * g++.dg/lto/20080908-3_0.C: New.
+ * g++.dg/lto/20080909-1_0.C: New.
+ * g++.dg/lto/20080910-1_0.C: New.
+ * g++.dg/lto/20080912-1_0.C: New.
+ * g++.dg/lto/20080912_0.C: New.
+ * g++.dg/lto/20080915_0.C: New.
+ * g++.dg/lto/20080916_0.C: New.
+ * g++.dg/lto/20080917_0.C: New.
+ * g++.dg/lto/20080924_0.C: New.
+ * g++.dg/lto/20080926_0.C: New.
+ * g++.dg/lto/20081008_0.C: New.
+ * g++.dg/lto/20081022.h: New.
+ * g++.dg/lto/20081022_0.C: New.
+ * g++.dg/lto/20081022_1.C: New.
+ * g++.dg/lto/20081023_0.C: New.
+ * g++.dg/lto/20081109-1_0.C: New.
+ * g++.dg/lto/20081109-2_0.C: New.
+ * g++.dg/lto/20081109_0.C: New.
+ * g++.dg/lto/20081109_1.C: New.
+ * g++.dg/lto/20081118-1_0.C: New.
+ * g++.dg/lto/20081118-1_1.C: New.
+ * g++.dg/lto/20081118_0.C: New.
+ * g++.dg/lto/20081118_1.C: New.
+ * g++.dg/lto/20081119-1.h: New.
+ * g++.dg/lto/20081119-1_0.C: New.
+ * g++.dg/lto/20081119-1_1.C: New.
+ * g++.dg/lto/20081119_0.C: New.
+ * g++.dg/lto/20081119_1.C: New.
+ * g++.dg/lto/20081120-1_0.C: New.
+ * g++.dg/lto/20081120-1_1.C: New.
+ * g++.dg/lto/20081120-2_0.C: New.
+ * g++.dg/lto/20081120-2_1.C: New.
+ * g++.dg/lto/20081123_0.C: New.
+ * g++.dg/lto/20081123_1.C: New.
+ * g++.dg/lto/20081125.h: New.
+ * g++.dg/lto/20081125_0.C: New.
+ * g++.dg/lto/20081125_1.C: New.
+ * g++.dg/lto/20081127_0.C: New.
+ * g++.dg/lto/20081127_1.C: New.
+ * g++.dg/lto/20081203_0.C: New.
+ * g++.dg/lto/20081203_1.C: New.
+ * g++.dg/lto/20081204-1_0.C: New.
+ * g++.dg/lto/20081204-1_1.C: New.
+ * g++.dg/lto/20081204-2_0.C: New.
+ * g++.dg/lto/20081204-2_1.C: New.
+ * g++.dg/lto/20081209_0.C: New.
+ * g++.dg/lto/20081209_1.C: New.
+ * g++.dg/lto/20081211-1.h: New.
+ * g++.dg/lto/20081211-1_0.C: New.
+ * g++.dg/lto/20081211-1_1.C: New.
+ * g++.dg/lto/20081217-1_0.C: New.
+ * g++.dg/lto/20081217-2_0.C: New.
+ * g++.dg/lto/20081219_0.C: New.
+ * g++.dg/lto/20081219_1.C: New.
+ * g++.dg/lto/20090106_0.C: New.
+ * g++.dg/lto/20090112_0.C: New.
+ * g++.dg/lto/20090128_0.C: New.
+ * g++.dg/lto/20090221_0.C: New.
+ * g++.dg/lto/20090302_0.C: New.
+ * g++.dg/lto/20090302_1.C: New.
+ * g++.dg/lto/20090303_0.C: New.
+ * g++.dg/lto/20090311-1.h: New.
+ * g++.dg/lto/20090311-1_0.C: New.
+ * g++.dg/lto/20090311-1_1.C: New.
+ * g++.dg/lto/20090311_0.C: New.
+ * g++.dg/lto/20090311_1.C: New.
+ * g++.dg/lto/20090312.h: New.
+ * g++.dg/lto/20090312_0.C: New.
+ * g++.dg/lto/20090312_1.C: New.
+ * g++.dg/lto/20090313_0.C: New.
+ * g++.dg/lto/20090313_1.C: New.
+ * g++.dg/lto/20090315_0.C: New.
+ * g++.dg/lto/20090315_1.C: New.
+ * g++.dg/lto/20091002-1_0.C: New testcase.
+ * g++.dg/lto/20091002-2_0.C: Likewise..
+ * g++.dg/lto/20091002-3_0.C: Likewise..
+ * g++.dg/lto/README: New.
+ * g++.dg/lto/pr40818_0.C: New.
+ * g++.dg/opt/thunk3-1.C: New.
+ * g++.dg/opt/thunk4.C: New.
+ * gcc.c-torture/execute/builtins/lib/abs.c: Mark builtin
+ replacements with __attribute__ ((__noinline__)).
+ * gcc.c-torture/execute/builtins/lib/bfill.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/bzero.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/fprintf.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/memchr.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/memcmp.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/memmove.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/mempcpy.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/memset.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/printf.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/sprintf.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/stpcpy.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strcat.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strchr.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strcmp.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strcpy.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strcspn.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strlen.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strncat.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strncmp.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strncpy.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strpbrk.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strrchr.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strspn.c: Likewise.
+ * gcc.c-torture/execute/builtins/lib/strstr.c: Likewise.
+ * gcc.dg/20081223-1.c: New.
+ * gcc.dg/lto: New directory.
+ * gcc.dg/lto/20080908_0.c: New.
+ * gcc.dg/lto/20080917_0.c: New.
+ * gcc.dg/lto/20080924_0.c: New.
+ * gcc.dg/lto/20081024_0.c: New.
+ * gcc.dg/lto/20081109_0.c: New.
+ * gcc.dg/lto/20081111_0.c: New.
+ * gcc.dg/lto/20081111_1.c: New.
+ * gcc.dg/lto/20081112_0.c: New.
+ * gcc.dg/lto/20081112_1.c: New.
+ * gcc.dg/lto/20081115_0.c: New.
+ * gcc.dg/lto/20081115_1.c: New.
+ * gcc.dg/lto/20081115_2.c: New.
+ * gcc.dg/lto/20081118_0.c: New.
+ * gcc.dg/lto/20081118_1.c: New.
+ * gcc.dg/lto/20081118_2.c: New.
+ * gcc.dg/lto/20081120-1_0.c: New.
+ * gcc.dg/lto/20081120-1_1.c: New.
+ * gcc.dg/lto/20081120-2_0.c: New.
+ * gcc.dg/lto/20081120-2_1.c: New.
+ * gcc.dg/lto/20081125_0.c: New.
+ * gcc.dg/lto/20081125_1.c: New.
+ * gcc.dg/lto/20081126_0.c: New.
+ * gcc.dg/lto/20081201-1_0.c: New.
+ * gcc.dg/lto/20081201-1_1.c: New.
+ * gcc.dg/lto/20081201-1_2.c: New.
+ * gcc.dg/lto/20081201-2_0.c: New.
+ * gcc.dg/lto/20081201-2_1.c: New.
+ * gcc.dg/lto/20081202-1_0.c: New.
+ * gcc.dg/lto/20081202-1_1.c: New.
+ * gcc.dg/lto/20081202-2_0.c: New.
+ * gcc.dg/lto/20081202-2_1.c: New.
+ * gcc.dg/lto/20081204-1_0.c: New.
+ * gcc.dg/lto/20081204-1_1.c: New.
+ * gcc.dg/lto/20081204-2_0.c: New.
+ * gcc.dg/lto/20081210-1_0.c: New.
+ * gcc.dg/lto/20081212-1_0.c: New.
+ * gcc.dg/lto/20081222_0.c: New.
+ * gcc.dg/lto/20081222_0.h: New.
+ * gcc.dg/lto/20081222_1.c: New.
+ * gcc.dg/lto/20081224_0.c: New.
+ * gcc.dg/lto/20081224_0.h: New.
+ * gcc.dg/lto/20081224_1.c: New.
+ * gcc.dg/lto/20090116_0.c: New.
+ * gcc.dg/lto/20090120_0.c: New.
+ * gcc.dg/lto/20090126-1_0.c: New.
+ * gcc.dg/lto/20090126-2_0.c: New.
+ * gcc.dg/lto/20090206-1_0.c: New.
+ * gcc.dg/lto/20090206-2_0.c: New.
+ * gcc.dg/lto/20090210_0.c: New.
+ * gcc.dg/lto/20090210_1.c: New.
+ * gcc.dg/lto/20090213_0.c: New.
+ * gcc.dg/lto/20090213_1.c: New.
+ * gcc.dg/lto/20090218-1_0.c: New.
+ * gcc.dg/lto/20090218-1_1.c: New.
+ * gcc.dg/lto/20090218-2_0.c: New.
+ * gcc.dg/lto/20090218-2_1.c: New.
+ * gcc.dg/lto/20090218_0.c: New.
+ * gcc.dg/lto/20090218_1.c: New.
+ * gcc.dg/lto/20090218_2.c: New.
+ * gcc.dg/lto/20090218_3.c: New.
+ * gcc.dg/lto/20090219_0.c: New.
+ * gcc.dg/lto/20090312_0.c: New.
+ * gcc.dg/lto/20090312_1.c: New.
+ * gcc.dg/lto/20090313_0.c: New.
+ * gcc.dg/lto/20090706-1_0.c: New.
+ * gcc.dg/lto/20090706-2_0.c: New.
+ * gcc.dg/lto/20090717_0.c: New.
+ * gcc.dg/lto/20090717_1.c: New.
+ * gcc.dg/lto/20090729_0.c: New.
+ * gcc.dg/lto/20090729_1.c: New.
+ * gcc.dg/lto/20090812_0.c: New.
+ * gcc.dg/lto/20090812_1.c: New.
+ * gcc.dg/lto/20090914-1_0.c: New.
+ * gcc.dg/lto/README: New.
+ * gcc.dg/visibility-7.c: Adjust expected pattern
+ * gfortran.dg/lto: New directory.
+ * gfortran.dg/lto/pr40724_0.f: New.
+ * gfortran.dg/lto/pr40724_1.f: New.
+ * gfortran.dg/lto/pr40725_0.f03: New.
+ * gfortran.dg/lto/pr40725_1.c: New.
+ * gfortran.dg/lto/pr41069_0.f90: New.
+ * gfortran.dg/lto/pr41069_1.f90: New.
+ * gfortran.dg/lto/pr41069_2.f90: New.
+ * g++.dg/README: Add 'lto' directory.
+ * g++.dg/dg.exp: Also scan 'lto' directory
+
+2009-10-03 Ben Elliston <bje@au.ibm.com>
+ Janis Johnson <janis187@us.ibm.com>
+ Diego Novillo <dnovillo@google.com>
+
+ * g++.dg/lto/lto.exp: New.
+ * gcc.c-torture/execute/execute.exp: Add
+ LTO_TORTURE_OPTIONS TO C_TORTURE_OPTIONS.
+ * gcc.c-torture/execute/builtins/builtins.exp: Likewise.
+ * gcc.c-torture/execute/ieee/ieee.exp: Likewise.
+ * gcc.c-torture/unsorted/unsorted.exp: Likewise.
+ * gcc.target/i386/math-torture/math-torture.exp:
+ Likewise.
+ * gcc.dg/lto/lto.exp: New.
+ * gfortran.dg/lto/lto.exp: New.
+ * lib/target-supports.exp (check_effective_target_lto): New.
+ * lib/c-torture.exp: Load target-supports.exp.
+ Define LTO_TORTURE_OPTIONS if check_effective_target_lto
+ returns nonzero.
+ * lib/gcc-dg.exp: Likewise.
+ * lib/lto.exp: New.
+ * lib/torture-options.exp: Add support for a third
+ argument.
+
2009-10-03 Uros Bizjak <ubizjak@gmail.com>
PR testsuite/41542
diff --git a/gcc/testsuite/g++.dg/20090107-1.C b/gcc/testsuite/g++.dg/20090107-1.C
new file mode 100644
index 00000000000..7c50675dbe0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/20090107-1.C
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-fwhopr -Wuninitialized -O1" } */
+
+template <typename T> struct Q1 { typedef int x; };
+template <typename T> struct Q2 {
+ typename Q1<T>::x f() {
+ int k;
+ return k; /* { dg-warning "'k' is used uninitialized in this function" } */
+ }
+};
+int foo() { return Q2<int>().f(); }
diff --git a/gcc/testsuite/g++.dg/20090121-1.C b/gcc/testsuite/g++.dg/20090121-1.C
new file mode 100644
index 00000000000..9dff0f87af3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/20090121-1.C
@@ -0,0 +1,19 @@
+// { dg-do compile }
+// { dg-require-effective-target lto }
+// { dg-options "-fwhopr -Wuninitialized -O2" }
+class A
+{
+private:
+ int y;
+
+public:
+ A () { int x; y = x + 1; } /* { dg-warning "'x' is used uninitialized in this function" } */
+ int get_y () { return y; }
+};
+
+int foo()
+{
+ A a;
+ return a.get_y ();
+}
+
diff --git a/gcc/testsuite/g++.dg/README b/gcc/testsuite/g++.dg/README
index cdf6b14aee6..fe308a54210 100644
--- a/gcc/testsuite/g++.dg/README
+++ b/gcc/testsuite/g++.dg/README
@@ -14,6 +14,7 @@ gcov Tests for GCOV (code coverage) support.
inherit Tests for inheritance -- virtual functions, multiple inheritance, etc.
init Tests for initialization semantics, constructors/destructors, etc.
lookup Tests for lookup semantics, namespaces, using, etc.
+lto Tests for Link Time Optimization.
opt Tests for fixes of bugs with particular optimizations.
overload Tests for overload resolution and conversions.
parse Tests for parsing.
diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp
index af8c1475848..2642da12301 100644
--- a/gcc/testsuite/g++.dg/dg.exp
+++ b/gcc/testsuite/g++.dg/dg.exp
@@ -37,6 +37,7 @@ set tests [prune $tests $srcdir/$subdir/compat/*]
set tests [prune $tests $srcdir/$subdir/debug/*]
set tests [prune $tests $srcdir/$subdir/dfp/*]
set tests [prune $tests $srcdir/$subdir/gcov/*]
+set tests [prune $tests $srcdir/$subdir/lto/*]
set tests [prune $tests $srcdir/$subdir/pch/*]
set tests [prune $tests $srcdir/$subdir/plugin/*]
set tests [prune $tests $srcdir/$subdir/special/*]
diff --git a/gcc/testsuite/g++.dg/ipa/20090113-1.C b/gcc/testsuite/g++.dg/ipa/20090113-1.C
new file mode 100644
index 00000000000..3f371257e57
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/20090113-1.C
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+struct S1 {
+ S1() { }
+};
+
+struct S2 {
+ int n;
+ S1* p;
+ void f() {
+ p = new S1[n = 1];
+ }
+};
+
+struct S3 {
+ S2 s2;
+ void g() {
+ s2.f();
+ }
+};
+
+void h() {
+ S3().g();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080709_0.C b/gcc/testsuite/g++.dg/lto/20080709_0.C
new file mode 100644
index 00000000000..55ae8c9ec2c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080709_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do run }
+
+class Init {
+};
+
+int f(Init *a) {
+}
+
+int main(void){
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080829_0.C b/gcc/testsuite/g++.dg/lto/20080829_0.C
new file mode 100644
index 00000000000..0890cf66d3b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080829_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do assemble }
+
+/* The replacement of cos+sin with __builtin_cexpi done by
+ pass_cse_sincos was using a builtin for which we had no attributes.
+ This was causing the operand scanner to materialize a VDEF at the
+ builtin call-site which was not marked for renaming, thus tripping
+ up the SSA verifier. */
+extern "C" { extern double cos (double); extern double sin (double); }
+double func(double &in) { return cos(in) + sin(in); }
diff --git a/gcc/testsuite/g++.dg/lto/20080904_0.C b/gcc/testsuite/g++.dg/lto/20080904_0.C
new file mode 100644
index 00000000000..0161a00be7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080904_0.C
@@ -0,0 +1,37 @@
+// { dg-lto-do run }
+
+/* This test will fail to link if the vtable for Derived is not emitted. */
+
+class Base {
+public:
+ Base(char *buf, unsigned len)
+ : _buf(buf),
+ _len(len)
+ {}
+
+ virtual int length () { return _len; }
+
+private:
+ char * _buf;
+ unsigned _len;
+};
+
+class Derived : public Base {
+public:
+ Derived(char *buf, unsigned len)
+ : Base(buf, len),
+ _ctr(len)
+ {}
+
+ virtual int length () { return _ctr; }
+
+private:
+ unsigned _ctr;
+};
+
+int main ()
+{
+ Derived *d = new Derived (new char[256], 256);
+
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080907_0.C b/gcc/testsuite/g++.dg/lto/20080907_0.C
new file mode 100644
index 00000000000..9a4552310d9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080907_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+struct Foo { void func (); }; Foo & bar () { } struct Baz { Baz (Baz &); };
+Baz dummy() { bar().func(); }
diff --git a/gcc/testsuite/g++.dg/lto/20080908-1_0.C b/gcc/testsuite/g++.dg/lto/20080908-1_0.C
new file mode 100644
index 00000000000..8b761c0844c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-1_0.C
@@ -0,0 +1,36 @@
+/* { dg-lto-do run } */
+extern "C" { extern void *memcpy (void *, const void *, unsigned); }
+
+inline int
+bci (const float &source)
+{
+ int dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+inline float
+bcf (const int &source)
+{
+ float dest;
+ memcpy (&dest, &source, sizeof (dest));
+ return dest;
+}
+
+float
+Foo ()
+{
+ const int foo = bci (0.0f);
+ int bar = foo;
+ const int baz = foo & 1;
+ if (!baz && (foo & 2))
+ bar = 0;
+ return bcf (bar);
+}
+
+int main ()
+{
+ if (Foo () != 0.0)
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080908-2_0.C b/gcc/testsuite/g++.dg/lto/20080908-2_0.C
new file mode 100644
index 00000000000..7042b3d08d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-2_0.C
@@ -0,0 +1,3 @@
+/* { dg-lto-do assemble } */
+struct Foo { double x[3]; };
+Foo func() { Foo f = { { 0, 0, 0 } }; return f; }
diff --git a/gcc/testsuite/g++.dg/lto/20080908-3_0.C b/gcc/testsuite/g++.dg/lto/20080908-3_0.C
new file mode 100644
index 00000000000..b7e0e1b0271
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080908-3_0.C
@@ -0,0 +1,14 @@
+/* { dg-lto-do run } */
+
+int foo()
+{
+ double bar, baz = -__builtin_huge_val();
+ return baz <= -bar;
+}
+
+int main()
+{
+ if (foo () != 1)
+ return 1;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080909-1_0.C b/gcc/testsuite/g++.dg/lto/20080909-1_0.C
new file mode 100644
index 00000000000..245ca58f308
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080909-1_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto}} }
+int *i = (int[]) {0};
diff --git a/gcc/testsuite/g++.dg/lto/20080910-1_0.C b/gcc/testsuite/g++.dg/lto/20080910-1_0.C
new file mode 100644
index 00000000000..48e9e5d15cb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080910-1_0.C
@@ -0,0 +1,2 @@
+// { dg-lto-do assemble }
+struct Foo { Foo(int); }; void func() { new Foo(0); }
diff --git a/gcc/testsuite/g++.dg/lto/20080912-1_0.C b/gcc/testsuite/g++.dg/lto/20080912-1_0.C
new file mode 100644
index 00000000000..ebead90e03a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080912-1_0.C
@@ -0,0 +1,3 @@
+// { dg-lto-do assemble }
+struct Foo { double x[3]; };
+Foo func() { Foo f = { { 0, 0, 0 } }; return f; }
diff --git a/gcc/testsuite/g++.dg/lto/20080912_0.C b/gcc/testsuite/g++.dg/lto/20080912_0.C
new file mode 100644
index 00000000000..7b3039fbf8d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080912_0.C
@@ -0,0 +1,4 @@
+// { dg-lto-do assemble }
+class Foo { virtual void f(); };
+class Bar:public Foo { };
+void func() { Bar(); }
diff --git a/gcc/testsuite/g++.dg/lto/20080915_0.C b/gcc/testsuite/g++.dg/lto/20080915_0.C
new file mode 100644
index 00000000000..3789765a964
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080915_0.C
@@ -0,0 +1,29 @@
+// { dg-lto-do assemble }
+struct Foo {
+ static const int dummy;
+
+ int bit_field:1;
+ int dummy2:1;
+ int dummy3:1;
+};
+
+struct Bar {
+ Foo foo;
+};
+
+int func(const Bar& b) {
+ return b.foo.bit_field;
+}
+
+struct Baz {
+ Bar& operator*() {}
+};
+
+void func1(Baz baz, int i, Bar bar) {
+ i || func(bar);
+ *baz = bar;
+}
+
+void func2(Baz baz, Bar bar) {
+ func1(baz, 0, bar);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080916_0.C b/gcc/testsuite/g++.dg/lto/20080916_0.C
new file mode 100644
index 00000000000..3c900cd43b5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080916_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do assemble } */
+
+enum _Ios_Fmtflags {
+ _S_boolalpha };
+
+class ios_base {
+ static const _Ios_Fmtflags boolalpha = _S_boolalpha;
+ _Ios_Fmtflags _M_flags;
+};
+
+ios_base& g() {
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080917_0.C b/gcc/testsuite/g++.dg/lto/20080917_0.C
new file mode 100644
index 00000000000..2f4f33bd0e9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080917_0.C
@@ -0,0 +1,29 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -funsigned-char}} }
+int
+foo (char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
+
+int
+baz (const char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080924_0.C b/gcc/testsuite/g++.dg/lto/20080924_0.C
new file mode 100644
index 00000000000..b1e381351bb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080924_0.C
@@ -0,0 +1,16 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} }
+
+namespace ns
+{
+ template <class> class hash_set { };
+}
+
+struct Foo
+{
+ long long f1, f2, f3;
+};
+
+void func(ns::hash_set<int>) {
+ Foo foo = { 0, 0, 0 };
+}
diff --git a/gcc/testsuite/g++.dg/lto/20080926_0.C b/gcc/testsuite/g++.dg/lto/20080926_0.C
new file mode 100644
index 00000000000..d6a7bbffc70
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20080926_0.C
@@ -0,0 +1,4 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-O2 -flto -fno-strict-aliasing}} }
+extern int foo();
+void bar() { try { int i = foo(); } catch(int) { } }
diff --git a/gcc/testsuite/g++.dg/lto/20081008_0.C b/gcc/testsuite/g++.dg/lto/20081008_0.C
new file mode 100644
index 00000000000..258265a4fe1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081008_0.C
@@ -0,0 +1,36 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-flto}} }
+
+struct Foo
+{
+ virtual void func() = 0;
+};
+
+struct Bar
+{
+ Foo *field;
+ void func2();
+};
+
+struct Baz
+{
+ Bar &bar();
+ Baz();
+};
+
+struct Zonk
+{
+ virtual ~Zonk() {
+ }
+ virtual void func3() = 0;
+};
+
+void Mumble(Zonk *) {
+}
+
+extern "C"
+{
+ void __attribute__ ((nothrow)) __cxa_pure_virtual() {
+ Baz().bar().func2();
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081022.h b/gcc/testsuite/g++.dg/lto/20081022.h
new file mode 100644
index 00000000000..bccd2ad7b68
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022.h
@@ -0,0 +1,8 @@
+class foo
+{
+public:
+ int bar ()
+ {
+ return 0;
+ }
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081022_0.C b/gcc/testsuite/g++.dg/lto/20081022_0.C
new file mode 100644
index 00000000000..219f92d6a96
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022_0.C
@@ -0,0 +1,11 @@
+#include "20081022.h"
+
+int
+f (foo * a)
+{
+ return a->bar ();
+}
+
+main()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081022_1.C b/gcc/testsuite/g++.dg/lto/20081022_1.C
new file mode 100644
index 00000000000..94c5aecfd6b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081022_1.C
@@ -0,0 +1,7 @@
+#include "20081022.h"
+
+int
+g (foo * a)
+{
+ return a->bar ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081023_0.C b/gcc/testsuite/g++.dg/lto/20081023_0.C
new file mode 100644
index 00000000000..ab3fc36f386
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081023_0.C
@@ -0,0 +1,14 @@
+// { dg-lto-do link }
+extern inline void __attribute__ ((__always_inline__)) func (void)
+{
+}
+
+void
+f (void)
+{
+ func ();
+}
+
+main()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109-1_0.C b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
new file mode 100644
index 00000000000..243f0ed7246
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109-1_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -fwhopr}} }
+// { dg-extra-ld-options "-fPIC -fwhopr -shared -fno-exceptions" }
+void func(); class Foo { };
+void bar() { try { func(); } catch (Foo) { } };
diff --git a/gcc/testsuite/g++.dg/lto/20081109-2_0.C b/gcc/testsuite/g++.dg/lto/20081109-2_0.C
new file mode 100644
index 00000000000..dc43286bf36
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109-2_0.C
@@ -0,0 +1,15 @@
+/* { dg-lto-do assemble } */
+extern void func(int);
+
+struct Foo
+{
+ void bar() {
+ static int local;
+ func(local);
+ }
+ void baz();
+};
+
+void Foo::baz() {
+ bar();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109_0.C b/gcc/testsuite/g++.dg/lto/20081109_0.C
new file mode 100644
index 00000000000..93cfc67fff2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109_0.C
@@ -0,0 +1,28 @@
+extern "C" { void abort (void);}
+int foo (int);
+
+class A
+{
+ int x;
+
+public:
+ A() { x = 2304; }
+ ~A() { if (x != 2305) abort (); }
+ void inc () { x++; }
+};
+
+
+int main()
+{
+ A x;
+ x.inc();
+ try
+ {
+ foo (0);
+ abort (); // Should not execute
+ }
+ catch (int e)
+ {
+ return 0;
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081109_1.C b/gcc/testsuite/g++.dg/lto/20081109_1.C
new file mode 100644
index 00000000000..3395e135501
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081109_1.C
@@ -0,0 +1,4 @@
+int foo (int x)
+{
+ throw 10;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_0.C b/gcc/testsuite/g++.dg/lto/20081118-1_0.C
new file mode 100644
index 00000000000..99e024f9e51
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118-1_0.C
@@ -0,0 +1,27 @@
+/* { dg-lto-do link } */
+
+class C {
+ public:
+ C();
+ virtual ~C();
+ virtual void foo();
+};
+void bar() {
+ new C();
+}
+
+C::C() {
+
+}
+
+C::~C() {
+
+}
+
+void C::foo() {
+}
+
+int main(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118-1_1.C b/gcc/testsuite/g++.dg/lto/20081118-1_1.C
new file mode 100644
index 00000000000..fc654fe9199
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118-1_1.C
@@ -0,0 +1,12 @@
+class C {
+ public:
+ C();
+ virtual ~C();
+ virtual void foo();
+};
+class D {
+ ~D();
+ C lexer_;
+};
+D::~D() {
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118_0.C b/gcc/testsuite/g++.dg/lto/20081118_0.C
new file mode 100644
index 00000000000..cbac06a4747
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118_0.C
@@ -0,0 +1,20 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
+
+/* We used to ICE because of dangling pointers. */
+
+class object
+{
+public:
+ virtual ~object() {}
+};
+
+class foo : public object
+{
+ virtual int method(void);
+};
+
+int
+foo::method(void)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081118_1.C b/gcc/testsuite/g++.dg/lto/20081118_1.C
new file mode 100644
index 00000000000..b9e56a48b9b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081118_1.C
@@ -0,0 +1,20 @@
+class object {
+ virtual ~object() {}
+};
+
+class bar : public object
+{
+ static bar *method(void);
+};
+
+class quxx : public bar
+{
+ public:
+ static void method();
+};
+
+bar*
+bar::method (void)
+{
+ quxx::method();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1.h b/gcc/testsuite/g++.dg/lto/20081119-1.h
new file mode 100644
index 00000000000..be193581dcd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1.h
@@ -0,0 +1,8 @@
+namespace __gnu_cxx
+{
+ template < typename _Tp > class new_allocator
+ {
+ public:
+ unsigned max_size () const throw ();
+ };
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_0.C b/gcc/testsuite/g++.dg/lto/20081119-1_0.C
new file mode 100644
index 00000000000..d38fca3d44d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1_0.C
@@ -0,0 +1,12 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
+
+#include "20081119-1.h"
+
+extern __gnu_cxx::new_allocator<int> X;
+
+int
+f (__gnu_cxx::new_allocator<int> * a)
+{
+ return a->max_size () + X.max_size();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119-1_1.C b/gcc/testsuite/g++.dg/lto/20081119-1_1.C
new file mode 100644
index 00000000000..c2ba78d6ed7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119-1_1.C
@@ -0,0 +1,9 @@
+#include "20081119-1.h"
+
+__gnu_cxx::new_allocator<int> X;
+
+int
+f (__gnu_cxx::new_allocator<int> a)
+{
+ return a.max_size ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119_0.C b/gcc/testsuite/g++.dg/lto/20081119_0.C
new file mode 100644
index 00000000000..c77a4309811
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119_0.C
@@ -0,0 +1,24 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f1 (bar<int> *p)
+{
+ p->m();
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081119_1.C b/gcc/testsuite/g++.dg/lto/20081119_1.C
new file mode 100644
index 00000000000..71a2a5c0242
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081119_1.C
@@ -0,0 +1,18 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo() {}
+ virtual void m() {}
+};
+
+template<typename t>
+class bar : public foo {
+ public:
+ bar () {}
+};
+
+void
+f2 (bar<int> *p)
+{
+ p->m();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_0.C b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
new file mode 100644
index 00000000000..3cb97538945
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -shared}} }
+extern "C"
+{
+ extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
+ {
+ }
+}
+static __typeof(pthread_equal)
+ __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal")));
diff --git a/gcc/testsuite/g++.dg/lto/20081120-1_1.C b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
new file mode 100644
index 00000000000..e7e24a58b76
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-1_1.C
@@ -0,0 +1,8 @@
+extern "C"
+{
+ extern __inline __attribute__((__gnu_inline__)) int pthread_equal(int, int)
+ {
+ }
+}
+static __typeof(pthread_equal)
+ __gthrw_pthread_equal __attribute__((__weakref__("pthread_equal")));
diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_0.C b/gcc/testsuite/g++.dg/lto/20081120-2_0.C
new file mode 100644
index 00000000000..d4e4cd43cc5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-2_0.C
@@ -0,0 +1,13 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-flto -shared}} }
+template < typename > struct Foo
+{
+ inline void rdstate() {
+ }
+};
+
+extern template struct Foo<int>;
+
+struct Bar:virtual public Foo<int>
+{
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081120-2_1.C b/gcc/testsuite/g++.dg/lto/20081120-2_1.C
new file mode 100644
index 00000000000..242d50a41ce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081120-2_1.C
@@ -0,0 +1,11 @@
+template < typename > struct Foo
+{
+ inline void rdstate() {
+ }
+};
+
+extern template struct Foo<int>;
+
+struct Bar:virtual public Foo<int>
+{
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081123_0.C b/gcc/testsuite/g++.dg/lto/20081123_0.C
new file mode 100644
index 00000000000..2b182a95e42
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081123_0.C
@@ -0,0 +1,8 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fwhopr -shared -fPIC}} }
+
+int
+f(void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081123_1.C b/gcc/testsuite/g++.dg/lto/20081123_1.C
new file mode 100644
index 00000000000..aef512e8e4d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081123_1.C
@@ -0,0 +1,16 @@
+struct foo {
+ const int* int_array;
+ const void* default_instance;
+};
+struct bar {
+ static const bar& _default_instance;
+ static const foo _internal_foo;
+};
+struct quxx {
+ static int trouble[];
+};
+int quxx::trouble[] = { };
+const foo bar::_internal_foo = {
+ quxx::trouble,
+ &bar::_default_instance
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081125.h b/gcc/testsuite/g++.dg/lto/20081125.h
new file mode 100644
index 00000000000..bc470040a67
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125.h
@@ -0,0 +1,15 @@
+class base
+{
+ public:
+ base() {}
+ virtual ~base() {}
+ static base *factory (void);
+};
+
+class object : public base
+{
+ public:
+ object() {}
+ object (int);
+ virtual void key_method (void);
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081125_0.C b/gcc/testsuite/g++.dg/lto/20081125_0.C
new file mode 100644
index 00000000000..ade9744946d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125_0.C
@@ -0,0 +1,18 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fwhopr}} }
+#include "20081125.h"
+
+object::object (int x)
+{
+}
+
+void
+object::key_method (void)
+{
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081125_1.C b/gcc/testsuite/g++.dg/lto/20081125_1.C
new file mode 100644
index 00000000000..d52b9edcada
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081125_1.C
@@ -0,0 +1,7 @@
+#include "20081125.h"
+
+base *
+base::factory(void)
+{
+ return new object ();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081127_0.C b/gcc/testsuite/g++.dg/lto/20081127_0.C
new file mode 100644
index 00000000000..a5200ff4bea
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081127_0.C
@@ -0,0 +1,2 @@
+struct Foo { Foo(); };
+static void func() { new Foo(); }
diff --git a/gcc/testsuite/g++.dg/lto/20081127_1.C b/gcc/testsuite/g++.dg/lto/20081127_1.C
new file mode 100644
index 00000000000..6488ac8d797
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081127_1.C
@@ -0,0 +1,3 @@
+struct Foo { Foo(); };
+Foo::Foo() { }
+main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20081203_0.C b/gcc/testsuite/g++.dg/lto/20081203_0.C
new file mode 100644
index 00000000000..e92d89a4c3b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081203_0.C
@@ -0,0 +1,5 @@
+extern void f();
+extern void g();
+struct Foo { static inline void Bar() { f(); } };
+static void Func() { Foo::Bar(); }
+int main() { g (); Func(); return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20081203_1.C b/gcc/testsuite/g++.dg/lto/20081203_1.C
new file mode 100644
index 00000000000..83de109eaa9
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081203_1.C
@@ -0,0 +1,4 @@
+void f () {}
+struct Foo { static inline void Bar() { f(); } };
+static void Func() { Foo::Bar(); }
+void g () { Func (); }
diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_0.C b/gcc/testsuite/g++.dg/lto/20081204-1_0.C
new file mode 100644
index 00000000000..8c625f51e47
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-1_0.C
@@ -0,0 +1,14 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fwhopr -fPIC -shared}} } */
+
+/* Tests for the absence during linking of:
+ lto1: error: type of '_ZTVN10__cxxabiv120__si_class_type_infoE' does
+ not match original declaration */
+
+struct Foo { virtual ~Foo(); };
+namespace __cxxabiv1
+{
+ struct __si_class_type_info: public Foo { };
+ struct Baz: public Foo { virtual void Func(); };
+ void Baz::Func() { }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081204-1_1.C b/gcc/testsuite/g++.dg/lto/20081204-1_1.C
new file mode 100644
index 00000000000..20627b5c54d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-1_1.C
@@ -0,0 +1,3 @@
+struct Foo { virtual ~Foo(); };
+struct Bar:public Foo { Bar() { } };
+void Func() { new Bar(); }
diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_0.C b/gcc/testsuite/g++.dg/lto/20081204-2_0.C
new file mode 100644
index 00000000000..dfae081bfa1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-2_0.C
@@ -0,0 +1,10 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fwhopr -O3}} }
+extern void foo (void);
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081204-2_1.C b/gcc/testsuite/g++.dg/lto/20081204-2_1.C
new file mode 100644
index 00000000000..676b9b27d63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081204-2_1.C
@@ -0,0 +1,14 @@
+namespace {
+class c
+{
+ public:
+ c () {}
+ virtual ~c() {}
+};
+};
+
+void
+foo (void)
+{
+ c x;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081209_0.C b/gcc/testsuite/g++.dg/lto/20081209_0.C
new file mode 100644
index 00000000000..3744a9ac42a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081209_0.C
@@ -0,0 +1,18 @@
+/* { dg-lto-do link } */
+
+class foo {
+ public:
+ foo ();
+ virtual ~foo ();
+};
+
+foo::foo ()
+{
+}
+
+int
+main ()
+{
+ foo dummy;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081209_1.C b/gcc/testsuite/g++.dg/lto/20081209_1.C
new file mode 100644
index 00000000000..83eee3e46e8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081209_1.C
@@ -0,0 +1,9 @@
+class foo {
+ public:
+ foo ();
+ virtual ~foo ();
+};
+
+foo::~foo ()
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1.h b/gcc/testsuite/g++.dg/lto/20081211-1.h
new file mode 100644
index 00000000000..f9a8ca7550d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1.h
@@ -0,0 +1,6 @@
+class foo {
+ public:
+ foo () {}
+ virtual ~foo () {}
+ virtual void key_method (void);
+};
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_0.C b/gcc/testsuite/g++.dg/lto/20081211-1_0.C
new file mode 100644
index 00000000000..89c06acf53a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1_0.C
@@ -0,0 +1,19 @@
+#include "20081211-1.h"
+
+foo *
+create_foo (void)
+{
+ return new foo;
+}
+
+void
+destroy_foo (foo *p)
+{
+ delete p;
+}
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081211-1_1.C b/gcc/testsuite/g++.dg/lto/20081211-1_1.C
new file mode 100644
index 00000000000..124d69a7cce
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081211-1_1.C
@@ -0,0 +1,6 @@
+#include "20081211-1.h"
+
+void
+foo::key_method (void)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081217-1_0.C b/gcc/testsuite/g++.dg/lto/20081217-1_0.C
new file mode 100644
index 00000000000..c91872bd2db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081217-1_0.C
@@ -0,0 +1,28 @@
+class base1
+{
+ public:
+ base1 () {}
+ virtual ~base1 () {}
+};
+
+class base2
+{
+ public:
+ base2 () {}
+ virtual ~base2 () {}
+};
+
+class mi_class : public base1, base2
+{
+ public:
+ mi_class () {}
+ ~mi_class () {}
+};
+
+mi_class dummy;
+
+int
+main ()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081217-2_0.C b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
new file mode 100644
index 00000000000..a47b0b5781b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081217-2_0.C
@@ -0,0 +1,20 @@
+struct A {
+ virtual int foo() {}
+};
+struct B {
+ virtual int f() {return 1; }
+};
+struct C : public A, public B {
+ C();
+ virtual int f() { return 0; }
+};
+
+C::C()
+{
+}
+
+main()
+{
+ C c;
+ return c.f();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081219_0.C b/gcc/testsuite/g++.dg/lto/20081219_0.C
new file mode 100644
index 00000000000..29ad575d0a7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081219_0.C
@@ -0,0 +1,72 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC -fwhopr -O2}} }
+// { dg-extra-ld-options "-O2 -fPIC -fwhopr -shared" }
+
+typedef long int ptrdiff_t;
+extern "C"
+{
+ typedef struct
+ {
+ }
+ __mbstate_t;
+ namespace std
+ {
+ class exception
+ {
+ };
+ }
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _Alloc > class allocator;
+ template < class _CharT > struct char_traits;
+}
+typedef __mbstate_t mbstate_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::mbstate_t;
+ typedef ptrdiff_t streamsize;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT > >class basic_istream;
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT >, typename _Alloc =
+ allocator < _CharT > >class basic_stringbuf;
+ class ios_base
+ {
+ public:class failure:public exception
+ {
+ };
+ virtual ~ ios_base ();
+ };
+ template < typename _CharT, typename _Traits > class basic_streambuf
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_ios:public
+ ios_base
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_istream:virtual public basic_ios < _CharT,
+ _Traits
+ >
+ {
+ typedef basic_streambuf < _CharT, _Traits > __streambuf_type;
+ protected:streamsize _M_gcount;
+ public: explicit basic_istream (__streambuf_type * __sb):_M_gcount (streamsize
+ (0))
+ {
+ }
+ };
+template < typename _CharT, typename _Traits, typename _Alloc > class basic_stringbuf:public basic_streambuf < _CharT,
+ _Traits
+ >
+ {
+ };
+ template < typename V, typename I, typename S = std::mbstate_t > struct character
+ {
+ };
+ typedef character < unsigned short, unsigned int >pod_ushort;
+ typedef basic_stringbuf < pod_ushort > stringbuf_type;
+ typedef basic_istream < pod_ushort > istream_type;
+ stringbuf_type strbuf01;
+ istream_type stream (&strbuf01);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20081219_1.C b/gcc/testsuite/g++.dg/lto/20081219_1.C
new file mode 100644
index 00000000000..1bb96ef37de
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20081219_1.C
@@ -0,0 +1,42 @@
+typedef struct
+{
+}
+__mbstate_t;
+typedef __mbstate_t mbstate_t;
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ using::mbstate_t;
+ typedef int *__c_locale;
+ class locale
+ {
+ class facet;
+ };
+ class locale::facet
+ {
+ };
+template < typename _CharT > class numpunct:public locale::facet
+ {
+ void _M_initialize_numpunct (__c_locale __cloc = __null);
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default")))
+{
+ template < typename V, typename I, typename S = std::mbstate_t > struct character
+ {
+ };
+}
+
+namespace __gnu_test
+{
+ using __gnu_cxx::character;
+ typedef character < unsigned short, unsigned int >pod_ushort;
+}
+namespace std
+{
+ using __gnu_test::pod_ushort;
+ template <> void numpunct <
+ pod_ushort >::_M_initialize_numpunct (__c_locale)
+ {
+ pod_ushort *__truename = new pod_ushort[4 + 1];
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090106_0.C b/gcc/testsuite/g++.dg/lto/20090106_0.C
new file mode 100644
index 00000000000..8c4d3952ef2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090106_0.C
@@ -0,0 +1,203 @@
+// { dg-lto-do link }
+typedef long unsigned int size_t;
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ using ::size_t;
+ template<typename _Tp>
+ struct __is_char
+ {
+ };
+# 422 "/usr/include/c++/4.4.0/bits/cpp_type_traits.h" 3
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<bool, typename>
+ struct __enable_if
+ {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<class _T1, class _T2>
+ struct pair
+ {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp>
+ class new_allocator
+ {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template<typename _Tp>
+ class allocator: public __gnu_cxx::new_allocator<_Tp>
+ {
+ };
+ template<typename _Arg1, typename _Arg2, typename _Result>
+ struct binary_function
+ {
+ };
+ template<typename _Tp>
+ struct less : public binary_function<_Tp, _Tp, bool>
+ {
+ };
+ template<typename _CharT>
+ struct char_traits
+ {
+ typedef _CharT char_type;
+ static std::size_t
+ length(const char_type* __s);
+ };
+ template<typename _CharT>
+ std::size_t
+ char_traits<_CharT>::
+ length(const char_type* __p)
+ {
+ }
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class basic_string
+ {
+ };
+}
+namespace __gnu_cxx __attribute__ ((__visibility__ ("default"))) {
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __versa_string;
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ struct __vstring_utility
+ {
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ class __rc_string_base
+ {
+ typedef __vstring_utility<_CharT, _Traits, _Alloc> _Util_Base;
+ typedef typename _Util_Base::_CharT_alloc_type _CharT_alloc_type;
+ typedef typename _CharT_alloc_type::size_type size_type;
+ struct _Rep
+ {
+ union
+ {
+ };
+ static _Rep*
+ _S_create(size_type, size_type, const _Alloc&);
+ };
+ };
+ template<typename _CharT, typename _Traits, typename _Alloc>
+ typename __rc_string_base<_CharT, _Traits, _Alloc>::_Rep*
+ __rc_string_base<_CharT, _Traits, _Alloc>::_Rep::
+ _S_create(size_type __capacity, size_type __old_capacity,
+ const _Alloc& __alloc)
+ {
+ };
+}
+template<typename _CharT, typename _Traits = std::char_traits<_CharT>,
+ typename _Alloc = std::allocator<_CharT> >
+class basic_string
+ : public __gnu_cxx::__versa_string<_CharT, _Traits, _Alloc> {
+};
+template<typename _CharT, typename _Traits, typename _Alloc>
+ operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
+ const std::basic_string<_CharT, _Traits, _Alloc>& __rhs)
+ {
+}
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ struct __uninitialized_copy
+ {
+ template<typename _InputIterator, typename _ForwardIterator>
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ }
+ };
+ template<typename _InputIterator, typename _ForwardIterator>
+ uninitialized_copy(_InputIterator __first, _InputIterator __last,
+ _ForwardIterator __result)
+ {
+ }
+ class locale
+ {
+ class facet;
+ };
+ class locale::facet
+ {
+ };
+ class ios_base
+ {
+ template<typename _CharT2>
+ friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value,
+ istreambuf_iterator<_CharT2> >::__type
+ find(istreambuf_iterator<_CharT2>, istreambuf_iterator<_CharT2>,
+ const _CharT2&);
+ };
+ template<typename _CharT, typename _OutIter>
+ class num_put : public locale::facet
+ {
+ typedef _CharT char_type;
+ typedef _OutIter iter_type;
+ template<typename _ValueT>
+ iter_type
+ _M_insert_float(iter_type, ios_base& __io, char_type __fill,
+ char __mod, _ValueT __v) const;
+ };
+ template<typename _CharT, typename _OutIter>
+ template<typename _ValueT>
+ _OutIter
+ num_put<_CharT, _OutIter>::
+ _M_insert_float(_OutIter __s, ios_base& __io, _CharT __fill, char __mod,
+ _ValueT __v) const
+ {
+ }
+ template<typename _CharT, typename _OutIter>
+ class basic_ios : public ios_base
+ {
+ };
+ template<typename _CharT, typename _Traits>
+ class basic_istream : virtual public basic_ios<_CharT, _Traits>
+ {
+ typedef basic_istream<_CharT, _Traits> __istream_type;
+ template<typename _ValueT>
+ __istream_type&
+ _M_extract(_ValueT& __v);
+ };
+ template<typename _CharT, typename _Traits>
+ template<typename _ValueT>
+ basic_istream<_CharT, _Traits>&
+ basic_istream<_CharT, _Traits>::
+ _M_extract(_ValueT& __v)
+ {
+ }
+ class hash_map
+ {
+ };
+}
+class CDE {
+ public:
+ virtual ~CDE() { }
+};
+namespace std __attribute__ ((__visibility__ ("default"))) {
+ template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
+ typename _Alloc = std::allocator<std::pair<const _Key, _Tp> > >
+ class map
+ {
+ };
+ template<typename _Key, typename _Tp, typename _Compare, typename _Alloc>
+ operator==(const map<_Key, _Tp, _Compare, _Alloc>& __x,
+ const map<_Key, _Tp, _Compare, _Alloc>& __y)
+ { return !(__x < __y); }
+}
+namespace xyz {
+class XYZ;
+};
+class ABC {
+ public:
+ virtual ~ABC() { }
+};
+class FGH : public CDE, public ABC {
+ public:
+ explicit FGH(CDE* efg);
+};
+namespace {
+class LMN : public FGH {
+ LMN(CDE* efg, xyz::XYZ* hij) : FGH(efg) { }
+};
+}
+main(){}
diff --git a/gcc/testsuite/g++.dg/lto/20090112_0.C b/gcc/testsuite/g++.dg/lto/20090112_0.C
new file mode 100644
index 00000000000..b9dc24bc1bc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090112_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do run }
+const char *func(int val) {
+ switch (val) {
+ case 2147483647: return "foo";
+ default: return "";
+ }
+}
+
+int main() {
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090128_0.C b/gcc/testsuite/g++.dg/lto/20090128_0.C
new file mode 100644
index 00000000000..24ff5970c12
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090128_0.C
@@ -0,0 +1,88 @@
+// { dg-lto-do assemble }
+// { dg-lto-options {{-fpreprocessed -O2 -fwhopr -funsigned-char}} }
+typedef unsigned char uint8;
+extern const uint8 array[256];
+static inline bool
+g (unsigned char c)
+{
+ return array[c] & 0x80;
+}
+
+class Class1
+{
+ static bool f1 (char **dst, const char *end, char c);
+ static bool f2 (const char *map, const char **src, char **dst,
+ const char *end);
+ static bool f3 (const char *src, char *dst, const char *end);
+};
+
+enum JTipL
+{
+ KXHR8 = 0, KXNU3, KX_HASH, KXYYZ, KXFI9, KXX3, KXAFA, KXV4Z, KXZ11,
+};
+
+static const char
+ p9t42[256] = { KXYYZ, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KX_HASH, KXAFA,
+ KXFI9, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXV4Z, KXAFA, KXAFA,
+ KXAFA, KXV4Z, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXHR8, KXX3, KXV4Z, KXX3, KXNU3,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXX3, KXX3, KXX3, KXX3, KXAFA, KXX3, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA, KXAFA,
+ KXAFA, KXAFA, KXAFA, KXAFA, KXX3, KXX3, KXX3, KXAFA, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+ KXX3, KXX3, KXX3, KXX3, KXX3, KXX3, KXX3,
+};
+
+inline bool
+Class1::f2 (const char *map, const char **src, char **dst,
+ const char *end)
+{
+ if (g ((*src)[1]) && g ((*src)[2]))
+ {
+ char c = (static_cast < unsigned char >((*src)[1])) & 0xf;
+ if (map[c] == KXAFA)
+ {
+ }
+ else if (f1 (dst, end, c))
+ {
+ }
+ }
+ return true;
+}
+
+bool
+Class1::f3 (const char *src, char *dst, const char *end)
+{
+ while (dst < end)
+ {
+ char c = *src;
+ char m = p9t42[c];
+ switch (m)
+ {
+ case KXYYZ:
+ *dst = '\0';
+ case KXFI9:
+ if (!f2 (p9t42, &src, &dst, end))
+ ;
+ }
+ }
+ return false;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090221_0.C b/gcc/testsuite/g++.dg/lto/20090221_0.C
new file mode 100644
index 00000000000..5bf031906c7
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090221_0.C
@@ -0,0 +1,53 @@
+// { dg-lto-do assemble }
+extern void some_function (const char *);
+extern bool some_other_function ();
+
+struct Foo
+{
+ long long a;
+ int b;
+};
+
+bool Foo_eq(Foo x, Foo y)
+{
+ return x.a == y.a && x.b == y.b;
+}
+
+struct Bar
+{
+ Foo a;
+ int b;
+};
+
+struct Baz
+{
+ Bar a;
+ Baz(Bar &a):a(a) { }
+};
+
+struct Zonk
+{
+ Baz baz;
+
+ Bar func_1(const Bar & bar) {
+ if (Foo_eq(bar.a, baz.a.a) && bar.b == baz.a.b || some_other_function ())
+ return bar;
+ }
+
+ void func_2(const Baz & baz) {
+ func_1(baz.a);
+ some_function(__PRETTY_FUNCTION__);
+ }
+};
+
+void func() {
+ Bar bar;
+ Zonk *rep;
+ rep->func_1(bar);
+ rep->func_2(Baz(bar));
+}
+
+void foo ()
+{
+ func();
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090302_0.C b/gcc/testsuite/g++.dg/lto/20090302_0.C
new file mode 100644
index 00000000000..c71e062f319
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090302_0.C
@@ -0,0 +1,9 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -fwhopr -shared}} } */
+struct Foo {
+ bool Mumble();
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+void Unused() { Foo::Bar(); Foo::Baz(); }
diff --git a/gcc/testsuite/g++.dg/lto/20090302_1.C b/gcc/testsuite/g++.dg/lto/20090302_1.C
new file mode 100644
index 00000000000..0ccaf3c8205
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090302_1.C
@@ -0,0 +1,7 @@
+struct Foo {
+ bool Mumble();
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+Foo *Foo::foo_;
diff --git a/gcc/testsuite/g++.dg/lto/20090303_0.C b/gcc/testsuite/g++.dg/lto/20090303_0.C
new file mode 100644
index 00000000000..f6d5512e123
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090303_0.C
@@ -0,0 +1,22 @@
+/* { dg-lto-do run } */
+/* { dg-lto-options {{-fwhopr -fPIC}} } */
+/* { dg-suppress-ld-options {-fPIC} } */
+void foobar(int *, int* __x) ;
+int test_ints[30];
+int j;
+
+void foobar (int *x, int *y)
+{
+ *x = *y = 0;
+}
+
+void Test() {
+ int int_set_;
+ foobar (&int_set_, &test_ints[j]);
+}
+main()
+{
+ Test();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1.h b/gcc/testsuite/g++.dg/lto/20090311-1.h
new file mode 100644
index 00000000000..389d94f0054
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1.h
@@ -0,0 +1,22 @@
+typedef unsigned long uint32;
+typedef int JSIntn;
+#define JS_DLL_CALLBACK
+typedef JSIntn JSBool;
+typedef struct JSContext JSContext;
+typedef struct JSObject JSObject;
+typedef long long JSInt64;
+typedef JSInt64 JSWord;
+typedef JSWord jsword;
+typedef jsword jsval;
+
+typedef JSBool
+(* JS_DLL_CALLBACK JSPropertyOp)(JSContext *cx, JSObject *ojb, jsval id,
+ jsval *vp);
+
+struct JSClass {
+ const char *name;
+ uint32 flags;
+ JSPropertyOp addProperty;
+};
+
+extern struct JSClass K;
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_0.C b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
new file mode 100644
index 00000000000..6d403272428
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1_0.C
@@ -0,0 +1,34 @@
+/* { dg-lto-do run } */
+#include "20090311-1.h"
+bool flag;
+
+struct B {
+ int a;
+ enum { ANOTHER, ONE } f2_;
+ float c;
+};
+
+extern struct B x[];
+
+struct C {
+ int x;
+ struct B *p;
+ float d;
+};
+
+C c = { 0, 0, 3.4 };
+
+struct A {
+ enum { UNO, DOS, TRES } f1_;
+ int x;
+};
+
+A a;
+
+extern int foo();
+main()
+{
+ a.x = 4 + c.x;
+ foo();
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311-1_1.C b/gcc/testsuite/g++.dg/lto/20090311-1_1.C
new file mode 100644
index 00000000000..520aa957a98
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311-1_1.C
@@ -0,0 +1,28 @@
+#include "20090311-1.h"
+
+struct A {
+ enum { UNO, DOS, TRES } f1_;
+ int x;
+};
+
+struct B;
+
+extern struct B x[];
+
+struct C {
+ int x;
+ struct B *p;
+ float d;
+};
+
+extern A a;
+extern B b;
+extern bool flag;
+extern C c;
+
+int foo()
+{
+ if (!flag)
+ return a.x - c.x;
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311_0.C b/gcc/testsuite/g++.dg/lto/20090311_0.C
new file mode 100644
index 00000000000..cc54bbfdc96
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311_0.C
@@ -0,0 +1,13 @@
+class C1 {
+public: virtual ~C1() {
+}
+};
+class C2 : public C1 {
+public:
+ C2(void *q);
+ virtual void A();
+};
+int main(int argc, char **argv) {
+ C2 h(0);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090311_1.C b/gcc/testsuite/g++.dg/lto/20090311_1.C
new file mode 100644
index 00000000000..e78da7223dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090311_1.C
@@ -0,0 +1,13 @@
+class C1 {
+public: virtual ~C1() {
+}
+};
+class C2 : public C1 {
+ C2(void *q);
+ virtual void A();
+};
+void C2::A() {
+}
+C2::C2(void *q)
+{
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090312.h b/gcc/testsuite/g++.dg/lto/20090312.h
new file mode 100644
index 00000000000..c902e93c78d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312.h
@@ -0,0 +1,2 @@
+enum Values { ONE, TWO, THREE };
+typedef const char * (* JSErrorCallback)(void *, const char *, const int);
diff --git a/gcc/testsuite/g++.dg/lto/20090312_0.C b/gcc/testsuite/g++.dg/lto/20090312_0.C
new file mode 100644
index 00000000000..b2222c2aa20
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312_0.C
@@ -0,0 +1,14 @@
+#include "20090312.h"
+
+extern "C" {
+ extern enum Values x;
+ extern JSErrorCallback p;
+};
+
+main()
+{
+ if ( x == ONE && p == 0)
+ return 0;
+
+ return 1;
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090312_1.C b/gcc/testsuite/g++.dg/lto/20090312_1.C
new file mode 100644
index 00000000000..a0f9085f528
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090312_1.C
@@ -0,0 +1,21 @@
+#include "20090312.h"
+
+/* This file should be compiled with the C front end. This
+ should be testing what happens when LTO merges enum types and function
+ prototypes compiled by the C and C++ FEs. Since both FEs generate
+ slightly different representations for these, LTO was emitting an
+ ODR violation error.
+
+ Once dejagnu can deal with multiple languages in a single test, remove
+ the __cplusplus checks and force this file to be compiled with the
+ C front end. */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JSErrorCallback p = 0;
+enum Values x = ONE;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/gcc/testsuite/g++.dg/lto/20090313_0.C b/gcc/testsuite/g++.dg/lto/20090313_0.C
new file mode 100644
index 00000000000..df1a94287b2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090313_0.C
@@ -0,0 +1,5 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fwhopr -fPIC}} }
+// { dg-extra-ld-options "-fwhopr -shared" }
+
+int X;
diff --git a/gcc/testsuite/g++.dg/lto/20090313_1.C b/gcc/testsuite/g++.dg/lto/20090313_1.C
new file mode 100644
index 00000000000..088792b2dd3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090313_1.C
@@ -0,0 +1,12 @@
+struct Foo {
+ virtual void X();
+ virtual void Y();
+};
+struct Bar: public Foo {
+ Bar(Foo *);
+ void Y();
+};
+void Baz() {
+ Foo f;
+ Bar b(&f);
+}
diff --git a/gcc/testsuite/g++.dg/lto/20090315_0.C b/gcc/testsuite/g++.dg/lto/20090315_0.C
new file mode 100644
index 00000000000..930fb16e5cf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090315_0.C
@@ -0,0 +1,9 @@
+// { dg-lto-do run }
+struct Foo {
+ bool Mumble() { return true; }
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+Foo *Foo::foo_;
+main() { return 0; }
diff --git a/gcc/testsuite/g++.dg/lto/20090315_1.C b/gcc/testsuite/g++.dg/lto/20090315_1.C
new file mode 100644
index 00000000000..0a2fba552a6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20090315_1.C
@@ -0,0 +1,7 @@
+struct Foo {
+ bool Mumble() { return true; }
+ static void Bar() { if (foo_->Mumble()) foo_ = 0; }
+ static void Baz() { Bar(); }
+ static Foo *foo_;
+};
+void Unused() { Foo::Bar(); Foo::Baz(); }
diff --git a/gcc/testsuite/g++.dg/lto/20091002-1_0.C b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
new file mode 100644
index 00000000000..d348e9c1a7d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C
@@ -0,0 +1,58 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC}} }
+// { dg-extra-ld-options "-fPIC -shared" }
+
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template<class _CharT> struct char_traits;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class basic_ostream;
+ template<typename _CharT, typename _Traits = char_traits<_CharT> >
+ class istreambuf_iterator;
+ typedef basic_ostream<char> ostream;
+ template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
+ class num_get;
+ class locale {
+ class facet;
+ };
+ class locale::facet {
+ };
+ enum _Ios_Iostate { _S_beg = 0, _S_cur = 1, _S_end = 2,
+ _S_ios_seekdir_end = 1L << 16 };
+ class ios_base {
+ public:
+ typedef _Ios_Iostate iostate;
+ };
+ template<typename _CharT, typename _InIter>
+ class num_get : public locale::facet {
+ typedef _InIter iter_type;
+ template<typename _ValueT> iter_type
+ _M_extract_int(iter_type, iter_type, ios_base&,
+ ios_base::iostate&, _ValueT&) const;
+ virtual iter_type
+ do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
+ };
+ extern template class num_get<char>;
+ template<typename _CharT, typename _Traits>
+ class basic_ios : public ios_base {
+ typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> >
+ __num_get_type;
+ const __num_get_type* _M_num_get;
+ };
+ template<typename _CharT, typename _Traits>
+ class basic_ostream : virtual public basic_ios<_CharT, _Traits> {
+ public:
+ typedef basic_ostream<_CharT, _Traits> __ostream_type;
+ __ostream_type& operator<<(double __f) { }
+ };
+ typedef double Real;
+ class Vector {
+ public:
+ Real operator[](int n) const { }
+ };
+ std::ostream& operator<<(std::ostream& s, const Vector& vec)
+ {
+ int i;
+ s << vec[i] << ')';
+ }
+}
diff --git a/gcc/testsuite/g++.dg/lto/20091002-2_0.C b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
new file mode 100644
index 00000000000..5b000fa580c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-2_0.C
@@ -0,0 +1,20 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC}} }
+// { dg-extra-ld-options "-fPIC -shared" }
+
+class DataArray {
+ int max() const { }
+};
+template < class HashItem >
+class DataHashTable {
+ template < class ElemHashItem >
+ class Element { };
+ typedef Element< HashItem > Elem;
+ DataArray m_elem;
+};
+class Name { };
+class NameSet {
+ DataHashTable < Name > hashtab;
+};
+NameSet p;
+
diff --git a/gcc/testsuite/g++.dg/lto/20091002-3_0.C b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
new file mode 100644
index 00000000000..7ed81559dd3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/20091002-3_0.C
@@ -0,0 +1,15 @@
+// { dg-lto-do link }
+// { dg-lto-options {{-fPIC}} }
+// { dg-extra-ld-options "-fPIC -shared" }
+
+template < class T >
+class DataArray {
+ int max() const { }
+};
+class Name { };
+class DataHashTable {
+ template < class ElemHashItem > class Element { };
+ DataArray < Element < Name > > m_elem;
+};
+DataHashTable p;
+
diff --git a/gcc/testsuite/g++.dg/lto/README b/gcc/testsuite/g++.dg/lto/README
new file mode 100644
index 00000000000..5fa3123b42d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/README
@@ -0,0 +1,35 @@
+This directory contains tests for link-time optimization (LTO).
+Tests in this directory may span multiple files, so the naming of
+the files is significant.
+
+The name of every file must end with '_N' where N is an integer.
+All the files with the same name base and different _N suffixes
+will be compiled separately and linked together to form the final
+executable.
+
+By default, each set of files will be compiled with list of
+options listed in LTO_OPTIONS (../../lib/lto.exp), which can be
+overwritten in the shell environment or using the 'dg-lto-options'
+command in the main file of the set (i.e., the file with _0
+suffix).
+
+For example, given the files a_0.C a_1.C a_2.C, they will be
+compiled as:
+
+$ g++ -c <flags> a_0.C
+$ g++ -c <flags> a_1.C
+$ g++ -c <flags> a_2.C
+$ g++ -o <executable> a_0.o a_1.o a_2.o
+
+Tests that do not need more than one file are a special case
+where there is a single file named 'foo_0.C'.
+
+The only supported dg-lto-do option are 'compile', 'run' and 'link'.
+Additionally, these can only be used in the main file. If
+'compile' is used, only the individual object files are
+generated. If 'link' is used, the final executable is generated
+but not executed (in this case, function main() needs to exist
+but it does not need to do anything). If 'run' is used, the
+final executable is generated and the resulting binary executed.
+
+The default value for dg-lto-do is 'run'.
diff --git a/gcc/testsuite/g++.dg/lto/lto.exp b/gcc/testsuite/g++.dg/lto/lto.exp
new file mode 100644
index 00000000000..d19bad88927
--- /dev/null
+++ b/gcc/testsuite/g++.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 g++.exp
+load_lib target-libpath.exp
+
+# Load the language-independent compabibility support procedures.
+load_lib lto.exp
+
+g++_init
+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 "cp_lto"
+
+# If LTO has not been enabled, bail.
+if { ![check_effective_target_lto] } {
+ return
+}
+
+# Main loop.
+foreach src [lsort [find $srcdir/$subdir *_0.C]] {
+ # 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/g++.dg/lto/pr40818_0.C b/gcc/testsuite/g++.dg/lto/pr40818_0.C
new file mode 100644
index 00000000000..8430f9cd015
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr40818_0.C
@@ -0,0 +1,11 @@
+// { dg-lto-do assemble }
+// Test case from Eugene A. Strizhov.
+
+extern int i;
+struct S { S (); };
+
+S::S ()
+{
+ enum { fifty = 0x50 };
+ if (i > fifty);
+}
diff --git a/gcc/testsuite/g++.dg/opt/thunk3-1.C b/gcc/testsuite/g++.dg/opt/thunk3-1.C
new file mode 100644
index 00000000000..c540b0fa2b4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/thunk3-1.C
@@ -0,0 +1,6 @@
+// { dg-do compile }
+// { dg-options "-O1" }
+struct Foo { };
+struct Bar { virtual ~Bar(); };
+struct Baz: public virtual Bar { virtual void Func (Foo); };
+void unused() { Baz().Func(Foo()); }
diff --git a/gcc/testsuite/g++.dg/opt/thunk4.C b/gcc/testsuite/g++.dg/opt/thunk4.C
new file mode 100644
index 00000000000..7dd5ea4338b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/opt/thunk4.C
@@ -0,0 +1,63 @@
+// { dg-do compile }
+// { dg-options "-O1" }
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < class _CharT > struct char_traits;
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ template < typename _CharT, typename _Traits =
+ char_traits < _CharT > >class basic_iostream;
+}
+
+extern "C++"
+{
+ namespace std
+ {
+ class exception
+ {
+ public:exception () throw ()
+ {
+ }
+ };
+ }
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+ class ios_base
+ {
+ public:class failure:public exception
+ {
+ };
+ virtual ~ ios_base ();
+ };
+template < typename _CharT, typename _Traits > class basic_ios:public
+ ios_base
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_ostream:virtual public basic_ios < _CharT,
+ _Traits
+ >
+ {
+ };
+}
+namespace std __attribute__ ((__visibility__ ("default")))
+{
+template < typename _CharT, typename _Traits > class basic_istream:virtual public basic_ios < _CharT,
+ _Traits
+ >
+ {
+ };
+template < typename _CharT, typename _Traits > class basic_iostream:public basic_istream < _CharT, _Traits >, public basic_ostream < _CharT,
+ _Traits
+ >
+ {
+ };
+ class strstream:public basic_iostream < char >
+ {
+ virtual ~ strstream ();
+ };
+ strstream::~strstream ()
+ {
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
index 573be92673d..a54f3c1b53e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/builtins.exp
@@ -35,7 +35,7 @@ load_lib torture-options.exp
load_lib c-torture.exp
torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
set additional_flags ""
if [istarget "powerpc-*-darwin*"] {
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c
index 590ded7892b..1e0857f734d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/abs.c
@@ -8,6 +8,7 @@ extern void abort (void);
typedef __INTMAX_TYPE__ intmax_t;
+__attribute__ ((__noinline__))
int
abs (int x)
{
@@ -15,6 +16,7 @@ abs (int x)
return x < 0 ? -x : x;
}
+__attribute__ ((__noinline__))
long
labs (long x)
{
@@ -22,6 +24,7 @@ labs (long x)
return x < 0 ? -x : x;
}
+__attribute__ ((__noinline__))
long long
llabs (long long x)
{
@@ -29,6 +32,7 @@ llabs (long long x)
return x < 0 ? -x : x;
}
+__attribute__ ((__noinline__))
intmax_t
imaxabs (intmax_t x)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c
index c5e9629bd9b..deb6cf5228e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bfill.c
@@ -1,5 +1,6 @@
extern int inside_main;
+__attribute__ ((__noinline__))
void
bfill (void *s, __SIZE_TYPE__ n, int ch)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c
index bcbe3a4383a..a02b5358b37 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/bzero.c
@@ -1,5 +1,6 @@
extern int inside_main;
+__attribute__ ((__noinline__))
void
bzero (void *s, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
index a22db41d800..853a705e86d 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/fprintf.c
@@ -3,6 +3,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
int
fprintf (FILE *fp, const char *string, ...)
{
@@ -19,6 +20,7 @@ fprintf (FILE *fp, const char *string, ...)
}
/* Locking stdio doesn't matter for the purposes of this test. */
+__attribute__ ((__noinline__))
int
fprintf_unlocked (FILE *fp, const char *string, ...)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c
index ddab08bcf8d..2f15c57a770 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memchr.c
@@ -1,6 +1,7 @@
extern void abort(void);
extern int inside_main;
+__attribute__ ((__noinline__))
void *
memchr (const void *s, int c, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c
index 94c0a576634..fd6556d227b 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memcmp.c
@@ -1,6 +1,7 @@
extern void abort(void);
extern int inside_main;
+__attribute__ ((__noinline__))
int
memcmp (const void *s1, const void *s2, __SIZE_TYPE__ len)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c
index 03faf5e6262..08fcd080148 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memmove.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
void *
memmove (void *dst, const void *src, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c
index 67ee3cbe413..bc16da536ff 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/mempcpy.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
void *
mempcpy (void *dst, const void *src, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c
index 4bfa33ea66f..90545abbf24 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/memset.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
void *
memset (void *dst, int c, __SIZE_TYPE__ n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c
index 2f8c133177c..4be7578d124 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/printf.c
@@ -3,6 +3,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
int
printf (const char *string, ...)
{
@@ -20,6 +21,7 @@ printf (const char *string, ...)
/* Locking stdio doesn't matter for the purposes of this test. */
+__attribute__ ((__noinline__))
int
printf_unlocked (const char *string, ...)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c
index a015d90a64c..3ac447b117f 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/sprintf.c
@@ -3,6 +3,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
int
(sprintf) (char *buf, const char *fmt, ...)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c
index e6e1a6dae9c..2c7c8178bab 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/stpcpy.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
stpcpy (char *dst, const char *src)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c
index 2cced80f5d7..d592087a933 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcat.c
@@ -1,6 +1,7 @@
extern int inside_main;
extern void abort(void);
+__attribute__ ((__noinline__))
char *
strcat (char *dst, const char *src)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c
index 7ca78d1f356..bee3d3203eb 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strchr.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
strchr (const char *s, int c)
{
@@ -19,6 +20,7 @@ strchr (const char *s, int c)
}
}
+__attribute__ ((__noinline__))
char *
index (const char *s, int c)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c
index 220499ab317..82284546f65 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcmp.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
int
strcmp (const char *s1, const char *s2)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c
index 45c6a45e4da..916446623f9 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcpy.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
strcpy (char *d, const char *s)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c
index 53f609114bb..8270996374a 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strcspn.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
__SIZE_TYPE__
strcspn (const char *s1, const char *s2)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c
index 3ead79d1de5..7f81c115b81 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strlen.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
__SIZE_TYPE__
strlen (const char *s)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c
index 290d4cf49bb..7fd334cb4d8 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncat.c
@@ -3,6 +3,7 @@ extern int inside_main;
typedef __SIZE_TYPE__ size_t;
+__attribute__ ((__noinline__))
char *
strncat (char *s1, const char *s2, size_t n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c
index 6599af79044..7a8eb6fd27e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncmp.c
@@ -3,6 +3,7 @@ extern int inside_main;
typedef __SIZE_TYPE__ size_t;
+__attribute__ ((__noinline__))
int
strncmp(const char *s1, const char *s2, size_t n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c
index b297345e6ca..a6ec98b054a 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strncpy.c
@@ -3,6 +3,7 @@ extern int inside_main;
typedef __SIZE_TYPE__ size_t;
+__attribute__ ((__noinline__))
char *
strncpy(char *s1, const char *s2, size_t n)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c
index f6bb0321020..0c049272cca 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strpbrk.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
strpbrk(const char *s1, const char *s2)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c
index c2f7107064c..9a45af3c8e5 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strrchr.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
strrchr (const char *s, int c)
{
@@ -23,6 +24,7 @@ strrchr (const char *s, int c)
return 0;
}
+__attribute__ ((__noinline__))
char *
rindex (const char *s, int c)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c
index 126c44f263b..622aac6ab38 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strspn.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
__SIZE_TYPE__
strcspn (const char *s1, const char *s2)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
index d803f1ee94b..7d35445063e 100644
--- a/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
+++ b/gcc/testsuite/gcc.c-torture/execute/builtins/lib/strstr.c
@@ -1,6 +1,7 @@
extern void abort (void);
extern int inside_main;
+__attribute__ ((__noinline__))
char *
strstr(const char *s1, const char *s2)
{
diff --git a/gcc/testsuite/gcc.c-torture/execute/execute.exp b/gcc/testsuite/gcc.c-torture/execute/execute.exp
index 9b6bccd0c31..a26e5907639 100644
--- a/gcc/testsuite/gcc.c-torture/execute/execute.exp
+++ b/gcc/testsuite/gcc.c-torture/execute/execute.exp
@@ -32,7 +32,7 @@ load_lib torture-options.exp
load_lib c-torture.exp
torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
#
# main test loop
diff --git a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
index 558829aa5f9..c23f32e85ab 100644
--- a/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
+++ b/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp
@@ -35,7 +35,7 @@ if $tracelevel then {
}
torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
set additional_flags "-fno-inline"
diff --git a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
index 4a8ebe75c5e..def4bc5afb6 100644
--- a/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
+++ b/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp
@@ -33,7 +33,7 @@ load_lib c-torture.exp
load_lib torture-options.exp
torture-init
-set-torture-options $C_TORTURE_OPTIONS
+set-torture-options $C_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
#
# This loop will run c-torture on any *.c file found in this directory.
diff --git a/gcc/testsuite/gcc.dg/20081223-1.c b/gcc/testsuite/gcc.dg/20081223-1.c
new file mode 100644
index 00000000000..3c36955c9e3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/20081223-1.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-fwhopr" { target lto } } */
+
+typedef struct foo_ foo_t;
+foo_t bar; /* { dg-error "storage size of 'bar' isn't known" } */
diff --git a/gcc/testsuite/gcc.dg/lto/20080908_0.c b/gcc/testsuite/gcc.dg/lto/20080908_0.c
new file mode 100644
index 00000000000..3bc1c3a725c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20080908_0.c
@@ -0,0 +1,16 @@
+/* { dg-lto-do assemble } */
+void foo(void) {
+ char *bar;
+ int baz;
+ while (1)
+ {
+ if (baz)
+ {
+ baz = -baz;
+ do
+ *bar++ = 0;
+ while (++baz);
+ }
+ ++baz;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20080917_0.c b/gcc/testsuite/gcc.dg/lto/20080917_0.c
new file mode 100644
index 00000000000..ac0891081fe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20080917_0.c
@@ -0,0 +1,29 @@
+/* { dg-lto-do assemble } */
+/* { dg-lto-options {{-O2 -funsigned-char}} } */
+int
+foo (char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
+
+int
+baz (const char *s, int flag)
+{
+ for (;;)
+ {
+ unsigned char c;
+ if (flag)
+ c = *s;
+ else
+ c = *s;
+ return c;
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20080924_0.c b/gcc/testsuite/gcc.dg/lto/20080924_0.c
new file mode 100644
index 00000000000..db7745077e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20080924_0.c
@@ -0,0 +1,9 @@
+/* { dg-lto-do assemble } */
+/* { dg-lto-options {{-O2 -flto -funsigned-char}} } */
+typedef unsigned int size_t;
+foo (const char *src, unsigned char *dst, size_t size)
+{
+ int ch;
+ while ((ch = *src++) != '\0') {
+ }
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081024_0.c b/gcc/testsuite/gcc.dg/lto/20081024_0.c
new file mode 100644
index 00000000000..9fa297abc0e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081024_0.c
@@ -0,0 +1,26 @@
+/* { dg-lto-do run } */
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+char *
+myprintf (const char *fmt, ...)
+{
+ va_list args;
+ static char buf[80];
+
+ va_start (args, fmt);
+ (void) vsnprintf (buf, sizeof (buf), fmt, args);
+ va_end (args);
+ return buf;
+}
+
+int
+main ()
+{
+ char *s;
+
+ s = myprintf ("%s: %d\n", "foo", 1);
+ return strcmp (s, "foo: 1\n") != 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081109_0.c b/gcc/testsuite/gcc.dg/lto/20081109_0.c
new file mode 100644
index 00000000000..eaa25f673d3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081109_0.c
@@ -0,0 +1,3 @@
+/* { dg-lto-do assemble } */
+/* { dg-lto-options {{-w -flto}} } */
+void Foo(void) { char bar[1]; free(bar); }
diff --git a/gcc/testsuite/gcc.dg/lto/20081111_0.c b/gcc/testsuite/gcc.dg/lto/20081111_0.c
new file mode 100644
index 00000000000..899689c1bc4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081111_0.c
@@ -0,0 +1,11 @@
+extern int mumble;
+extern void abort (void);
+extern void exit (int);
+
+int
+main ()
+{
+ if (++mumble != 42)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081111_1.c b/gcc/testsuite/gcc.dg/lto/20081111_1.c
new file mode 100644
index 00000000000..2b7fee58690
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081111_1.c
@@ -0,0 +1,7 @@
+int mumble = 41;
+
+int
+bar (void)
+{
+ return mumble;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081112_0.c b/gcc/testsuite/gcc.dg/lto/20081112_0.c
new file mode 100644
index 00000000000..a90aa70b3ab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081112_0.c
@@ -0,0 +1,14 @@
+extern void exit (int);
+extern void abort (void);
+
+extern void f ();
+extern int g ();
+
+int
+main ()
+{
+ f ();
+ if (g () != 42)
+ abort ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081112_1.c b/gcc/testsuite/gcc.dg/lto/20081112_1.c
new file mode 100644
index 00000000000..2ba1cb9405c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081112_1.c
@@ -0,0 +1,13 @@
+static int mumble;
+
+void
+f (void)
+{
+ mumble = 41;
+}
+
+int __attribute__((noinline))
+g (void)
+{
+ return ++mumble;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081115_0.c b/gcc/testsuite/gcc.dg/lto/20081115_0.c
new file mode 100644
index 00000000000..f24a92deda4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081115_0.c
@@ -0,0 +1,32 @@
+/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */
+
+extern void abort (void);
+
+int f (void)
+{
+ return 1;
+}
+
+extern inline int
+e_inline_baz (void)
+{
+ return 1 + f();
+}
+
+int
+bar (void)
+{
+ return e_inline_baz ();
+}
+
+main ()
+{
+#ifdef OPTIMIZE
+ if (bar () != 2 || foo () != 3)
+ abort ();
+#else
+ if (bar () != 0 || foo () != 0)
+ abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081115_1.c b/gcc/testsuite/gcc.dg/lto/20081115_1.c
new file mode 100644
index 00000000000..62ffa520000
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081115_1.c
@@ -0,0 +1,11 @@
+extern inline int
+e_inline_baz (void)
+{
+ return 2 + 1;
+}
+
+int
+foo (void)
+{
+ return e_inline_baz ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081115_2.c b/gcc/testsuite/gcc.dg/lto/20081115_2.c
new file mode 100644
index 00000000000..0ccecd7363d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081115_2.c
@@ -0,0 +1,5 @@
+int
+e_inline_baz (void)
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081118_0.c b/gcc/testsuite/gcc.dg/lto/20081118_0.c
new file mode 100644
index 00000000000..0640428be6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081118_0.c
@@ -0,0 +1,28 @@
+/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */
+
+extern void abort (void);
+extern int f (void);
+
+extern inline int
+e_inline_baz (void)
+{
+ return 1 + f();
+}
+
+int
+bar (void)
+{
+ return e_inline_baz ();
+}
+
+main ()
+{
+#ifdef OPTIMIZE
+ if (bar () != 2 || foo () != 3)
+ abort ();
+#else
+ if (bar () != 0 || foo () != 0)
+ abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081118_1.c b/gcc/testsuite/gcc.dg/lto/20081118_1.c
new file mode 100644
index 00000000000..f0a8c3c876b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081118_1.c
@@ -0,0 +1,13 @@
+extern int f (void);
+
+extern inline int
+e_inline_baz (void)
+{
+ return 2 + f ();
+}
+
+int
+foo (void)
+{
+ return e_inline_baz ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081118_2.c b/gcc/testsuite/gcc.dg/lto/20081118_2.c
new file mode 100644
index 00000000000..32ce432a128
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081118_2.c
@@ -0,0 +1,11 @@
+int
+e_inline_baz (void)
+{
+ return 0;
+}
+
+ __attribute__((noinline)) int
+f (void)
+{
+ return 1;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081120-1_0.c b/gcc/testsuite/gcc.dg/lto/20081120-1_0.c
new file mode 100644
index 00000000000..c35119605d6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081120-1_0.c
@@ -0,0 +1,5 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-flto -shared}} } */
+extern int stat(void) __asm__("" "stat64");
+extern inline int stat(void) { }
+static void foo(void) { stat(); }
diff --git a/gcc/testsuite/gcc.dg/lto/20081120-1_1.c b/gcc/testsuite/gcc.dg/lto/20081120-1_1.c
new file mode 100644
index 00000000000..73d25000c91
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081120-1_1.c
@@ -0,0 +1,3 @@
+extern int stat(void) __asm__("" "stat64");
+extern inline int stat(void) { }
+static void foo(void) { stat(); }
diff --git a/gcc/testsuite/gcc.dg/lto/20081120-2_0.c b/gcc/testsuite/gcc.dg/lto/20081120-2_0.c
new file mode 100644
index 00000000000..ff8a9a435f2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081120-2_0.c
@@ -0,0 +1,3 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fwhopr -shared}} } */
+void bar(void) {}
diff --git a/gcc/testsuite/gcc.dg/lto/20081120-2_1.c b/gcc/testsuite/gcc.dg/lto/20081120-2_1.c
new file mode 100644
index 00000000000..c81f8c7fd07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081120-2_1.c
@@ -0,0 +1,2 @@
+int mumble = 0;
+void foo(void) {}
diff --git a/gcc/testsuite/gcc.dg/lto/20081125_0.c b/gcc/testsuite/gcc.dg/lto/20081125_0.c
new file mode 100644
index 00000000000..4b2e7191fed
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081125_0.c
@@ -0,0 +1,6 @@
+int foo (int);
+
+int main()
+{
+ return foo (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081125_1.c b/gcc/testsuite/gcc.dg/lto/20081125_1.c
new file mode 100644
index 00000000000..1fcf4e7d391
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081125_1.c
@@ -0,0 +1,4 @@
+int foo (int x)
+{
+ return x;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081126_0.c b/gcc/testsuite/gcc.dg/lto/20081126_0.c
new file mode 100644
index 00000000000..9d0bb14c4cb
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081126_0.c
@@ -0,0 +1,8 @@
+/* { dg-lto-do link } */
+/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */
+/* { dg-lto-options {{-flto -shared}} } */
+
+int f(void) {
+ register int ri asm("edi");
+ return ri;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_0.c b/gcc/testsuite/gcc.dg/lto/20081201-1_0.c
new file mode 100644
index 00000000000..05cbb82fdd1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081201-1_0.c
@@ -0,0 +1,33 @@
+/* { dg-lto-options {{-O2 -DOPTIMIZE -fwhopr} {-O0 -fwhopr}} } */
+
+extern void abort (void);
+
+int
+f (void)
+{
+ return 1;
+}
+
+extern inline int
+e_inline_baz (void)
+{
+ return 1 + f();
+}
+
+int
+bar (void)
+{
+ return e_inline_baz ();
+}
+
+main ()
+{
+#ifdef OPTIMIZE
+ if (bar () != 2 || foo () != 3)
+ abort ();
+#else
+ if (bar () != 0 || foo () != 0)
+ abort ();
+#endif
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_1.c b/gcc/testsuite/gcc.dg/lto/20081201-1_1.c
new file mode 100644
index 00000000000..f0a8c3c876b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081201-1_1.c
@@ -0,0 +1,13 @@
+extern int f (void);
+
+extern inline int
+e_inline_baz (void)
+{
+ return 2 + f ();
+}
+
+int
+foo (void)
+{
+ return e_inline_baz ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081201-1_2.c b/gcc/testsuite/gcc.dg/lto/20081201-1_2.c
new file mode 100644
index 00000000000..bcf87a749b5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081201-1_2.c
@@ -0,0 +1,7 @@
+int
+e_inline_baz (void)
+{
+ return 0;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/lto/20081201-2_0.c b/gcc/testsuite/gcc.dg/lto/20081201-2_0.c
new file mode 100644
index 00000000000..4c1510d1cec
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081201-2_0.c
@@ -0,0 +1,16 @@
+/* { dg-lto-options {{-O3 -fwhopr}} } */
+
+/* Test that cross-TU inlining works. */
+
+extern void abort ();
+extern void exit (int);
+extern void *foo (void);
+
+int
+main ()
+{
+ if (foo () != __builtin_return_address (0))
+ abort ();
+
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081201-2_1.c b/gcc/testsuite/gcc.dg/lto/20081201-2_1.c
new file mode 100644
index 00000000000..f93e1fd025f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081201-2_1.c
@@ -0,0 +1,5 @@
+void *
+foo (void)
+{
+ return __builtin_return_address (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081202-1_0.c b/gcc/testsuite/gcc.dg/lto/20081202-1_0.c
new file mode 100644
index 00000000000..933610a894b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081202-1_0.c
@@ -0,0 +1,11 @@
+/* { dg-lto-options {{-fwhopr -O3}} } */
+
+extern void exit (int);
+extern void foo (void);
+
+int
+main ()
+{
+ foo ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081202-1_1.c b/gcc/testsuite/gcc.dg/lto/20081202-1_1.c
new file mode 100644
index 00000000000..2f6777864a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081202-1_1.c
@@ -0,0 +1,10 @@
+static void __attribute__((noinline))
+bar (void)
+{
+}
+
+void
+foo (void)
+{
+ bar ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081202-2_0.c b/gcc/testsuite/gcc.dg/lto/20081202-2_0.c
new file mode 100644
index 00000000000..09f417698ca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081202-2_0.c
@@ -0,0 +1,13 @@
+/* { dg-lto-options {{-fwhopr -O3}} } */
+
+extern void exit (int);
+extern void *foo (void);
+
+void *p;
+
+int
+main ()
+{
+ p = foo ();
+ exit (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081202-2_1.c b/gcc/testsuite/gcc.dg/lto/20081202-2_1.c
new file mode 100644
index 00000000000..adb15024502
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081202-2_1.c
@@ -0,0 +1,16 @@
+static void __attribute__((noinline))
+bar (void)
+{
+}
+
+void *
+foo (void)
+{
+ return bar;
+}
+
+void
+quxx (void)
+{
+ return bar ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081204-1_0.c b/gcc/testsuite/gcc.dg/lto/20081204-1_0.c
new file mode 100644
index 00000000000..92598085c9a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081204-1_0.c
@@ -0,0 +1,7 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fwhopr -fPIC -shared}} } */
+
+/* Tests for the absence during linking of:
+ lto1: error: type of 'i' does not match original declaration */
+
+const int i[1];
diff --git a/gcc/testsuite/gcc.dg/lto/20081204-1_1.c b/gcc/testsuite/gcc.dg/lto/20081204-1_1.c
new file mode 100644
index 00000000000..95761ea156b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081204-1_1.c
@@ -0,0 +1,5 @@
+extern const int i[];
+
+int dummy(void) {
+ return i[0];
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081204-2_0.c b/gcc/testsuite/gcc.dg/lto/20081204-2_0.c
new file mode 100644
index 00000000000..241ac5d607a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081204-2_0.c
@@ -0,0 +1,5 @@
+/* { dg-lto-do link } */
+/* { dg-skip-if "" { ! { i?86-*-* x86_64-*-* } } { "*" } { "" } } */
+/* { dg-lto-options {{-w -flto -fPIC -shared}} } */
+
+register int ri asm("edi");
diff --git a/gcc/testsuite/gcc.dg/lto/20081210-1_0.c b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c
new file mode 100644
index 00000000000..5cf020ec227
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081210-1_0.c
@@ -0,0 +1,21 @@
+#if defined(_LP64) || defined(_WIN64)
+typedef unsigned long int uintptr_t;
+#else
+typedef unsigned int uintptr_t;
+#endif
+
+extern void srand (uintptr_t);
+
+inline void
+foo (uintptr_t seed)
+{
+ srand (seed * seed);
+}
+
+int
+main ()
+{
+ foo (0);
+ srand ((uintptr_t) (&foo));
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081212-1_0.c b/gcc/testsuite/gcc.dg/lto/20081212-1_0.c
new file mode 100644
index 00000000000..a19bff1bac5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081212-1_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-shared}} } */
+int exported_var = 42;
+/* { dg-final { scan-symbol "exported_var" } } */
diff --git a/gcc/testsuite/gcc.dg/lto/20081222_0.c b/gcc/testsuite/gcc.dg/lto/20081222_0.c
new file mode 100644
index 00000000000..e44766613bd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081222_0.c
@@ -0,0 +1,11 @@
+#include "20081222_0.h"
+
+extern void abort (void);
+
+int
+main ()
+{
+ if (x () == 7)
+ return 0;
+ abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081222_0.h b/gcc/testsuite/gcc.dg/lto/20081222_0.h
new file mode 100644
index 00000000000..4c26f461651
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081222_0.h
@@ -0,0 +1 @@
+int x();
diff --git a/gcc/testsuite/gcc.dg/lto/20081222_1.c b/gcc/testsuite/gcc.dg/lto/20081222_1.c
new file mode 100644
index 00000000000..e8f9254421b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081222_1.c
@@ -0,0 +1,16 @@
+#include "20081222_0.h"
+
+/* Actually, call "x" "INT_X", and make it hidden. */
+extern __typeof (x) x
+ __asm__ ("INT_x")
+ __attribute__ ((__visibility__ ("hidden")));
+
+int x ()
+{
+ return 7;
+}
+
+/* Make an externally-visible symbol "X" that's an alias for INT_x. */
+extern __typeof (x) EXT_x
+ __asm__ ("x")
+ __attribute__ ((__alias__ ("INT_x")));
diff --git a/gcc/testsuite/gcc.dg/lto/20081224_0.c b/gcc/testsuite/gcc.dg/lto/20081224_0.c
new file mode 100644
index 00000000000..c146115b086
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081224_0.c
@@ -0,0 +1,9 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fwhopr -shared -fPIC}} } */
+#include "20081224_0.h"
+
+extern struct foo x;
+
+void f(void) {
+ x.x = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20081224_0.h b/gcc/testsuite/gcc.dg/lto/20081224_0.h
new file mode 100644
index 00000000000..7b62a079667
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081224_0.h
@@ -0,0 +1,3 @@
+typedef struct foo {
+ int x;
+} foo_t;
diff --git a/gcc/testsuite/gcc.dg/lto/20081224_1.c b/gcc/testsuite/gcc.dg/lto/20081224_1.c
new file mode 100644
index 00000000000..3e1ff341088
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20081224_1.c
@@ -0,0 +1,2 @@
+#include "20081224_0.h"
+foo_t x;
diff --git a/gcc/testsuite/gcc.dg/lto/20090116_0.c b/gcc/testsuite/gcc.dg/lto/20090116_0.c
new file mode 100644
index 00000000000..4b88e4ab3b1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090116_0.c
@@ -0,0 +1,12 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-O1 -fwhopr -fPIC}} } */
+/* { dg-extra-ld-options {-shared -O0} } */
+
+int foo(void) {
+ int ret, i;
+ for (i = 0; i < 1; i++)
+ ret = 0;
+ for (i = 0; i < 1; i++)
+ ret = 1;
+ return ret;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090120_0.c b/gcc/testsuite/gcc.dg/lto/20090120_0.c
new file mode 100644
index 00000000000..6c69a9918b2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090120_0.c
@@ -0,0 +1,14 @@
+/* { dg-lto-options {{-flto -funsigned-char}} } */
+
+extern void abort ();
+
+char c = 0xff;
+
+int
+main ()
+{
+ int i = (unsigned) c;
+ if (i < 0)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090126-1_0.c b/gcc/testsuite/gcc.dg/lto/20090126-1_0.c
new file mode 100644
index 00000000000..0ed8ea32401
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090126-1_0.c
@@ -0,0 +1,7 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-O0 -fwhopr}} } */
+/* { dg-extra-ld-options {-shared -O2 -fwhopr} } */
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090126-2_0.c b/gcc/testsuite/gcc.dg/lto/20090126-2_0.c
new file mode 100644
index 00000000000..64e63853250
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090126-2_0.c
@@ -0,0 +1,7 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-fPIC -O2 -fwhopr}} } */
+/* { dg-extra-ld-options {-fno-PIC -shared -O2 -fwhopr} } */
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090206-1_0.c b/gcc/testsuite/gcc.dg/lto/20090206-1_0.c
new file mode 100644
index 00000000000..42eaca9d5e2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090206-1_0.c
@@ -0,0 +1,10 @@
+/* { dg-lto-do link } */
+/* { dg-skip-if "" { ! { i?86-*-linux* x86_64-*-linux* } } { "*" } { "" } } */
+/* { dg-lto-options {{-fPIC -shared -fwhopr -msse2}} } */
+/* { dg-suppress-ld-options {-fPIC -msse2} } */
+
+typedef short v8hi __attribute__((__vector_size__(16)));
+void func (void) {
+ v8hi x, y, z;
+ z = __builtin_ia32_paddw128 (x, y);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090206-2_0.c b/gcc/testsuite/gcc.dg/lto/20090206-2_0.c
new file mode 100644
index 00000000000..3e85c5d227c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090206-2_0.c
@@ -0,0 +1,18 @@
+/* { dg-lto-do link } */
+/* { dg-skip-if "" { ! { i?86-*-linux* x86_64-*-linux* } } { "*" } { "" } } */
+/* { dg-lto-options {{-fwhopr -fPIC}} } */
+/* { dg-suppress-ld-options {-fPIC} } */
+
+void func(int n) {
+ static int __thread v = 0;
+ int i;
+ for (i = 0; i < n; ++i) {
+ volatile int *p = &v;
+ volatile int x __attribute__ ((unused)) = *p;
+ }
+}
+
+int main(int argc, char **argv) {
+ func(argc);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090210_0.c b/gcc/testsuite/gcc.dg/lto/20090210_0.c
new file mode 100644
index 00000000000..c588e8a2778
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090210_0.c
@@ -0,0 +1,6 @@
+/* { dg-lto-do run } */
+/* { dg-suppress-ld-options {-fPIC} } */
+int foo (int x)
+{
+ return x;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090210_1.c b/gcc/testsuite/gcc.dg/lto/20090210_1.c
new file mode 100644
index 00000000000..bf12aa6c08b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090210_1.c
@@ -0,0 +1,22 @@
+/* { dg-options "-fPIC" } */
+static void
+f (int n)
+{
+ int i;
+ static int __thread value = 100;
+ for (i = 0; i < n; ++i)
+ {
+ volatile int *p = &value;
+ volatile int x __attribute__ ((unused)) = *p;
+ }
+}
+
+
+extern int foo (int);
+
+int
+main (int argc, char **argv)
+{
+ f (foo (4) + argc);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090213_0.c b/gcc/testsuite/gcc.dg/lto/20090213_0.c
new file mode 100644
index 00000000000..6387a0e4716
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090213_0.c
@@ -0,0 +1,11 @@
+/* { dg-lto-do run } */
+#include <stdio.h>
+
+extern int foo (int);
+
+main()
+{
+ int x = foo (10);
+ printf ("x is %d, foo is at 0x%p\n", x, foo);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090213_1.c b/gcc/testsuite/gcc.dg/lto/20090213_1.c
new file mode 100644
index 00000000000..4a852efd193
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090213_1.c
@@ -0,0 +1,6 @@
+int foo (int x)
+{
+ return x * 32;
+}
+
+
diff --git a/gcc/testsuite/gcc.dg/lto/20090218-1_0.c b/gcc/testsuite/gcc.dg/lto/20090218-1_0.c
new file mode 100644
index 00000000000..1dc9ee08540
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218-1_0.c
@@ -0,0 +1,4 @@
+void set_mem_alias_set () __attribute__ ((always_inline));
+void emit_push_insn () {
+ set_mem_alias_set ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218-1_1.c b/gcc/testsuite/gcc.dg/lto/20090218-1_1.c
new file mode 100644
index 00000000000..33d4fb000f3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218-1_1.c
@@ -0,0 +1,9 @@
+int main(void)
+{
+ return 0;
+}
+static void __attribute__ ((noinline)) get_mem_attrs () {
+}
+void __attribute__ ((always_inline)) set_mem_alias_set () {
+ get_mem_attrs ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218-2_0.c b/gcc/testsuite/gcc.dg/lto/20090218-2_0.c
new file mode 100644
index 00000000000..8857e7a6d21
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218-2_0.c
@@ -0,0 +1,3 @@
+void emit_push_insn () {
+ set_mem_alias_set ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218-2_1.c b/gcc/testsuite/gcc.dg/lto/20090218-2_1.c
new file mode 100644
index 00000000000..119fbe4a16b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218-2_1.c
@@ -0,0 +1,19 @@
+typedef struct {
+} mem_attrs;
+int main(void)
+{
+ return 0;
+}
+void *malloc(unsigned long size);
+void *memcpy(void *dest, const void *src, unsigned long n);
+static mem_attrs * get_mem_attrs () {
+ void **slot;
+ *slot = malloc (3);
+ memcpy (*slot, 0, 3);
+}
+void set_mem_attributes () {
+ get_mem_attrs ();
+}
+void set_mem_alias_set () {
+ get_mem_attrs ();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218_0.c b/gcc/testsuite/gcc.dg/lto/20090218_0.c
new file mode 100644
index 00000000000..c4390fa1f10
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218_0.c
@@ -0,0 +1,7 @@
+void __attribute__((noinline)) *foo1(void);
+void __attribute__((noinline)) *foo2(void);
+
+int main(void)
+{
+ return foo1() != foo2();
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218_1.c b/gcc/testsuite/gcc.dg/lto/20090218_1.c
new file mode 100644
index 00000000000..c28b84ada6e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218_1.c
@@ -0,0 +1,6 @@
+void bar(void);
+void __attribute__((noinline)) *foo1 (void)
+{
+ bar();
+ return (void *) bar;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218_2.c b/gcc/testsuite/gcc.dg/lto/20090218_2.c
new file mode 100644
index 00000000000..e9f835f3627
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218_2.c
@@ -0,0 +1,6 @@
+void bar(void);
+void __attribute__((noinline)) *foo2 (void)
+{
+ bar();
+ return (void *) bar;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090218_3.c b/gcc/testsuite/gcc.dg/lto/20090218_3.c
new file mode 100644
index 00000000000..e1f4df61479
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090218_3.c
@@ -0,0 +1,3 @@
+void bar(void)
+{
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090219_0.c b/gcc/testsuite/gcc.dg/lto/20090219_0.c
new file mode 100644
index 00000000000..6229de7aef1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090219_0.c
@@ -0,0 +1,28 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-O3 -fwhopr -fPIC -shared}} } */
+
+struct Foo { int f1, f2, f3, f4, f5; };
+
+int x = 0;
+struct Foo *foo;
+
+inline void Bar(int n){
+ foo[x].f1 = 0;
+ foo[x].f2 = 0;
+ foo[x].f3 = 0;
+ foo[x].f4 = 0;
+ foo[x].f5 = n;
+}
+
+int ei[1];
+inline void Baz(int n) {
+ if (ei[n] == 1)
+ Bar (0);
+ else if (ei[n] == 0)
+ Bar (1);
+}
+
+void mumble(void) {
+ for (;;)
+ Baz (0);
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090312_0.c b/gcc/testsuite/gcc.dg/lto/20090312_0.c
new file mode 100644
index 00000000000..8aaad754cc3
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090312_0.c
@@ -0,0 +1,43 @@
+/* { dg-lto-do link } */
+extern int **foo (void);
+extern void mumble (char*, char*, char*);
+
+static int *
+bar (char **sp)
+{
+ char *s = *sp, *rs = s;
+ int c;
+ while (*foo ()[c])
+ rs++;
+ while (c = *rs)
+ {
+ if (c || ((c == '"') || (c == '\'')))
+ {
+ if (c)
+ *rs++ = c;
+ else
+ mumble (0, "", "");
+ }
+ else if (c || (*foo ()[c] & 1))
+ *rs++ = c;
+ }
+ if (c)
+ mumble (0, "", "");
+}
+
+static void
+baz (char *s)
+{
+ char *args[100];
+ while (bar (&s))
+ {
+ mumble (args[0], "", "");
+ }
+}
+
+int
+main (void)
+{
+ baz ("");
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090312_1.c b/gcc/testsuite/gcc.dg/lto/20090312_1.c
new file mode 100644
index 00000000000..882fb0f4157
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090312_1.c
@@ -0,0 +1,9 @@
+int **foo (void)
+{
+
+}
+
+void mumble (char* a, char* b , char* c)
+{
+
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090313_0.c b/gcc/testsuite/gcc.dg/lto/20090313_0.c
new file mode 100644
index 00000000000..120ba3c50e0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090313_0.c
@@ -0,0 +1,9 @@
+void
+_cairo_clip_path_reference () {
+ int a;
+ __sync_fetch_and_add(&a, 1);
+}
+
+int main(void) {
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090706-1_0.c b/gcc/testsuite/gcc.dg/lto/20090706-1_0.c
new file mode 100644
index 00000000000..7877fd350d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090706-1_0.c
@@ -0,0 +1,42 @@
+#include <stdarg.h>
+
+extern void abort (void);
+
+void foo (int size, ...)
+{
+ struct
+ {
+ struct
+ {
+ char x[size];
+ } e;
+ unsigned r;
+ } d;
+ va_list ap;
+ char c;
+ int i;
+
+ va_start (ap, size);
+ d = va_arg (ap, typeof (d));
+ c = d.e.x[3];
+ if (c != '3')
+ abort ();
+ if (d.r != 2602)
+ abort ();
+ va_end (ap);
+}
+
+int main (void)
+{
+ int z = 5, i;
+ struct { struct { char a[z]; } y; unsigned r; } x;
+
+ x.y.a[0] = '0';
+ x.y.a[1] = '1';
+ x.y.a[2] = '2';
+ x.y.a[3] = '3';
+ x.y.a[4] = '4';
+ x.r = 2602;
+ foo (z, x);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090706-2_0.c b/gcc/testsuite/gcc.dg/lto/20090706-2_0.c
new file mode 100644
index 00000000000..69da98b5cca
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090706-2_0.c
@@ -0,0 +1,16 @@
+extern void abort (void);
+
+int foo (int size)
+{
+ int a[size];
+ a[size - 10] = 42;
+ return a[size - 10] + size;
+}
+
+main()
+{
+ int x = foo (20);
+ if (x != 62)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090717_0.c b/gcc/testsuite/gcc.dg/lto/20090717_0.c
new file mode 100644
index 00000000000..fe13bdf78d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090717_0.c
@@ -0,0 +1,4 @@
+struct variable {
+ const char *string;
+};
+struct variable table[] = { };
diff --git a/gcc/testsuite/gcc.dg/lto/20090717_1.c b/gcc/testsuite/gcc.dg/lto/20090717_1.c
new file mode 100644
index 00000000000..bda8138214b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090717_1.c
@@ -0,0 +1,11 @@
+struct variable {
+ const char *string;
+};
+extern struct variable table[];
+int main(int argc, char *argv[])
+{
+ struct variable *p;
+ for(p = table; p->string; p++)
+ ;
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090729_0.c b/gcc/testsuite/gcc.dg/lto/20090729_0.c
new file mode 100644
index 00000000000..05ae74f872e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090729_0.c
@@ -0,0 +1,4 @@
+/* { dg-lto-options "-w" } */
+
+double i;
+int j;
diff --git a/gcc/testsuite/gcc.dg/lto/20090729_1.c b/gcc/testsuite/gcc.dg/lto/20090729_1.c
new file mode 100644
index 00000000000..0a5091ac29e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090729_1.c
@@ -0,0 +1,4 @@
+double j;
+int i;
+int main () { return i; }
+
diff --git a/gcc/testsuite/gcc.dg/lto/20090812_0.c b/gcc/testsuite/gcc.dg/lto/20090812_0.c
new file mode 100644
index 00000000000..baf20f520a2
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090812_0.c
@@ -0,0 +1,11 @@
+struct X;
+struct Y
+{
+ struct X *p;
+ int i;
+};
+
+void foo (struct Y *p)
+{
+ p->i = 1;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090812_1.c b/gcc/testsuite/gcc.dg/lto/20090812_1.c
new file mode 100644
index 00000000000..e91424492a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090812_1.c
@@ -0,0 +1,26 @@
+/* struct X is complete in this TU, this causes us to not merge Y and
+ thus assign different alias-sets to them. */
+struct X
+{
+ int i;
+};
+struct Y
+{
+ struct X *p;
+ int i;
+};
+extern void abort (void);
+extern void foo(struct Y *);
+int __attribute__((noinline)) bar(struct Y *p)
+{
+ p->i = 0;
+ foo (p);
+ return p->i;
+}
+int main()
+{
+ struct Y y;
+ if (bar (&y) != 1)
+ abort ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/20090914-1_0.c b/gcc/testsuite/gcc.dg/lto/20090914-1_0.c
new file mode 100644
index 00000000000..ef9f7b35182
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/20090914-1_0.c
@@ -0,0 +1,13 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-flto -g -fvar-tracking-assignments}} } */
+/* { dg-suppress-ld-options "-g -fvar-tracking-assignments" } */
+
+void foo()
+{
+ int hex = 0x4;
+}
+
+int main()
+{
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/lto/README b/gcc/testsuite/gcc.dg/lto/README
new file mode 100644
index 00000000000..1a13dd92c62
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/README
@@ -0,0 +1,35 @@
+This directory contains tests for link-time optimization (LTO).
+Tests in this directory may span multiple files, so the naming of
+the files is significant.
+
+The name of every file must end with '_N' where N is an integer.
+All the files with the same name base and different _N suffixes
+will be compiled separately and linked together to form the final
+executable.
+
+By default, each set of files will be compiled with list of
+options listed in LTO_OPTIONS (../../lib/lto.exp), which can be
+overwritten in the shell environment or using the 'dg-lto-options'
+command in the main file of the set (i.e., the file with _0
+suffix).
+
+For example, given the files a_0.C a_1.C a_2.C, they will be
+compiled as:
+
+$ g++ -c <flags> a_0.C
+$ g++ -c <flags> a_1.C
+$ g++ -c <flags> a_2.C
+$ g++ -o <executable> a_0.o a_1.o a_2.o
+
+Tests that do not need more than one file are a special case
+where there is a single file named 'foo_0.C'.
+
+The only supported dg-lto-do option are 'assemble', 'run' and 'link'.
+Additionally, these can only be used in the main file. If
+'assemble' is used, only the individual object files are
+generated. If 'link' is used, the final executable is generated
+but not executed (in this case, function main() needs to exist
+but it does not need to do anything). If 'run' is used, the
+final executable is generated and the resulting binary executed.
+
+The default value for dg-lto-do is 'run'.
diff --git a/gcc/testsuite/gcc.dg/lto/lto.exp b/gcc/testsuite/gcc.dg/lto/lto.exp
new file mode 100644
index 00000000000..0e343c19b77
--- /dev/null
+++ b/gcc/testsuite/gcc.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 gcc.exp
+
+# Load the language-independent compabibility support procedures.
+load_lib lto.exp
+
+gcc_init
+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 "c_lto"
+
+# If LTO has not been enabled, bail.
+if { ![check_effective_target_lto] } {
+ return
+}
+
+# Main loop.
+foreach src [lsort [find $srcdir/$subdir *_0.c]] {
+ # 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/gcc.target/i386/math-torture/math-torture.exp b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp
index 78831374455..9b97ccb1b38 100644
--- a/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp
+++ b/gcc/testsuite/gcc.target/i386/math-torture/math-torture.exp
@@ -52,7 +52,7 @@ load_lib gcc-dg.exp
load_lib torture-options.exp
torture-init
-set-torture-options $MATH_TORTURE_OPTIONS
+set-torture-options $MATH_TORTURE_OPTIONS {{}} $LTO_TORTURE_OPTIONS
dg-init
gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] ""
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/lib/c-torture.exp b/gcc/testsuite/lib/c-torture.exp
index 769ec97d3ec..8b15b577005 100644
--- a/gcc/testsuite/lib/c-torture.exp
+++ b/gcc/testsuite/lib/c-torture.exp
@@ -17,6 +17,7 @@
# This file was written by Rob Savoye. (rob@cygnus.com)
+load_lib target-supports.exp
load_lib file-format.exp
load_lib target-libpath.exp
@@ -49,6 +50,14 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] {
[concat $C_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
}
+set LTO_TORTURE_OPTIONS ""
+if [check_effective_target_lto] {
+ set LTO_TORTURE_OPTIONS [list \
+ { -O2 -flto } \
+ { -O2 -fwhopr }
+ ]
+}
+
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp
index feec5058214..4acfdfec8ff 100644
--- a/gcc/testsuite/lib/gcc-dg.exp
+++ b/gcc/testsuite/lib/gcc-dg.exp
@@ -60,6 +60,15 @@ if [info exists ADDITIONAL_TORTURE_OPTIONS] {
[concat $DG_TORTURE_OPTIONS $ADDITIONAL_TORTURE_OPTIONS]
}
+set LTO_TORTURE_OPTIONS ""
+if [check_effective_target_lto] {
+ set LTO_TORTURE_OPTIONS [list \
+ { -O2 -flto } \
+ { -O2 -fwhopr }
+ ]
+}
+
+
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
@@ -241,9 +250,9 @@ proc gcc-dg-runtest { testcases default-extra-flags } {
# Some callers set torture options themselves; don't override those.
set existing_torture_options [torture-options-exist]
if { $existing_torture_options == 0 } {
- global DG_TORTURE_OPTIONS
+ global DG_TORTURE_OPTIONS LTO_TORTURE_OPTIONS
torture-init
- set-torture-options $DG_TORTURE_OPTIONS
+ set-torture-options $DG_TORTURE_OPTIONS [list {}] $LTO_TORTURE_OPTIONS
}
dump-torture-options
diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp
new file mode 100644
index 00000000000..7f2d7ecec83
--- /dev/null
+++ b/gcc/testsuite/lib/lto.exp
@@ -0,0 +1,501 @@
+# 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>
+
+
+# lto_init -- called at the start of eac subdir of tests
+
+proc lto_init { args } {
+ global LTO_OPTIONS
+
+ # Each test is run with the compiler options from this list.
+ # The default option lists can be overridden by LTO_OPTIONS="[list
+ # {opts_1} {opts_2}... {opts_n}]" where opts_i are lists of options.
+ # You can put this in the environment before site.exp is written or
+ # add it to site.exp directly.
+ if ![info exists LTO_OPTIONS] {
+ set LTO_OPTIONS [list \
+ {-O0 -fwhopr} \
+ {-O2 -fwhopr} \
+ {-O0 -flto} \
+ {-O2 -flto} \
+ ]
+ }
+}
+
+
+# Subsets of tests can be selectively disabled by members of this list:
+# - ATTRIBUTE: disable all tests using the __attribute__ extension,
+# - COMPLEX: disable all tests using the complex types feature,
+# - COMPLEX_INT: disable all tests using the complex integral types extension,
+# - VA: disable all tests using the variable number of arguments feature,
+# - VLA_IN_STRUCT: disable all tests using the variable-length arrays as
+# structure members extension,
+# - ZERO_ARRAY: disable all tests using the zero-sized arrays extension.
+# The default skip lists can be overriden by
+# LTO_SKIPS="[list {skip_1}...{skip_n}]"
+# where skip_i are skip identifiers. You can put this in the environment
+# before site.exp is written or add it to site.exp directly.
+if ![info exists LTO_SKIPS] {
+ set LTO_SKIPS [list {}]
+}
+
+global lto_skip_list
+set lto_skip_list $LTO_SKIPS
+
+load_lib dg.exp
+load_lib gcc-dg.exp
+
+# lto-obj -- compile to an object file
+#
+# SOURCE is the source file
+# DEST is the object file
+# OPTALL is the list of compiler options to use with all tests
+# OPTFILE is the list of compiler options to use with this file
+# OPTSTR is the options to print with test messages
+# XFAILDATA is the xfail data to be passed to the compiler
+proc lto-obj { source dest optall optfile optstr xfaildata } {
+ global testcase
+ global tool
+ global compiler_conditional_xfail_data
+ global lto_skip_list
+
+ # Add the skip specifiers.
+ foreach skip $lto_skip_list {
+ if { ![string match $skip ""] } {
+ lappend optall "-DSKIP_$skip"
+ }
+ }
+
+ # Set up the options for compiling this file.
+ set options ""
+ lappend options "additional_flags=$optall $optfile"
+
+ set compiler_conditional_xfail_data $xfaildata
+ set comp_output [${tool}_target_compile "$source" "$dest" object $options]
+ ${tool}_check_compile "$testcase $dest assemble" $optstr $dest $comp_output
+}
+
+# lto-link-and-maybe-run -- link the object files and run the executable
+# if compile_type is set to "run"
+#
+# TESTNAME is the mixture of object files to link
+# OBJLIST is the list of object files to link
+# DEST is the name of the executable
+# OPTALL is a list of compiler and linker options to use for all tests
+# OPTFILE is a list of compiler and linker options to use for this test
+# OPTSTR is the list of options to list in messages
+proc lto-link-and-maybe-run { testname objlist dest optall optfile optstr } {
+ global testcase
+ global tool
+ global compile_type
+
+ # Check that all of the objects were built successfully.
+ foreach obj [split $objlist] {
+ if ![file_on_host exists $obj] then {
+ unresolved "$testcase $testname link $optstr"
+ unresolved "$testcase $testname execute $optstr"
+ return
+ }
+ }
+
+ # Set up the options for linking this test.
+ set options ""
+ lappend options "additional_flags=$optall $optfile"
+
+ # Link the objects into an executable.
+ set comp_output [${tool}_target_compile "$objlist" $dest executable \
+ "$options"]
+ if ![${tool}_check_compile "$testcase $testname link" "" \
+ $dest $comp_output] then {
+ unresolved "$testcase $testname execute $optstr"
+ return
+ }
+
+ # Return if we only needed to link.
+ if { ![string compare "link" $compile_type] } {
+ return
+ }
+
+ # Run the self-checking executable.
+ if ![string match "*/*" $dest] then {
+ set dest "./$dest"
+ }
+ set result [${tool}_load $dest "" ""]
+ set status [lindex $result 0]
+ if { $status == "pass" } then {
+ file_on_host delete $dest
+ }
+ $status "$testcase $testname execute $optstr"
+}
+
+# lto-get-options-main -- get target requirements for a test and
+# options for the primary source file and the test as a whole
+#
+# SRC is the full pathname of the primary source file.
+proc lto-get-options-main { src } {
+ global compile_type
+ global dg-extra-ld-options
+ global dg-suppress-ld-options
+
+ set dg-extra-ld-options ""
+ set dg-suppress-ld-options ""
+
+ # dg-options sets a variable called dg-extra-tool-flags.
+ set dg-extra-tool-flags ""
+
+ # dg-options sets a variable called tool_flags.
+ set tool_flags ""
+
+ # dg-require-* sets dg-do-what.
+ upvar dg-do-what dg-do-what
+ upvar dg-final-code dg-final-code
+ set dg-final-code ""
+
+ set tmp [dg-get-options $src]
+ verbose "getting options for $src: $tmp"
+ foreach op $tmp {
+ set cmd [lindex $op 0]
+ verbose "cmd is $cmd"
+ if { [string match "dg-skip-if" $cmd] \
+ || [string match "dg-require-*" $cmd] } {
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ perror "src: $errmsg for \"$op\"\n"
+ unresolved "$src: $errmsg for \"$op\""
+ return
+ }
+ } elseif { [string match "dg-lto-options" $cmd] } {
+ set op [lreplace $op 0 0 "dg-options"]
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ perror "src: $errmsg for \"$op\"\n"
+ unresolved "$src: $errmsg for \"$op\""
+ return
+ }
+ } elseif { ![string compare "dg-xfail-if" $cmd] \
+ || ![string compare "dg-options" $cmd] } {
+ warning "lto.exp does not support $cmd in primary source file"
+ } elseif { ![string compare "dg-lto-do" $cmd] } {
+ set dgdo [lindex $op 2]
+ verbose "dg-lto-do command for \"$op\" is $dgdo"
+ if { ![string compare "assemble" $dgdo] } {
+ set compile_type "assemble"
+ } elseif { ![string compare "run" $dgdo] } {
+ set compile_type "run"
+ } elseif { ![string compare "link" $dgdo] } {
+ set compile_type "link"
+ } else {
+ warning "lto.exp does not support dg-lto-do $dgdo"
+ }
+ } elseif { ![string compare "dg-extra-ld-options" $cmd] } {
+ set dg-extra-ld-options [lindex $op 2]
+ verbose "dg-extra-ld-options for main is ${dg-extra-ld-options}"
+ } elseif { ![string compare "dg-suppress-ld-options" $cmd] } {
+ set dg-suppress-ld-options [lindex $op 2]
+ verbose \
+ "dg-suppress-ld-options for main is ${dg-suppress-ld-options}"
+ } elseif { ![string compare "dg-final" $cmd] } {
+ if { [llength $op] > 3 } {
+ error "[lindex $op 0]: too many arguments"
+ } else {
+ append dg-final-code "[lindex $op 2]\n"
+ }
+ } else {
+ # Ignore unrecognized dg- commands, but warn about them.
+ warning "lto.exp does not support $cmd"
+ }
+ }
+
+ # Return flags to use for compiling the primary source file and for
+ # linking.
+ verbose "dg-extra-tool-flags for main is ${dg-extra-tool-flags}"
+ return ${dg-extra-tool-flags}
+}
+
+
+# lto-get-options -- get special tool flags to use for a secondary
+# source file
+#
+# SRC is the full pathname of the source file.
+# The result is a list of options to use.
+#
+# This code is copied from proc dg-test in dg.exp from DejaGNU.
+proc lto-get-options { src } {
+ # dg-options sets a variable called dg-extra-tool-flags.
+ set dg-extra-tool-flags ""
+
+ # dg-xfail-if sets compiler_conditional_xfail_data.
+ global compiler_conditional_xfail_data
+ set compiler_conditional_xfail_data ""
+
+ # dg-xfail-if needs access to dg-do-what.
+ upvar dg-do-what dg-do-what
+
+ set tmp [dg-get-options $src]
+ foreach op $tmp {
+ set cmd [lindex $op 0]
+ if { ![string compare "dg-options" $cmd] \
+ || ![string compare "dg-xfail-if" $cmd] } {
+ set status [catch "$op" errmsg]
+ if { $status != 0 } {
+ perror "src: $errmsg for \"$op\"\n"
+ unresolved "$src: $errmsg for \"$op\""
+ return
+ }
+ } elseif { [string match "dg-require-*" $cmd] } {
+ warning "lto.exp does not support $cmd in secondary source files"
+ } else {
+ # Ignore unrecognized dg- commands, but warn about them.
+ warning "lto.exp does not support $cmd in secondary source files"
+ }
+ }
+
+ return ${dg-extra-tool-flags}
+}
+
+# lto-execute -- compile multi-file tests
+#
+# SRC1 is the full pathname of the main file of the testcase.
+# SID identifies a test suite in the names of temporary files.
+proc lto-execute { src1 sid } {
+ global srcdir tmpdir
+ global option_list
+ global tool
+ global verbose
+ global testcase
+ global gluefile
+ global compiler_conditional_xfail_data
+ global dg-do-what-default
+ global compile_type
+ global dg-extra-ld-options
+ global dg-suppress-ld-options
+ global LTO_OPTIONS
+ global dg-final-code
+
+ # Get extra flags for this test from the primary source file, and
+ # process other dg-* options that this suite supports. Warn about
+ # unsupported flags.
+ verbose "lto-execute: $src1" 1
+ set compile_type "run"
+ set dg-do-what [list ${dg-do-what-default} "" P]
+ set extra_flags(0) [lto-get-options-main $src1]
+ set compile_xfail(0) ""
+
+ # If the main file defines dg-options, those flags are used to
+ # overwrite the default option_list taken from LTO_OPTIONS.
+ if { [string length $extra_flags(0)] > 0 } {
+ set option_list $extra_flags(0)
+ set extra_flags(0) ""
+ } else {
+ set option_list $LTO_OPTIONS
+ }
+
+ # Check whether this test is supported for this target.
+ if { [lindex ${dg-do-what} 1 ] == "N" } {
+ unsupported "$src1"
+ verbose "$src1 not supported on this target, skipping it" 3
+ return
+ }
+
+ # Set up the names of the other source files.
+ set dir [file dirname $src1]
+ set base [file rootname $src1]
+ set base [string range $base [string length $dir] end]
+ regsub "_0" $base "" base
+ regsub "/" $base "" base
+ set src_list $src1
+ set i 1
+ set done 0
+ while { !$done } {
+ set names [glob -nocomplain -types f -- "${dir}/${base}_${i}.*"]
+ if { [llength ${names}] > 1 } {
+ warning "lto-execute: more than one file matched ${dir}/${base}_${i}.*"
+ }
+ if { [llength ${names}] == 1 } {
+ lappend src_list [lindex ${names} 0]
+ incr i
+ } else {
+ set num_srcs ${i}
+ set done 1
+ }
+ }
+
+ # Use the dg-options mechanism to specify extra flags for each
+ # of the secondary files.
+ # The extra flags in each file are used to compile that file, and the
+ # extra flags in *_0.* are also used for linking.
+ verbose "\tsrc_list is: $src_list"
+ for {set i 1} {$i < $num_srcs} {incr i} {
+ set extra_flags($i) [lto-get-options [lindex $src_list $i]]
+ set compile_xfail($i) $compiler_conditional_xfail_data
+ }
+
+ # Define the names of the object files.
+ set obj_list ""
+ for {set i 0} {$i < $num_srcs} {incr i} {
+ lappend obj_list "${sid}_${base}_${i}.o"
+ }
+
+ # Get the base name of this test, for use in messages.
+ set testcase [lindex ${src_list} 0]
+
+ # Remove the $srcdir and $tmpdir prefixes from $src1. (It would
+ # be possible to use "regsub" here, if we were careful to escape
+ # all regular expression characters in $srcdir and $tmpdir, but
+ # that would be more complicated that this approach.)
+ if {[string first "$srcdir/" "${testcase}"] == 0} {
+ set testcase [string range "${testcase}" [string length "$srcdir/"] end]
+ }
+ if {[string first "$tmpdir/" "$testcase"] == 0} {
+ set testcase [string range "$testcase" [string length "$tmpdir/"] end]
+ set testcase "tmpdir-$testcase"
+ }
+ regsub "_0.*" $testcase "" testcase
+
+ # Set up the base name of executable files so they'll be unique.
+ regsub -all "\[./\]" $testcase "-" execbase
+
+ # If we couldn't rip $srcdir out of `src1' then just do the best we can.
+ # The point is to reduce the unnecessary noise in the logs. Don't strip
+ # out too much because different testcases with the same name can confuse
+ # `test-tool'.
+ if [string match "/*" $testcase] then {
+ set testcase "[file tail [file dirname $src1]]/[file tail $src1]"
+ }
+
+ # Loop through all of the option lists used for this test.
+ set count 0
+ foreach option $option_list {
+ verbose "Testing $testcase, $option"
+
+ # There's a unique name for each executable we generate.
+ set execname "${execbase}-${count}1"
+ incr count
+
+ file_on_host delete $execname
+
+ # Compile pieces with the compiler under test.
+ set i 0
+ foreach src $src_list obj $obj_list {
+ lto-obj $src $obj $option $extra_flags($i) $option \
+ $compile_xfail($i)
+ incr i
+ }
+
+ # Link (using the compiler under test), run, and clean up tests.
+ if { ![string compare "run" $compile_type] \
+ || ![string compare "link" $compile_type] } {
+
+ # Filter out any link options we were asked to suppress.
+ set reduced {}
+ foreach x [split $option] {
+ if {[lsearch ${dg-suppress-ld-options} $x] == -1} {
+ lappend reduced $x
+ }
+ }
+ set filtered [join $reduced " "]
+
+ lto-link-and-maybe-run \
+ "[lindex $obj_list 0]-[lindex $obj_list end]" \
+ $obj_list $execname $filtered ${dg-extra-ld-options} \
+ $filtered
+ }
+
+
+ # Are there any further tests to perform?
+ # Note that if the program has special run-time requirements, running
+ # of the program can be delayed until here. Ditto for other situations.
+ # It would be a bit cumbersome though.
+
+ if ![string match ${dg-final-code} ""] {
+ regsub -all "\\\\(\[{}\])" ${dg-final-code} "\\1" dg-final-code
+ # Note that the use of `args' here makes this a varargs proc.
+ proc dg-final-proc { args } ${dg-final-code}
+ verbose "Running dg-final tests." 3
+ verbose "dg-final-proc:\n[info body dg-final-proc]" 4
+ if [catch "dg-final-proc $src1" errmsg] {
+ perror "$name: error executing dg-final: $errmsg"
+ # ??? The call to unresolved here is necessary to clear
+ # `errcnt'. What we really need is a proc like perror that
+ # doesn't set errcnt. It should also set exit_status to 1.
+ unresolved "$name: error executing dg-final: $errmsg"
+ }
+ }
+
+ # Clean up object files.
+ set files [glob -nocomplain ${sid}_*.o]
+ if { $files != "" } {
+ foreach objfile $files {
+ if { ![info exists gluefile] || $objfile != $gluefile } {
+ eval "file_on_host delete $objfile"
+ }
+ }
+ }
+
+ if { ![string compare "run" $compile_type] \
+ || ![string compare "link" $compile_type] } {
+ file_on_host delete $execname
+ }
+ }
+}
+
+# Utility for scanning a symbol in the final executable, invoked via dg-final.
+# Call pass if pattern is present, otherwise fail.
+#
+# Argument 0 is the regexp to match.
+# Argument 1 handles expected failures and the like
+proc scan-symbol { args } {
+ global nm
+ global base_dir
+ upvar 2 execname execname
+
+ if { [llength $args] >= 2 } {
+ switch [dg-process-target [lindex $args 1]] {
+ "S" { }
+ "N" { return }
+ "F" { setup_xfail "*-*-*" }
+ "P" { }
+ }
+ }
+
+ # Find nm like we find g++ in g++.exp.
+ if ![info exists nm] {
+ set nm [findfile $base_dir/../../../binutils/nm \
+ $base_dir/../../../binutils/nm \
+ [findfile $base_dir/../../nm $base_dir/../../nm \
+ [findfile $base_dir/nm $base_dir/nm \
+ [transform nm]]]]
+ verbose -log "nm is $nm"
+ }
+
+ set output_file $execname
+ if { $output_file == "" } {
+ fail "scan-symbol $args: dump file does not exist"
+ return
+ }
+
+ set fd [open "| $nm $output_file" r]
+ set text [read $fd]
+ close $fd
+
+ if [regexp -- [lindex $args 0] $text] {
+ pass "scan-symbol $args"
+ } else {
+ fail "scan-symbol $args"
+ }
+}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 5272bcd3791..26ef7b7038e 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -3093,6 +3093,14 @@ proc check_effective_target_correct_iso_cpp_string_wchar_protos { } {
}]
}
+# Return 1 if the compiler has been configure with link-time optimization
+# (LTO) support.
+
+proc check_effective_target_lto { } {
+ global ENABLE_LTO
+ return [info exists ENABLE_LTO]
+}
+
# Return 1 if the MPC library is integrated with GCC, 0 otherwise.
proc check_effective_target_mpc { } {
diff --git a/gcc/testsuite/lib/torture-options.exp b/gcc/testsuite/lib/torture-options.exp
index 7721f901bfe..f3b3e22948b 100644
--- a/gcc/testsuite/lib/torture-options.exp
+++ b/gcc/testsuite/lib/torture-options.exp
@@ -48,12 +48,14 @@ proc contains-loop-option-p { arg } {
#
# Argument 0 is the list to use as torture options
# Argument 1 is the list to combine with the torture options.
+# Argument 2 is the list to be appended to the torture options after
+# combining argument 0 and 1.
proc set-torture-options { args } {
global torture_with_loops torture_without_loops
set torture_list [lindex $args 0]
- if { [llength $args] != 1 } {
+ if { [llength $args] > 1 } {
set other_list [lindex $args 1]
} else {
set other_list [list {}]
@@ -71,6 +73,12 @@ proc set-torture-options { args } {
lappend torture_with_loops "$torture_opts $other_opts"
}
}
+
+ if { [llength $args] > 2 } {
+ set append_list [lindex $args 2]
+ append torture_with_loops " $append_list"
+ append torture_without_loops " $append_list"
+ }
}
# Finish up after using a set of torture options.