diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-09 15:21:54 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-10-09 15:21:54 +0000 |
commit | 27e0321aadb8c2c656af795612836cf896f0557d (patch) | |
tree | 7624fc2d71c047c04fe2c3c927b645f19760fdee /gcc/testsuite | |
parent | cf4848768d6fbbbaec367eb8107504f1803091e2 (diff) | |
download | gcc-27e0321aadb8c2c656af795612836cf896f0557d.tar.gz |
2009-10-09 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 152583 after the LTO merge
inside trunk.
[during merge with trunk 152583 the version information from GCC
is used, not the checksum of the executable!]
* gcc/melt-runtime.h (melt_gccversionstr): added extern declaration.
* gcc/melt-runtime.c: Moved the #include before everything else.
Updated comment NOTE about gengtype - which is now compatible
with the trunk's.
(melt_gccversionstr): added declaration.
(load_checked_dynamic_module_index): use a gcc version string in
modules, not a checksum of the executable.
(melt_really_initialize): get a second argument for the gcc
version string. Initialize melt_gccversionstr with it.
(plugin_init): Build the gccversionstr out of gcc_version
structure.
(melt_initialize): calls melt_really_initialize with
version_string.
(melt_output_cfile_decl_impl): generates a genversionstr_melt
instead of a genchecksum_melt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@152591 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
282 files changed, 5150 insertions, 151 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4bbabcb3fce..f7872c97995 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,433 @@ +2009-10-08 Doug Kwan <dougkwan@google.com> + + PR rtl-optimization/41574 + * gcc.dg/pr41574.c: New test. + +2009-10-08 Cary Coutant <ccoutant@google.com> + + Add support for debugging with ICF (Identical Code Folding). + * g++.dg/debug/dwarf2/icf.C: New test. + +2009-10-08 Adam Nemet <anemet@caviumnetworks.com> + + * gcc.target/mips/truncate-6.c: New test. + +2009-10-08 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/rv-deduce.C: New. + + PR c++/37177 + * g++.dg/cpp0x/variadic-throw.C: Adjust errors. + * g++.dg/template/explicit-args2.C: New. + * g++.dg/template/explicit-args3.C: New. + * g++.old-deja/g++.pt/crash58.C: Remove some errors. + +2009-10-08 Michael Matz <matz@suse.de> + + PR middle-end/41573 + * gcc.dg/tree-ssa/foldstring-1.c: Use fre dump. + * gcc.dg/tree-ssa/useless-1.c: Use gimple dump. + * gcc.dg/pr41573.c: New test. + +2009-10-07 Joseph Myers <joseph@codesourcery.com> + + PR c/41182 + * gcc.c-torture/compile/pr41182-1.c: New. + +2009-10-07 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/variadic95.C: New. + +2009-10-07 Jason Merrill <jason@redhat.com> + + * g++.dg/template/scope3.C: New. + +2009-10-07 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/debug/dwarf2/inline3.c: New test. + +2009-10-07 Daniel Kraft <d@domob.eu> + + PR fortran/41615 + * gfortran.dg/assumed_charlen_function_6.f90: New test. + +2009-10-07 Janus Weil <janus@gcc.gnu.org> + + * gfortran.dg/same_type_as_2.f03: Modified (was illegal). + * gfortran.dg/select_type_1.f03: Modified error message. + * gfortran.dg/select_type_5.f03: New test. + +2009-10-06 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/41612 + * gfortran.dg/round_2.f03: Fix test to work on platforms that do not + have kind=10 reals. + +2009-10-06 Jason Merrill <jason@redhat.com> + + * g++.dg/cpp0x/lambda/lambda-init.C: New. + * g++.dg/cpp0x/lambda/lambda-direct-init.C: New. + +2009-10-06 Richard Guenther <rguenther@suse.de> + + PR lto/41502 + * gcc.dg/lto/20091006-1_0.c: New testcase. + * gcc.dg/lto/20091006-1_1.c: Likewise. + * gcc.dg/lto/20091005-2_0.c: Likewise. + +2009-10-06 Samuel Tardieu <sam@rfc1149.net> + + PR ada/41383 + * gnat.dg/timer_cancel.adb: New test. + +2009-10-06 Samuel Tardieu <sam@rfc1149.net> + + PR ada/38333 + * gnat.dg/specs/import_abstract.ads: New. + +2009-10-05 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR libgfortran/35862 + * gfortran.dg/round_2.f03: New test. + +2009-10-05 Jakub Jelinek <jakub@redhat.com> + + PR debug/41558 + * gcc.dg/guality/guality.exp: Move gdb-test proc into... + * lib/gcc-gdb-test.exp: ... here. New file. + * gfortran.dg/guality/guality.exp: New file. + * gfortran.dg/guality/pr41558.f90: New test. + * gfortran.dg/guality/arg1.f90: New test. + +2009-10-05 Paul Thomas <pault@gcc.gnu.org> + + * gfortran.dg/dynamic_dispatch_1.f90: New test. + * gfortran.dg/dynamic_dispatch_2.f90: New test. + * gfortran.dg/dynamic_dispatch_3.f90: New test. + * gfortran.dg/module_md5_1.f90: Update md5 sum. + +2009-10-05 Sriraman Tallam <tmsriram@google.com> + + * gcc.dg/plugin/selfassign.c (plugin_init): Change plugin_pass to + register_pass_info. + * gcc.dg/plugin/one_time_plugin.c (plugin_init): Change + plugin_pass to register_pass_info. + * g++.dg/plugin/selfassign.c (plugin_init): Change plugin_pass to + register_pass_info. + * g++.dg/plugin/dumb_plugin.c (plugin_init): Change plugin_pass to + register_pass_info. + +2009-10-05 Richard Guenther <rguenther@suse.de> + + PR lto/41281 + * gcc.dg/lto/20090914-2_0.c: New testcase. + +2009-10-05 Richard Guenther <rguenther@suse.de> + + PR lto/40902 + * gcc.dg/lto/20091005-1_0.c: New testcase. + * gcc.dg/lto/20091005-1_1.c: Likewise. + +2009-10-05 Richard Guenther <rguenther@suse.de> + + PR lto/41552 + PR lto/41487 + * g++.dg/lto/20091002-1_0.C: Adjust flags. + * g++.dg/lto/20091004-1_0.C: New testcase. + * g++.dg/lto/20091004-1_1.C: Likewise. + * g++.dg/lto/20091004-2_0.C: Likewise. + * g++.dg/lto/20091004-2_1.C: Likewise. + * g++.dg/lto/20091004-3_0.C: Likewise. + * g++.dg/lto/20091004-3_1.C: Likewise. + +2009-10-05 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/23821 + * gcc.dg/torture/pr23821.c: New testcase. + +2009-10-05 Daniel Kraft <d@domob.eu> + + PR fortran/41403 + * gfortran.dg/goto_6.f: New test. + * gfortran.dg/goto_7.f: New test. + +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 + * gcc.dg/tree-ssa/ipa-cp-1.c: Remove mis-merged garbage. + +2009-10-02 Jason Merrill <jason@redhat.com> + + * g++.dg/abi/mangle32.C: New. + +2009-10-02 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/atomic2.adb: New test. + +2009-10-02 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/array11.adb: New test. + * gnat.dg/array12.adb: Likewise. + +2009-10-02 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/array10.adb: New test. + * gnat.dg/object_overflow.adb: Tweak. + +2009-10-02 Jack Howarth <howarth@bromo.med.uc.edu> + + * gcc.dg/guality/guality.exp: Disable on darwin. + +2009-10-02 Janis Johnson <janis187@us.ibm.com> + + * c-c++-common/dfp/func-vararg-alternate-d32.c: Remove XFAIL. + * c-c++-common/dfp/func-vararg-dfp.c: Ditto. + * c-c++-common/dfp/func-vararg-mixed.c: Ditto. + * c-c++-common/dfp/func-vararg-mixed-2.c: Ditto. + +2009-10-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/41479 + * gfortran.dg/intent_out_5.f90: New test. + 2009-10-02 Jakub Jelinek <jakub@redhat.com> PR debug/41404 @@ -9,7 +439,7 @@ PR testsuite/41546 * gcc.target/i386/ifcvt-onecmpl-abs-1.c: Change -mtune=i586 - to -mtune=generic. + to -mtune=generic. 2009-10-01 Jan Hubicka <jh@suse.cz> @@ -224,7 +654,7 @@ * gcc.target/i386/avx-2.c * gcc.target/i386/sse-23.c: Remove comments to mmintrin-common.h. * gcc.target/i386/funcspec-9.c: Delete. - + 2009-09-29 Jakub Jelinek <jakub@redhat.com> * gcc.dg/guality/guality.exp (gdb-test): New proc for use in dg-final. @@ -273,7 +703,7 @@ 2009-09-28 Olivier Hainque <hainque@adacore.com> * gnat.dg (tagged_alloc_free.adb): New testcase. - + 2009-09-28 Janis Johnson <janis187@us.ibm.com> * g++.dg/dfp: New directory. @@ -850,8 +1280,7 @@ * gcc.dg/dfp/compare-special.h: Ditto. * gcc.dg/dfp/convert.h: Ditto. * gcc.dg/dfp/fe-check.h: Ditto. - * gcc.dg/dfp/call-by-value.c: Use default options and - debug macros. + * gcc.dg/dfp/call-by-value.c: Use default options and debug macros. * gcc.dg/dfp/cast.c: Ditto. * gcc.dg/dfp/compare-eq-const.c: Ditto. * gcc.dg/dfp/compare-eq-d32.c: Ditto. diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c index 225c13112a9..651b7e8c50f 100644 --- a/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c +++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-alternate-d32.c @@ -1,4 +1,3 @@ -/* { dg-xfail-run-if "32-bit vararg broken" { c++ } { "*" } { "" } } */ /* Simple test of vararg passing for problematic types with and without double values passed between them. */ diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c index 53285df9d64..5add1f7fd38 100644 --- a/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c +++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-dfp.c @@ -1,5 +1,3 @@ -/* { dg-xfail-run-if "32-bit vararg broken" { c++ } { "*" } { "" } } */ - /* C99 6.5.2.2 Function calls. Test passing varargs of the decimal float types. */ diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c index 9c6be638d2f..893cdae27ff 100644 --- a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c +++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed-2.c @@ -1,5 +1,4 @@ /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ -/* { dg-xfail-run-if "32-bit vararg broken" { c++ } { "*" } { "" } } */ /* { dg-options "-mpreferred-stack-boundary=2" } */ /* C99 6.5.2.2 Function calls. diff --git a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c index 032a105052b..1669eaf959a 100644 --- a/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c +++ b/gcc/testsuite/c-c++-common/dfp/func-vararg-mixed.c @@ -1,5 +1,3 @@ -/* { dg-xfail-run-if "32-bit vararg broken" { c++ } { "*" } { "" } } */ - /* C99 6.5.2.2 Function calls. Test passing varargs of the combination of decimal float types and other types. */ 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/abi/mangle32.C b/gcc/testsuite/g++.dg/abi/mangle32.C new file mode 100644 index 00000000000..de02887f997 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle32.C @@ -0,0 +1,41 @@ +// Testcase for mangling of unnamed types. + +// namespace-scope unnamed types have no linkage, so we only test that they +// are distinct. +typedef struct { } *A; +typedef struct { } *B; + +void f(A) { } +void f(B) { } + +struct C +{ + typedef struct { }* D; + typedef enum { }* E; +}; + +// { dg-final { scan-assembler "_Z2g1PN1CUt_E" } } +void g1(C::D) { } +// { dg-final { scan-assembler "_Z2g2PN1CUt0_E" } } +void g2(C::E) { } + +template <class T> +void h1(T t) { } + +template <class T> +void h2(T t) { } + +inline void j() +{ + typedef enum { }* F; +// { dg-final { scan-assembler "_Z2h1IPZ1jvEUt_EvT_" } } + h1(F()); + typedef struct { }* G; +// { dg-final { scan-assembler "_Z2h2IPZ1jvEUt0_EvT_" } } + h2(G()); +} + +int main() +{ + j(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C new file mode 100644 index 00000000000..bbc2a1ca52d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-direct-init.C @@ -0,0 +1,14 @@ +// Test that capture by copy uses direct-initialization. +// { dg-options "-std=c++0x" } + +struct A +{ + A(); + explicit A(const A&); +}; + +int main() +{ + A a; + [a]{}; +} diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C new file mode 100644 index 00000000000..03c94e95981 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-init.C @@ -0,0 +1,8 @@ +// Test for the explicit initializer extension +// { dg-options "-std=c++0x" } + +int main() +{ + int j = [i = 2]{sizeof(i); return i;}(); + return (j != 2); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/rv-deduce.C b/gcc/testsuite/g++.dg/cpp0x/rv-deduce.C new file mode 100644 index 00000000000..043543631ad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/rv-deduce.C @@ -0,0 +1,8 @@ +// PR c++/36816, core issue 873 +// { dg-options -std=c++0x } + +template <class T> void h (T&&) { } + +void (*pf)(int&) = &h; +template <> void h(char&); +template void h(double&); diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C index f2ff652d8a0..ee85bf2a569 100644 --- a/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C +++ b/gcc/testsuite/g++.dg/cpp0x/variadic-throw.C @@ -8,7 +8,7 @@ template<int M, int N> struct pair template<int... M> struct S { - template<int... N> static int foo() throw (pair <M, N>...) // { dg-error "mismatched|no matching" } + template<int... N> static int foo() throw (pair <M, N>...) // { dg-error "mismatched" } { return 1; } @@ -21,5 +21,5 @@ int bar () int wibble() { - return S<0, 1, 2>::foo<0, 1> (); + return S<0, 1, 2>::foo<0, 1> (); // { dg-error "no matching" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic95.C b/gcc/testsuite/g++.dg/cpp0x/variadic95.C new file mode 100644 index 00000000000..ebb04ebc10b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic95.C @@ -0,0 +1,17 @@ +// PR c++/39863 +// { dg-options -std=c++0x } + +template <typename... T> +struct A {}; + +template <typename T, typename U> +struct S {}; + +template <typename... T, typename... U> +A< S<T, U>... > f(U... u) +{ return A< S<T, U>... >(); } + +int main() +{ + f<int>(0.0); +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/icf.C b/gcc/testsuite/g++.dg/debug/dwarf2/icf.C new file mode 100644 index 00000000000..627b8347797 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/icf.C @@ -0,0 +1,50 @@ +// Test support for ICF debugging. +// { dg-do compile } +// { dg-options "-O0 -gdwarf-2 -fenable-icf-debug -dA" } + +class A +{ + public: + A(); + virtual void work(); + virtual int p(); + private: + int i; +}; + +class B +{ + public: + B(); + ~B(); + void work(const A* a); + private: + int j; +}; + +int +test1(A* a) +{ + a->work(); +} + +int +test2(A* a) +{ + if (a->p()) + { + B b; + b.work(a); + } +} + +// Verify that we get .debug_dcall and .debug_vcall tables generated +// and that we see entries for both virtual calls. +// { dg-final { scan-assembler "\\.section.*\.debug_dcall" } } +// { dg-final { scan-assembler "\\.section.*\.debug_vcall" } } +// { dg-final { scan-assembler "New caller" } } +// { dg-final { scan-assembler "Caller DIE offset" } } +// { dg-final { scan-assembler "Point of call" } } +// { dg-final { scan-assembler "Callee DIE offset" } } +// { dg-final { scan-assembler "0x0.*Vtable slot" } } +// { dg-final { scan-assembler "0x1.*Vtable slot" } } 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..ad1ecf673f5 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091002-1_0.C @@ -0,0 +1,58 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -flto}} } +// { 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/20091004-1_0.C b/gcc/testsuite/g++.dg/lto/20091004-1_0.C new file mode 100644 index 00000000000..d65cf29fff1 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-1_0.C @@ -0,0 +1,35 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -O -flto}} } + +typedef double Real; +class Vector { + int dimen; + Real* val; +public: + Vector& operator=(const Vector& vec); + Vector(int p_dimen, Real *p_val) + : dimen(p_dimen), val(p_val) { } + int dim() const; +}; +class DVector : public Vector { +public: + void reDim(int newdim); + explicit DVector(const Vector& old); + DVector& operator=(const Vector& vec) { + reDim(vec.dim()); + Vector::operator=(vec); + } +}; +Vector& Vector::operator=(const Vector& vec) +{ + dimen = vec.dimen; + val = vec.val; +} +int Vector::dim() const { return dimen; } +DVector::DVector(const Vector& old) : Vector(0, 0) +{ + *this = old; +} +void DVector::reDim(int newdim) {} +int main() {} + diff --git a/gcc/testsuite/g++.dg/lto/20091004-1_1.C b/gcc/testsuite/g++.dg/lto/20091004-1_1.C new file mode 100644 index 00000000000..0328abaae27 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-1_1.C @@ -0,0 +1,26 @@ +typedef double Real; +class Vector { + int dimen; + Real* val; +public: + Vector& operator=(const Vector& vec); + Vector(int p_dimen, Real *p_val) + : dimen(p_dimen), val(p_val) { } + int dim() const; +}; +class DVector : public Vector { +public: + void reDim(int newdim); + explicit DVector(const Vector& old); + DVector& operator=(const Vector& vec) { + reDim(vec.dim()); + Vector::operator=(vec); + } +}; +class SLUFactor { + DVector vec; + void solveRight (Vector& x, const Vector& b); +}; +void SLUFactor::solveRight (Vector& x, const Vector& b) { + vec = b; +} diff --git a/gcc/testsuite/g++.dg/lto/20091004-2_0.C b/gcc/testsuite/g++.dg/lto/20091004-2_0.C new file mode 100644 index 00000000000..321e50bc28d --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-2_0.C @@ -0,0 +1,29 @@ +// { dg-lto-do link } +// { dg-lto-options {{-fPIC -O -flto}} } + +typedef double Real; +class Vector { + int dimen; + Real* val; +public: + Vector& operator=(const Vector& vec); + Vector(int p_dimen, Real *p_val) + : dimen(p_dimen), val(p_val) { } + int dim() const; +}; +class DVector : public Vector { +public: + void reDim(int newdim); + explicit DVector(const Vector& old); + DVector& operator=(const Vector& vec) { + reDim(vec.dim()); + Vector::operator=(vec); + } +}; +class SLUFactor { + DVector vec; + void solveRight (Vector& x, const Vector& b); +}; +void SLUFactor::solveRight (Vector& x, const Vector& b) { + vec = b; +} diff --git a/gcc/testsuite/g++.dg/lto/20091004-2_1.C b/gcc/testsuite/g++.dg/lto/20091004-2_1.C new file mode 100644 index 00000000000..9bbcd51f754 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-2_1.C @@ -0,0 +1,32 @@ +typedef double Real; +class Vector { + int dimen; + Real* val; +public: + Vector& operator=(const Vector& vec); + Vector(int p_dimen, Real *p_val) + : dimen(p_dimen), val(p_val) { } + int dim() const; +}; +class DVector : public Vector { +public: + void reDim(int newdim); + explicit DVector(const Vector& old); + DVector& operator=(const Vector& vec) { + reDim(vec.dim()); + Vector::operator=(vec); + } +}; +Vector& Vector::operator=(const Vector& vec) +{ + dimen = vec.dimen; + val = vec.val; +} +int Vector::dim() const { return dimen; } +DVector::DVector(const Vector& old) : Vector(0, 0) +{ + *this = old; +} +void DVector::reDim(int newdim) {} +int main() {} + diff --git a/gcc/testsuite/g++.dg/lto/20091004-3_0.C b/gcc/testsuite/g++.dg/lto/20091004-3_0.C new file mode 100644 index 00000000000..124eea5e4eb --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-3_0.C @@ -0,0 +1,18 @@ +// { dg-lto-do assemble } +// { dg-lto-options {{-O -flto}} } + +extern "C" double sqrt (double __x) throw (); +typedef double VECTOR[3]; +enum { X = 0, Y = 1, Z = 2, T = 3 }; +inline void VLength(double& a, const VECTOR b) +{ + a = sqrt(b[X] * b[X] + b[Y] * b[Y] + b[Z] * b[Z]); +} +void +determine_subpatch_flatness(void) +{ + double temp1; + VECTOR TempV; + VLength(temp1, TempV); + VLength(temp1, TempV); +} diff --git a/gcc/testsuite/g++.dg/lto/20091004-3_1.C b/gcc/testsuite/g++.dg/lto/20091004-3_1.C new file mode 100644 index 00000000000..641c7495b4f --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20091004-3_1.C @@ -0,0 +1,16 @@ +extern "C" double sqrt (double __x) throw (); +typedef double VECTOR[3]; +enum { X = 0, Y = 1, Z = 2, T = 3 }; +inline void VLength(double& a, const VECTOR b) +{ + a = sqrt(b[X] * b[X] + b[Y] * b[Y] + b[Z] * b[Z]); +} +int +All_Torus_Intersections(void) +{ + double len; + VECTOR D; + VLength(len, D); + VLength(len, D); +} + 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/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c index 18f42c09dcb..8a160771b13 100644 --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c @@ -82,7 +82,7 @@ int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { - struct plugin_pass pass_info; + struct register_pass_info pass_info; const char *plugin_name = plugin_info->base_name; int argc = plugin_info->argc; struct plugin_argument *argv = plugin_info->argv; diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c index 2be48156d6d..6dade300ff0 100644 --- a/gcc/testsuite/g++.dg/plugin/selfassign.c +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c @@ -298,7 +298,7 @@ int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { - struct plugin_pass pass_info; + struct register_pass_info pass_info; const char *plugin_name = plugin_info->base_name; int argc = plugin_info->argc; struct plugin_argument *argv = plugin_info->argv; diff --git a/gcc/testsuite/g++.dg/template/explicit-args2.C b/gcc/testsuite/g++.dg/template/explicit-args2.C new file mode 100644 index 00000000000..cd53b456dcc --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-args2.C @@ -0,0 +1,38 @@ +// PR c++/37177 +// { dg-options -std=c++0x } + +namespace N1 +{ + template<class T> bool foo(); +} + +struct S +{ + template <class T> + static bool foo(); + + template <class T> + bool bar(); +}; + +template<class T> bool foo(); + +int main() +{ + (void)(&S::bar<int>); + decltype(&S::bar<int>) a; + + (void*)(&S::foo<int>); + (void)(&S::foo<int>); + decltype(&S::foo<int>) b; + + (void*)(&N1::foo<int>); + (void)(&N1::foo<int>); + decltype(&N1::foo<int>) c; + + (void*)(&foo<int>); + (void)(&foo<int>); + decltype(&foo<int>) d; + + &foo<int> == 0; +} diff --git a/gcc/testsuite/g++.dg/template/explicit-args3.C b/gcc/testsuite/g++.dg/template/explicit-args3.C new file mode 100644 index 00000000000..c095e6688fd --- /dev/null +++ b/gcc/testsuite/g++.dg/template/explicit-args3.C @@ -0,0 +1,12 @@ +// PR c++/37177 + +template <class T> +struct A { }; + +template <class T> +void operator+(T, T); // { dg-error "class or enum" } + +int main() +{ + operator+<int>; // { dg-error "cannot resolve" } +} diff --git a/gcc/testsuite/g++.dg/template/scope3.C b/gcc/testsuite/g++.dg/template/scope3.C new file mode 100644 index 00000000000..c191c79c5ce --- /dev/null +++ b/gcc/testsuite/g++.dg/template/scope3.C @@ -0,0 +1,15 @@ +// PR c++/41038 + +struct S +{ + int size() const; +}; + +template<typename T> +struct Packer +{ + int foo() { + return Packer::var.size(); + } + const S& var; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/crash58.C b/gcc/testsuite/g++.old-deja/g++.pt/crash58.C index 315f3e02896..0ce3d81723d 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/crash58.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/crash58.C @@ -15,16 +15,16 @@ struct MatrixC { void foo () { EManip::do_assign<T> (0); - &EManip::do_assign<T>; // { dg-error "" } unresolved - &do_assign<T>; // { dg-error "" } unresolved - EManip::do_assign<T>; // { dg-error "" } unresolved - do_assign<T>; // { dg-error "" } unresolved + &EManip::do_assign<T>; // { dg-bogus "" } unresolved + &do_assign<T>; // { dg-bogus "" } unresolved + EManip::do_assign<T>; // { dg-bogus "" } unresolved + do_assign<T>; // { dg-bogus "" } unresolved } }; void foo(MatrixC <double> *ptr) { - EManip::do_assign<double>; // { dg-error "" } unresolved - &EManip::do_assign<double>; // { dg-error "" } unresolved + EManip::do_assign<double>; // { dg-bogus "" } unresolved + &EManip::do_assign<double>; // { dg-bogus "" } unresolved ptr->foo (); void (*p1) (int *) = &do_assign<double>; // { dg-error "" } cannot convert void (*p2) (int *) = &EManip::do_assign<double>; // { dg-error "" } cannot convert diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c new file mode 100644 index 00000000000..017174938b3 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr41182-1.c @@ -0,0 +1,6 @@ +typedef long unsigned int size_t; +int _lae_process_opts(char *pr, char *pe) +{ + return (strlen ("on") < ((size_t) ((pe-&pr[2])>(strlen("on")) + ? (pe-&pr[2]) : (strlen("on"))))); +} 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/debug/dwarf2/inline3.c b/gcc/testsuite/gcc.dg/debug/dwarf2/inline3.c new file mode 100644 index 00000000000..feafb33e829 --- /dev/null +++ b/gcc/testsuite/gcc.dg/debug/dwarf2/inline3.c @@ -0,0 +1,22 @@ +/* Verify that only one DW_AT_const_value is emitted for baz, + not for baz abstract DIE and again inside of + DW_TAG_inlined_subroutine. */ +/* { dg-options "-O2 -g -dA" } */ +/* { dg-do compile } */ +/* { dg-final { scan-assembler-times " DW_AT_const_value" 1 } } */ + +struct A { const long i; const long j; }; + +static inline long +foo (void) +{ + const struct A baz = { .i = 2, .j = 21 }; + asm volatile ("" : : : "memory"); + return baz.i * baz.j; +} + +int +main () +{ + return foo () - 42; +} diff --git a/gcc/testsuite/gcc.dg/guality/guality.exp b/gcc/testsuite/gcc.dg/guality/guality.exp index b3f3319b102..d4ee6864ba4 100644 --- a/gcc/testsuite/gcc.dg/guality/guality.exp +++ b/gcc/testsuite/gcc.dg/guality/guality.exp @@ -1,6 +1,12 @@ # This harness is for tests that should be run at all optimisation levels. load_lib gcc-dg.exp +load_lib gcc-gdb-test.exp + +# Disable on darwin until radr://7264615 is resolved. +if { [istarget *-*-darwin*] } { + return +} proc check_guality {args} { set result [eval check_compile guality_check executable $args "-g -O0"] @@ -15,82 +21,6 @@ proc check_guality {args} { return $ret } -# Utility for testing variable values using gdb, invoked via dg-final. -# Call pass if variable has the desired value, otherwise fail. -# -# Argument 0 is the line number on which to put a breakpoint -# Argument 1 is the name of the variable to be checked -# Argument 2 is the expected value of the variable -# Argument 3 handles expected failures and the like -proc gdb-test { args } { - if { ![isnative] || [is_remote target] } { return } - - if { [llength $args] >= 4 } { - switch [dg-process-target [lindex $args 3]] { - "S" { } - "N" { return } - "F" { setup_xfail "*-*-*" } - "P" { } - } - } - - # This assumes that we are three frames down from dg-test, and that - # it still stores the filename of the testcase in a local variable "name". - # A cleaner solution would require a new DejaGnu release. - upvar 2 name testcase - upvar 2 prog prog - - set gdb_name $::env(GUALITY_GDB_NAME) - set testname "$testcase line [lindex $args 0] [lindex $args 1] == [lindex $args 2]" - set output_file "[file rootname [file tail $prog]].exe" - set cmd_file "[file rootname [file tail $prog]].gdb" - - set fd [open $cmd_file "w"] - puts $fd "break [lindex $args 0]" - puts $fd "run" - puts $fd "print [lindex $args 1]" - puts $fd "print [lindex $args 2]" - puts $fd "quit" - close $fd - - send_log "Spawning: $gdb_name -nx -nw -quiet -x $cmd_file ./$output_file\n" - set res [remote_spawn target "$gdb_name -nx -nw -quiet -x $cmd_file ./$output_file"] - if { $res < 0 || $res == "" } { - unsupported "$testname" - return - } - - remote_expect target [timeout_value] { - -re {[\n\r]\$1 = ([^\n\r]*)[\n\r]+\$2 = ([^\n\r]*)[\n\r]} { - set first $expect_out(1,string) - set second $expect_out(2,string) - if { $first == $second } { - pass "$testname" - } else { - send_log "$first != $second\n" - fail "$testname" - } - remote_close target - return - } - # Too old GDB - -re "Unhandled dwarf expression|Error in sourced command file" { - unsupported "$testname" - remote_close target - return - } - timeout { - unsupported "$testname" - remote_close target - return - } - } - - remote_close target - unsupported "$testname" - return -} - dg-init global GDB 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/20090914-2_0.c b/gcc/testsuite/gcc.dg/lto/20090914-2_0.c new file mode 100644 index 00000000000..f78ecf8899f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20090914-2_0.c @@ -0,0 +1,11 @@ +/* { dg-lto-do run { target x86_64-*-* i?86-*-* } } */ + +/* Doesn't work without this dummy function with -fwhopr. */ +int foo(void) { } + +asm(".text\n" + ".globl main\n" + "\t.type main,@function\n" + "main:\n" + "\txorl %eax, %eax\n" + "\tret\n"); diff --git a/gcc/testsuite/gcc.dg/lto/20091005-1_0.c b/gcc/testsuite/gcc.dg/lto/20091005-1_0.c new file mode 100644 index 00000000000..f4316efbc35 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091005-1_0.c @@ -0,0 +1,3 @@ +/* { dg-lto-do run } */ + +const int i[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; diff --git a/gcc/testsuite/gcc.dg/lto/20091005-1_1.c b/gcc/testsuite/gcc.dg/lto/20091005-1_1.c new file mode 100644 index 00000000000..52eb8e78b3f --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091005-1_1.c @@ -0,0 +1,2 @@ +extern int i[10]; +int main () { return i[0]; } diff --git a/gcc/testsuite/gcc.dg/lto/20091005-2_0.c b/gcc/testsuite/gcc.dg/lto/20091005-2_0.c new file mode 100644 index 00000000000..d1485d671d6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091005-2_0.c @@ -0,0 +1,11 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-fstrict-aliasing -flto}} } */ + +typedef struct { } t_commrec; +typedef struct { } t_fft_c; +void +solve_pme(t_commrec *cr) +{ + t_fft_c *ptr; +} +int main () { return 0; } diff --git a/gcc/testsuite/gcc.dg/lto/20091006-1_0.c b/gcc/testsuite/gcc.dg/lto/20091006-1_0.c new file mode 100644 index 00000000000..9b4356edc22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091006-1_0.c @@ -0,0 +1,14 @@ +/* { dg-lto-do link } */ + +typedef void (*fnt) (void); +void __attribute__((noinline)) bar (void) {} +extern inline void check3 (void) +{ + bar (); +} +void test (void) +{ + const fnt pcheck3 = check3; + pcheck3 (); +} +int main() { return 0; } diff --git a/gcc/testsuite/gcc.dg/lto/20091006-1_1.c b/gcc/testsuite/gcc.dg/lto/20091006-1_1.c new file mode 100644 index 00000000000..f82f827002a --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/20091006-1_1.c @@ -0,0 +1,2 @@ +extern void bar (void); +void check3 (void) { bar (); } 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.dg/plugin/one_time_plugin.c b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c index 0c607bdc559..ee805174aea 100644 --- a/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/one_time_plugin.c @@ -50,7 +50,7 @@ struct gimple_opt_pass one_pass = int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { - struct plugin_pass p; + struct register_pass_info p; p.pass = &one_pass.pass; p.reference_pass_name = "useless"; diff --git a/gcc/testsuite/gcc.dg/plugin/selfassign.c b/gcc/testsuite/gcc.dg/plugin/selfassign.c index 13f6be9c2c1..f804222826d 100644 --- a/gcc/testsuite/gcc.dg/plugin/selfassign.c +++ b/gcc/testsuite/gcc.dg/plugin/selfassign.c @@ -299,7 +299,7 @@ int plugin_init (struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { - struct plugin_pass pass_info; + struct register_pass_info pass_info; const char *plugin_name = plugin_info->base_name; int argc = plugin_info->argc; struct plugin_argument *argv = plugin_info->argv; diff --git a/gcc/testsuite/gcc.dg/pr41573.c b/gcc/testsuite/gcc.dg/pr41573.c new file mode 100644 index 00000000000..52961db8f22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr41573.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ +__inline __attribute__ ((__always_inline__)) char * +strcpy (char *__dest, __const char *__src) +{ + return __builtin___strcpy_chk (__dest, __src, __builtin_object_size (__dest, 2 > 1)); +} + +const char* get_attr(unsigned attr) +{ + static char tmp[256]; + + strcpy(tmp, ""); + return tmp; +} diff --git a/gcc/testsuite/gcc.dg/pr41574.c b/gcc/testsuite/gcc.dg/pr41574.c new file mode 100644 index 00000000000..f5ddcb2fcc8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr41574.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fno-unsafe-math-optimizations -fdump-rtl-combine" { target { arm*-*-* } } } */ +/* { dg-options "-O2 -fno-unsafe-math-optimizations -fdump-rtl-combine" { target { ! arm*-*-* } } } */ + + +static const double one=1.0; + +double +f(double x) +{ + return x*(one+x); +} + +/* { dg-final { scan-rtl-dump-not "\\(plus:DF \\(mult:DF" "combine" } } */ +/* { dg-final { cleanup-rtl-dump "combine*" } } */ diff --git a/gcc/testsuite/gcc.dg/torture/pr23821.c b/gcc/testsuite/gcc.dg/torture/pr23821.c new file mode 100644 index 00000000000..7d425831bb8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr23821.c @@ -0,0 +1,29 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ +/* At -O1 DOM threads a jump in a non-optimal way which leads to + the bogus propagation. */ +/* { dg-skip-if "" { *-*-* } { "-O1" } { "" } } */ +/* { dg-options "-fdump-tree-ivcanon-details" } */ + +static int a[199]; + +extern void abort (void); + +int +main () +{ + int i, x; + for (i = 0; i < 199; i++) + { + x = a[i]; + if (x != i) + abort (); + } + return 0; +} + +/* Verify that we do not propagate the equivalence x == i into the + induction variable increment. */ + +/* { dg-final { scan-tree-dump "Added canonical iv" "ivcanon" } } */ +/* { dg-final { cleanup-tree-dump "ivcanon" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/foldstring-1.c b/gcc/testsuite/gcc.dg/tree-ssa/foldstring-1.c index 25a7ef49f8a..fa64ae14cc4 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/foldstring-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/foldstring-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-useless" } */ +/* { dg-options "-O1 -fdump-tree-fre" } */ void arf () @@ -7,5 +7,5 @@ arf () if (""[0] == 0) blah (); } -/* { dg-final { scan-tree-dump-times "= 0;" 1 "useless"} } */ -/* { dg-final { cleanup-tree-dump "useless" } } */ +/* { dg-final { scan-tree-dump-times "= 0;" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c index bd24446e162..5f126363124 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ipa-cp-1.c @@ -12,31 +12,3 @@ main() /* One appereance for dump, one self recursive call and one call from main. */ /* { dg-final { scan-tree-dump-times "very_long_function.clone.0 \\(\\)" 3 "optimized"} } */ /* { dg-final { cleanup-tree-dump "optimized" } } */ -/* { dg-do compile } */ -/* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */ -int -very_long_function(int a) -{ - return very_long_function (a)/4; -} -main() -{ - very_long_function (1); -} -/* One appereance for dump, one self recursive call and one call from main. */ -/* { dg-final { scan-tree-dump-times "very_long_function.clone.0 \\(\\)" 3 "optimized"} } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ -/* { dg-do compile } */ -/* { dg-options "-O3 -fdump-tree-optimized -fno-inline" } */ -int -very_long_function(int a) -{ - return very_long_function (a)/4; -} -main() -{ - very_long_function (1); -} -/* One appereance for dump, one self recursive call and one call from main. */ -/* { dg-final { scan-tree-dump-times "very_long_function.clone.0 \\(\\)" 3 "optimized"} } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/useless-1.c b/gcc/testsuite/gcc.dg/tree-ssa/useless-1.c index 9170b7ca4de..68eab70046c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/useless-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/useless-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O1 -fdump-tree-useless" } */ +/* { dg-options "-O1 -fdump-tree-gimple" } */ void foo (void) @@ -13,5 +13,5 @@ foo (void) in the loop exit condition, it would be re-introduced during GIMPLE lowering, at the cost of an extra statement, label, and basic block. */ -/* { dg-final { scan-tree-dump-times "goto" 3 "useless"} } */ -/* { dg-final { cleanup-tree-dump "useless" } } */ +/* { dg-final { scan-tree-dump-times "goto" 3 "gimple"} } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/gcc/testsuite/gcc.dg/visibility-14.c b/gcc/testsuite/gcc.dg/visibility-14.c new file mode 100644 index 00000000000..1c01f8399db --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-14.c @@ -0,0 +1,10 @@ +/* Test that called external functions are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +int f () { + foo(); +} diff --git a/gcc/testsuite/gcc.dg/visibility-15.c b/gcc/testsuite/gcc.dg/visibility-15.c new file mode 100644 index 00000000000..8d331d76cae --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-15.c @@ -0,0 +1,12 @@ +/* Test that accessed external functions are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +typedef void (*foo_t)(void); + +foo_t g(void) { + return foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-16.c b/gcc/testsuite/gcc.dg/visibility-16.c new file mode 100644 index 00000000000..52a25cdef81 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-16.c @@ -0,0 +1,10 @@ +/* Test that accessed external variables are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int f () { + return foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-17.c b/gcc/testsuite/gcc.dg/visibility-17.c new file mode 100644 index 00000000000..0ff3e83de4b --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-17.c @@ -0,0 +1,10 @@ +/* Test that external variable whose address is taken are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int *f () { + return &foo; +} diff --git a/gcc/testsuite/gcc.dg/visibility-18.c b/gcc/testsuite/gcc.dg/visibility-18.c new file mode 100644 index 00000000000..f54c73b198a --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-18.c @@ -0,0 +1,8 @@ +/* Test that external variable whose address is taken are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern int foo __attribute__ ((visibility ("hidden"))); +int *test = &foo; diff --git a/gcc/testsuite/gcc.dg/visibility-19.c b/gcc/testsuite/gcc.dg/visibility-19.c new file mode 100644 index 00000000000..3c2455fb291 --- /dev/null +++ b/gcc/testsuite/gcc.dg/visibility-19.c @@ -0,0 +1,9 @@ +/* Test that accessed external functions are marked. */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-darwin* } { "*" } { "" } } */ +/* { dg-require-visibility "" } */ +/* { dg-final { scan-hidden "foo" } } */ + +extern void foo(void) __attribute__ ((visibility ("hidden"))); +typedef void (*foo_t)(void); +foo_t test = foo; 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/gcc.target/mips/truncate-6.c b/gcc/testsuite/gcc.target/mips/truncate-6.c new file mode 100644 index 00000000000..1ccd6c59c3d --- /dev/null +++ b/gcc/testsuite/gcc.target/mips/truncate-6.c @@ -0,0 +1,12 @@ +/* setup_incoming_promotions should detect x to be already sign-extended due + to PROMOTE_MODE. Thus the truncation should be removed by combine. Based + on gcc.c-torture/execute/pr34070-2.c. */ +/* { dg-options "-O -mgp64" } */ +/* { dg-final { scan-assembler-not "\tsll\t\[^\n\]*,0" } } */ + +NOMIPS16 int f(unsigned int x, int n, int *p) +{ + if (p) + *p = 1; + return ((int)x) / (1 << n); +} diff --git a/gcc/testsuite/gfortran.dg/assumed_charlen_function_6.f90 b/gcc/testsuite/gfortran.dg/assumed_charlen_function_6.f90 new file mode 100644 index 00000000000..49d1a2e55dd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/assumed_charlen_function_6.f90 @@ -0,0 +1,37 @@ +! { dg-do compile } + +! PR fortran/41615 +! Output nicer error message for invalid assumed-len character function result +! depending on what kind of contained procedure it is. + +module funcs + implicit none +contains + function assumed_len(x) ! { dg-error "module procedure" } + character(*) assumed_len + integer, intent(in) :: x + end function assumed_len +end module funcs + +module mod2 + implicit none +contains + subroutine mysub () + contains + function assumed_len(x) ! { dg-error "internal function" } + character(*) assumed_len + integer, intent(in) :: x + end function assumed_len + end subroutine +end module mod2 + +program main + implicit none +contains + function assumed_len(x) ! { dg-error "internal function" } + character(*) assumed_len + integer, intent(in) :: x + end function assumed_len +end program main + +! { dg-final { cleanup-modules "funcs mod2" } } diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_1.f03 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_1.f03 new file mode 100644 index 00000000000..4854b0ff08d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_1.f03 @@ -0,0 +1,84 @@ +! { dg-do run } +! Tests dynamic dispatch of class functions. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! +module m + type :: t1 + integer :: i = 42 + procedure(make_real), pointer :: ptr + contains + procedure, pass :: real => make_real + procedure, pass :: make_integer + procedure, pass :: prod => i_m_j + generic, public :: extract => real, make_integer + generic, public :: base_extract => real, make_integer + end type t1 + + type, extends(t1) :: t2 + integer :: j = 99 + contains + procedure, pass :: real => make_real2 + procedure, pass :: make_integer_2 + procedure, pass :: prod => i_m_j_2 + generic, public :: extract => real, make_integer_2 + end type t2 +contains + real function make_real (arg) + class(t1), intent(in) :: arg + make_real = real (arg%i) + end function make_real + + real function make_real2 (arg) + class(t2), intent(in) :: arg + make_real2 = real (arg%j) + end function make_real2 + + integer function make_integer (arg, arg2) + class(t1), intent(in) :: arg + integer :: arg2 + make_integer = arg%i * arg2 + end function make_integer + + integer function make_integer_2 (arg, arg2) + class(t2), intent(in) :: arg + integer :: arg2 + make_integer_2 = arg%j * arg2 + end function make_integer_2 + + integer function i_m_j (arg) + class(t1), intent(in) :: arg + i_m_j = arg%i + end function i_m_j + + integer function i_m_j_2 (arg) + class(t2), intent(in) :: arg + i_m_j_2 = arg%j + end function i_m_j_2 +end module m + + use m + type, extends(t1) :: l1 + character(16) :: chr + end type l1 + class(t1), pointer :: a !=> NULL() + type(t1), target :: b + type(t2), target :: c + type(l1), target :: d + a => b ! declared type + if (a%real() .ne. real (42)) call abort + if (a%prod() .ne. 42) call abort + if (a%extract (2) .ne. 84) call abort + if (a%base_extract (2) .ne. 84) call abort + a => c ! extension in module + if (a%real() .ne. real (99)) call abort + if (a%prod() .ne. 99) call abort + if (a%extract (3) .ne. 297) call abort + if (a%base_extract (3) .ne. 126) call abort + a => d ! extension in main + if (a%real() .ne. real (42)) call abort + if (a%prod() .ne. 42) call abort + if (a%extract (4) .ne. 168) call abort + if (a%base_extract (4) .ne. 168) call abort +end +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_2.f03 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_2.f03 new file mode 100644 index 00000000000..989a2e0d3f0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_2.f03 @@ -0,0 +1,105 @@ +! { dg-do run } +! Tests dynamic dispatch of class subroutines. +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! +module m + type :: t1 + integer :: i = 42 + procedure(make_real), pointer :: ptr + contains + procedure, pass :: real => make_real + procedure, pass :: make_integer + procedure, pass :: prod => i_m_j + generic, public :: extract => real, make_integer + generic, public :: base_extract => real, make_integer + end type t1 + + type, extends(t1) :: t2 + integer :: j = 99 + contains + procedure, pass :: real => make_real2 + procedure, pass :: make_integer_2 + procedure, pass :: prod => i_m_j_2 + generic, public :: extract => real, make_integer_2 + end type t2 +contains + subroutine make_real (arg, arg2) + class(t1), intent(in) :: arg + real :: arg2 + arg2 = real (arg%i) + end subroutine make_real + + subroutine make_real2 (arg, arg2) + class(t2), intent(in) :: arg + real :: arg2 + arg2 = real (arg%j) + end subroutine make_real2 + + subroutine make_integer (arg, arg2, arg3) + class(t1), intent(in) :: arg + integer :: arg2, arg3 + arg3 = arg%i * arg2 + end subroutine make_integer + + subroutine make_integer_2 (arg, arg2, arg3) + class(t2), intent(in) :: arg + integer :: arg2, arg3 + arg3 = arg%j * arg2 + end subroutine make_integer_2 + + subroutine i_m_j (arg, arg2) + class(t1), intent(in) :: arg + integer :: arg2 + arg2 = arg%i + end subroutine i_m_j + + subroutine i_m_j_2 (arg, arg2) + class(t2), intent(in) :: arg + integer :: arg2 + arg2 = arg%j + end subroutine i_m_j_2 +end module m + + use m + type, extends(t1) :: l1 + character(16) :: chr + end type l1 + class(t1), pointer :: a !=> NULL() + type(t1), target :: b + type(t2), target :: c + type(l1), target :: d + real :: r + integer :: i + + a => b ! declared type + call a%real(r) + if (r .ne. real (42)) call abort + call a%prod(i) + if (i .ne. 42) call abort + call a%extract (2, i) + if (i .ne. 84) call abort + call a%base_extract (2, i) + if (i .ne. 84) call abort + + a => c ! extension in module + call a%real(r) + if (r .ne. real (99)) call abort + call a%prod(i) + if (i .ne. 99) call abort + call a%extract (3, i) + if (i .ne. 297) call abort + call a%base_extract (3, i) + if (i .ne. 126) call abort + + a => d ! extension in main + call a%real(r) + if (r .ne. real (42)) call abort + call a%prod(i) + if (i .ne. 42) call abort + call a%extract (4, i) + if (i .ne. 168) call abort + call a%extract (4, i) + if (i .ne. 168) call abort +end +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/dynamic_dispatch_3.f03 b/gcc/testsuite/gfortran.dg/dynamic_dispatch_3.f03 new file mode 100644 index 00000000000..aa8713ef4d4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/dynamic_dispatch_3.f03 @@ -0,0 +1,91 @@ +! { dg-do run } +! Tests dynamic dispatch of class functions, spread over +! different modules. Apart from the location of the derived +! type declarations, this test is the same as +! dynamic_dispatch_1.f03 +! +! Contributed by Paul Thomas <pault@gcc.gnu.org> +! +module m1 + type :: t1 + integer :: i = 42 + procedure(make_real), pointer :: ptr + contains + procedure, pass :: real => make_real + procedure, pass :: make_integer + procedure, pass :: prod => i_m_j + generic, public :: extract => real, make_integer + generic, public :: base_extract => real, make_integer + end type t1 +contains + real function make_real (arg) + class(t1), intent(in) :: arg + make_real = real (arg%i) + end function make_real + + integer function make_integer (arg, arg2) + class(t1), intent(in) :: arg + integer :: arg2 + make_integer = arg%i * arg2 + end function make_integer + + integer function i_m_j (arg) + class(t1), intent(in) :: arg + i_m_j = arg%i + end function i_m_j +end module m1 + +module m2 + use m1 + type, extends(t1) :: t2 + integer :: j = 99 + contains + procedure, pass :: real => make_real2 + procedure, pass :: make_integer_2 + procedure, pass :: prod => i_m_j_2 + generic, public :: extract => real, make_integer_2 + end type t2 +contains + real function make_real2 (arg) + class(t2), intent(in) :: arg + make_real2 = real (arg%j) + end function make_real2 + + integer function make_integer_2 (arg, arg2) + class(t2), intent(in) :: arg + integer :: arg2 + make_integer_2 = arg%j * arg2 + end function make_integer_2 + + integer function i_m_j_2 (arg) + class(t2), intent(in) :: arg + i_m_j_2 = arg%j + end function i_m_j_2 +end module m2 + + use m1 + use m2 + type, extends(t1) :: l1 + character(16) :: chr + end type l1 + class(t1), pointer :: a !=> NULL() + type(t1), target :: b + type(t2), target :: c + type(l1), target :: d + a => b ! declared type in module m1 + if (a%real() .ne. real (42)) call abort + if (a%prod() .ne. 42) call abort + if (a%extract (2) .ne. 84) call abort + if (a%base_extract (2) .ne. 84) call abort + a => c ! extension in module m2 + if (a%real() .ne. real (99)) call abort + if (a%prod() .ne. 99) call abort + if (a%extract (3) .ne. 297) call abort + if (a%base_extract (3) .ne. 126) call abort + a => d ! extension in main + if (a%real() .ne. real (42)) call abort + if (a%prod() .ne. 42) call abort + if (a%extract (4) .ne. 168) call abort + if (a%base_extract (4) .ne. 168) call abort +end +! { dg-final { cleanup-modules "m1, m2" } } diff --git a/gcc/testsuite/gfortran.dg/goto_6.f b/gcc/testsuite/gfortran.dg/goto_6.f new file mode 100644 index 00000000000..5b054b636bc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goto_6.f @@ -0,0 +1,24 @@ +! { dg-do run } +! { dg-options "-w" } + +! PR fortran/41403 +! Assigned-goto with label list used to compare label addresses which +! failed with optimization. Check this works correctly now. +! This is the most reduced Fortran code from the PR. + + IVFAIL=0 + ASSIGN 1263 TO I + GO TO I, (1262,1263,1264) + 1262 ICON01 = 1262 + GO TO 1265 + 1263 ICON01 = 1263 + GO TO 1265 + 1264 ICON01 = 1264 + 1265 CONTINUE +41260 IF ( ICON01 - 1263 ) 21260, 11260, 21260 +11260 IVPASS = IVPASS + 1 + GO TO 1271 +21260 IVFAIL = IVFAIL + 1 + 1271 CONTINUE + IF (IVFAIL /= 0) CALL abort () + END diff --git a/gcc/testsuite/gfortran.dg/goto_7.f b/gcc/testsuite/gfortran.dg/goto_7.f new file mode 100644 index 00000000000..e230b7b6f14 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goto_7.f @@ -0,0 +1,14 @@ +! { dg-do compile } +! { dg-options "-std=legacy" } + +! Check for error message when computed and assigned gotos reference +! illegal label numbers. + + ASSIGN 1 TO I + GOTO (1, 2, 3, 42), 2 ! { dg-error "is never defined" } + GOTO I, (1, 2, 3, 43) ! { dg-error "is never defined" } + 1 CONTINUE + 2 CONTINUE + 3 CONTINUE +c No label 42 or 43. + END diff --git a/gcc/testsuite/gfortran.dg/guality/arg1.f90 b/gcc/testsuite/gfortran.dg/guality/arg1.f90 new file mode 100644 index 00000000000..332a4ed1d87 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/guality/arg1.f90 @@ -0,0 +1,15 @@ +! { dg-do run } +! { dg-options "-g" } + integer :: a(10), b(12) + call sub (a, 10) + call sub (b, 12) + write (*,*) a, b +end + +subroutine sub (a, n) + integer :: a(n), n + do i = 1, n + a(i) = i + end do + write (*,*) a ! { dg-final { gdb-test 14 "a(10)" "10" } } +end subroutine diff --git a/gcc/testsuite/gfortran.dg/guality/guality.exp b/gcc/testsuite/gfortran.dg/guality/guality.exp new file mode 100644 index 00000000000..2444d8de7b8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/guality/guality.exp @@ -0,0 +1,29 @@ +# This harness is for tests that should be run at all optimisation levels. + +load_lib gfortran-dg.exp +load_lib gcc-gdb-test.exp + +# Disable on darwin until radr://7264615 is resolved. +if { [istarget *-*-darwin*] } { + return +} + +dg-init + +global GDB +if ![info exists ::env(GUALITY_GDB_NAME)] { + if [info exists GDB] { + set guality_gdb_name "$GDB" + } else { + set guality_gdb_name "[transform gdb]" + } + setenv GUALITY_GDB_NAME "$guality_gdb_name" +} + +gfortran-dg-runtest [lsort [glob $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ]] "" + +if [info exists guality_gdb_name] { + unsetenv GUALITY_GDB_NAME +} + +dg-finish diff --git a/gcc/testsuite/gfortran.dg/guality/pr41558.f90 b/gcc/testsuite/gfortran.dg/guality/pr41558.f90 new file mode 100644 index 00000000000..9d1e833998f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/guality/pr41558.f90 @@ -0,0 +1,10 @@ +! PR debug/41558 +! { dg-do run } +! { dg-options "-g" } + +subroutine f (s) + character(len=3) :: s + write (*,*), s ! { dg-final { gdb-test 7 "s" "'foo'" } } +end + call f ('foo') +end diff --git a/gcc/testsuite/gfortran.dg/intent_out_5.f90 b/gcc/testsuite/gfortran.dg/intent_out_5.f90 new file mode 100644 index 00000000000..acd2b606525 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/intent_out_5.f90 @@ -0,0 +1,27 @@ +! { dg-do run} +! +! PR fortran/41479 +! +! Contributed by Juergen Reuter. +! +program main + type :: container_t + integer :: n = 42 + ! if the following line is omitted, the problem disappears + integer, dimension(:), allocatable :: a + end type container_t + + type(container_t) :: container + + if (container%n /= 42) call abort() + if (allocated(container%a)) call abort() + container%n = 1 + allocate(container%a(50)) + call init (container) + if (container%n /= 42) call abort() + if (allocated(container%a)) call abort() +contains + subroutine init (container) + type(container_t), intent(out) :: container + end subroutine init +end program main diff --git a/gcc/testsuite/gfortran.dg/lto/lto.exp b/gcc/testsuite/gfortran.dg/lto/lto.exp new file mode 100644 index 00000000000..a3707ddbd6b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/lto.exp @@ -0,0 +1,57 @@ +# Copyright (C) 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# <http://www.gnu.org/licenses/>. +# +# Contributed by Diego Novillo <dnovillo@google.com> + + +# Test link-time optimization across multiple files. +# +# Programs are broken into multiple files. Each one is compiled +# separately with LTO information. The final executable is generated +# by collecting all the generated object files using regular LTO or WHOPR. + +if $tracelevel then { + strace $tracelevel +} + +# Load procedures from common libraries. +load_lib standard.exp +load_lib gfortran-dg.exp + +# Load the language-independent compabibility support procedures. +load_lib lto.exp + +lto_init + + +# Define an identifier for use with this suite to avoid name conflicts +# with other lto tests running at the same time. +set sid "f_lto" + +# If LTO has not been enabled, bail. +if { ![check_effective_target_lto] } { + return +} + +# Main loop. +foreach src [lsort [glob -nocomplain $srcdir/$subdir/*_0.\[fF\]{,90,95,03,08} ]] { + # If we're only testing specific files and this isn't one of them, skip it. + if ![runtest_file_p $runtests $src] then { + continue + } + + lto-execute $src $sid +} diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_0.f b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f new file mode 100644 index 00000000000..2d7a9864e40 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40724_0.f @@ -0,0 +1,3 @@ + subroutine f + print *, "Hello World" + end diff --git a/gcc/testsuite/gfortran.dg/lto/pr40724_1.f b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f new file mode 100644 index 00000000000..ed8f31020dd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40724_1.f @@ -0,0 +1,3 @@ + program test + call f + end diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 new file mode 100644 index 00000000000..2f33a0f5bf4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40725_0.f03 @@ -0,0 +1,16 @@ +module bind_c_dts_2 +use, intrinsic :: iso_c_binding +implicit none +type, bind(c) :: my_c_type_1 + integer(c_int) :: j +end type my_c_type_1 +contains + subroutine sub0(my_type, expected_j) bind(c) + type(my_c_type_1) :: my_type + integer(c_int), value :: expected_j + if (my_type%j .ne. expected_j) then + call abort () + end if + end subroutine sub0 +end module bind_c_dts_2 + diff --git a/gcc/testsuite/gfortran.dg/lto/pr40725_1.c b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c new file mode 100644 index 00000000000..7de46b8a988 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr40725_1.c @@ -0,0 +1,12 @@ +typedef struct c_type_1 +{ + int j; +} c_type_1_t; +void sub0(c_type_1_t *c_type, int expected_j); +int main(int argc, char **argv) +{ + c_type_1_t c_type; + c_type.j = 11; + sub0(&c_type, c_type.j); + return 0; +} diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 new file mode 100644 index 00000000000..4e7d65939c8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_0.f90 @@ -0,0 +1,7 @@ +! { dg-lto-do link } +SUBROUTINE mltfftsg ( a, ldax, lday ) + INTEGER, PARAMETER :: dbl = SELECTED_REAL_KIND ( 14, 200 ) + INTEGER, INTENT ( IN ) :: ldax, lday + COMPLEX ( dbl ), INTENT ( INOUT ) :: a ( ldax, lday ) +END SUBROUTINE mltfftsg + diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 new file mode 100644 index 00000000000..0c4e05d66d3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_1.f90 @@ -0,0 +1,10 @@ +SUBROUTINE S(zin) + COMPLEX(8), DIMENSION(3,3,3) :: zin + INTEGER :: m,n + CALL mltfftsg ( zin, m, n ) +END SUBROUTINE + +COMPLEX(8), DIMENSION(3,3,3) :: zin +CALL s(zin) +END + diff --git a/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 new file mode 100644 index 00000000000..121603eaa60 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/lto/pr41069_2.f90 @@ -0,0 +1,9 @@ +SUBROUTINE fftsg3d ( n, zout ) + INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND ( 14, 200 ) + INTEGER, DIMENSION(*), INTENT(IN) :: n + COMPLEX(KIND=dp), DIMENSION(*), INTENT(INOUT) :: zout + INTEGER :: nx + nx = n ( 1 ) + CALL mltfftsg ( zout, nx, nx ) +END SUBROUTINE fftsg3d + diff --git a/gcc/testsuite/gfortran.dg/module_md5_1.f90 b/gcc/testsuite/gfortran.dg/module_md5_1.f90 index 7aeeb800f10..88002c204bf 100644 --- a/gcc/testsuite/gfortran.dg/module_md5_1.f90 +++ b/gcc/testsuite/gfortran.dg/module_md5_1.f90 @@ -10,5 +10,5 @@ program test use foo print *, pi end program test -! { dg-final { scan-module "foo" "MD5:dc2fd1358dcaddc25e3c89dae859ef32" } } +! { dg-final { scan-module "foo" "MD5:9c43cf4d713824ec6894b83250720e68" } } ! { dg-final { cleanup-modules "foo" } } diff --git a/gcc/testsuite/gfortran.dg/round_2.f03 b/gcc/testsuite/gfortran.dg/round_2.f03 new file mode 100644 index 00000000000..aa04bbe3260 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/round_2.f03 @@ -0,0 +1,17 @@ +! { dg-do run } +! PR35962 Implement F2003 rounding modes. +! Test case prepared by Jerry Delisle <jvdelisle@gcc.gnu.org> +integer,parameter :: k = selected_real_kind (precision (0.0_8) + 1) +character(64) :: line +write(line, '(RN, 4F10.3)') 0.0625_k, 0.1875_k +if (line.ne." 0.062 0.188") call abort + +write(line, '(RN, 4F10.2)') 0.125_k, 0.375_k, 1.125_k, 1.375_k +if (line.ne." 0.12 0.38 1.12 1.38") call abort + +write(line, '(RN, 4F10.1)') 0.25_k, 0.75_k, 1.25_k, 1.75_k +if (line.ne." 0.2 0.8 1.2 1.8") call abort + +write(line, '(RN, 4F10.0)') 0.5_k, 1.5_k, 2.5_k, 3.5_k +if (line.ne." 0. 2. 2. 4.") call abort +end diff --git a/gcc/testsuite/gfortran.dg/same_type_as_2.f03 b/gcc/testsuite/gfortran.dg/same_type_as_2.f03 index 9a2110d47b6..6fd03117007 100644 --- a/gcc/testsuite/gfortran.dg/same_type_as_2.f03 +++ b/gcc/testsuite/gfortran.dg/same_type_as_2.f03 @@ -8,12 +8,11 @@ integer :: i end type - type :: t2 + type, extends(t1) :: t2 integer :: j end type - CLASS(t1), pointer :: c1 - CLASS(t2), pointer :: c2 + CLASS(t1), pointer :: c1,c2 TYPE(t1), target :: x1 TYPE(t2) ,target :: x2 diff --git a/gcc/testsuite/gfortran.dg/select_type_1.f03 b/gcc/testsuite/gfortran.dg/select_type_1.f03 index e764ec98f48..6a7db2e8954 100644 --- a/gcc/testsuite/gfortran.dg/select_type_1.f03 +++ b/gcc/testsuite/gfortran.dg/select_type_1.f03 @@ -30,8 +30,8 @@ type is (t1) ! { dg-error "Unexpected TYPE IS statement" } - select type (3.5) ! { dg-error "Selector must be a named variable" } - select type (a%cp) ! { dg-error "Selector must be a named variable" } + select type (3.5) ! { dg-error "is not a named variable" } + select type (a%cp) ! { dg-error "is not a named variable" } select type (b) ! { dg-error "Selector shall be polymorphic" } select type (a) diff --git a/gcc/testsuite/gfortran.dg/select_type_5.f03 b/gcc/testsuite/gfortran.dg/select_type_5.f03 new file mode 100644 index 00000000000..ec9d3cd8d17 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/select_type_5.f03 @@ -0,0 +1,47 @@ +! { dg-do run } +! +! SELECT TYPE with associate-name +! +! Contributed by Janus Weil <janus@gcc.gnu.org> + + type :: t1 + integer :: i = -1 + class(t1), pointer :: c + end type t1 + + type, extends(t1) :: t2 + integer :: j = -1 + end type t2 + + type(t2), target :: b + integer :: aa + + b%c => b + aa = 5 + + select type (aa => b%c) + type is (t1) + aa%i = 1 + type is (t2) + aa%j = 2 + end select + + print *,b%i,b%j + if (b%i /= -1) call abort() + if (b%j /= 2) call abort() + + select type (aa => b%c) + type is (t1) + aa%i = 4 + type is (t2) + aa%i = 3*aa%j + end select + + print *,b%i,b%j + if (b%i /= 6) call abort() + if (b%j /= 2) call abort() + + print *,aa + if (aa/=5) call abort() + +end diff --git a/gcc/testsuite/gnat.dg/array10.adb b/gcc/testsuite/gnat.dg/array10.adb new file mode 100644 index 00000000000..37ee8ffb43b --- /dev/null +++ b/gcc/testsuite/gnat.dg/array10.adb @@ -0,0 +1,25 @@ +-- { dg-do run } +-- Verify that an array of non-aliased zero-sized element is zero-sized + +procedure Array10 is + + type Rec is null record; + + type Arr1 is array (1..8) of Rec; + type Arr2 is array (Long_Integer) of Rec; + + R : Rec; + A1 : Arr1; + A2 : Arr2; + +begin + if Rec'Size /= 0 then + raise Program_Error; + end if; + if Arr1'Size /= 0 then + raise Program_Error; + end if; + if Arr2'Size /= 0 then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/array11.adb b/gcc/testsuite/gnat.dg/array11.adb new file mode 100644 index 00000000000..0a7edcf46d0 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array11.adb @@ -0,0 +1,16 @@ +-- { dg-do compile } + +procedure Array11 is + + type Rec is null record; + type Ptr is access all Rec; + + type Arr1 is array (1..8) of aliased Rec; -- { dg-warning "padded" } + type Arr2 is array (Long_Integer) of aliased Rec; -- { dg-warning "padded" } + + A1 : Arr1; + A2 : Arr2; -- { dg-warning "Storage_Error will be raised" } + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/array12.adb b/gcc/testsuite/gnat.dg/array12.adb new file mode 100644 index 00000000000..3748d5ec206 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array12.adb @@ -0,0 +1,20 @@ +-- { dg-do run } + +procedure Array12 is + + function N return Integer is + begin + return 0; + end; + + subtype Element is String (1 .. N); + type Ptr is access all Element; + type Vector is array (Positive range <>) of aliased Element; + + V : Vector (1..2); + +begin + if Ptr'(V(1)'Access) = V(2)'Access then + raise Program_Error; + end if; +end; diff --git a/gcc/testsuite/gnat.dg/atomic2.adb b/gcc/testsuite/gnat.dg/atomic2.adb new file mode 100644 index 00000000000..c14d21e13ee --- /dev/null +++ b/gcc/testsuite/gnat.dg/atomic2.adb @@ -0,0 +1,11 @@ +-- { dg-do compile } + +procedure Atomic2 is + + type Big is array (1..4) of Integer; + type Arr is array (1..10) of Big; + pragma Atomic_Components (Arr); -- { dg-warning "cannot be guaranteed" } + +begin + null; +end; diff --git a/gcc/testsuite/gnat.dg/object_overflow.adb b/gcc/testsuite/gnat.dg/object_overflow.adb index 820e93656e6..597b7964585 100644 --- a/gcc/testsuite/gnat.dg/object_overflow.adb +++ b/gcc/testsuite/gnat.dg/object_overflow.adb @@ -2,13 +2,12 @@ procedure Object_Overflow is - type Rec is null record; + procedure Proc (x : Boolean) is begin null; end; - procedure Proc (x : Rec) is begin null; end; - - type Arr is array(Long_Integer) of Rec; + type Arr is array(Long_Integer) of Boolean; Obj : Arr; -- { dg-warning "Storage_Error will be raised" } begin + Obj(1) := True; Proc (Obj(1)); end; diff --git a/gcc/testsuite/gnat.dg/specs/import_abstract.ads b/gcc/testsuite/gnat.dg/specs/import_abstract.ads new file mode 100644 index 00000000000..9d05f0c1ceb --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/import_abstract.ads @@ -0,0 +1,6 @@ +-- { dg-do compile } +package Import_Abstract is + type T1 is abstract tagged null record; + procedure p1(X : T1) is abstract; + pragma Import (Ada, p1); -- { dg-error "cannot import abstract subprogram" } +end Import_Abstract; diff --git a/gcc/testsuite/gnat.dg/timer_cancel.adb b/gcc/testsuite/gnat.dg/timer_cancel.adb new file mode 100644 index 00000000000..c300b47a859 --- /dev/null +++ b/gcc/testsuite/gnat.dg/timer_cancel.adb @@ -0,0 +1,38 @@ +-- { dg-do run } + +with Ada.Real_Time.Timing_Events; +use Ada.Real_Time, Ada.Real_Time.Timing_Events; + +procedure Timer_Cancel is + + E : Timing_Event; + C : Boolean; + + protected Dummy is + procedure Trigger (Event : in out Timing_Event); + end Dummy; + + protected body Dummy is + procedure Trigger (Event : in out Timing_Event) is + begin + null; + end Trigger; + end Dummy; + +begin + Set_Handler (E, Time_Last, Dummy.Trigger'Unrestricted_Access); + + if Time_Of_Event (E) /= Time_Last then + raise Program_Error with "Event time not set correctly"; + end if; + + Cancel_Handler (E, C); + + if not C then + raise Program_Error with "Event triggered already"; + end if; + + if Time_Of_Event (E) /= Time_First then + raise Program_Error with "Event time not reset correctly"; + end if; +end Timer_Cancel; 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/gcc-gdb-test.exp b/gcc/testsuite/lib/gcc-gdb-test.exp new file mode 100644 index 00000000000..c8933c2b930 --- /dev/null +++ b/gcc/testsuite/lib/gcc-gdb-test.exp @@ -0,0 +1,91 @@ +# 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/>. + +# Utility for testing variable values using gdb, invoked via dg-final. +# Call pass if variable has the desired value, otherwise fail. +# +# Argument 0 is the line number on which to put a breakpoint +# Argument 1 is the name of the variable to be checked +# Argument 2 is the expected value of the variable +# Argument 3 handles expected failures and the like +proc gdb-test { args } { + if { ![isnative] || [is_remote target] } { return } + + if { [llength $args] >= 4 } { + switch [dg-process-target [lindex $args 3]] { + "S" { } + "N" { return } + "F" { setup_xfail "*-*-*" } + "P" { } + } + } + + # This assumes that we are three frames down from dg-test, and that + # it still stores the filename of the testcase in a local variable "name". + # A cleaner solution would require a new DejaGnu release. + upvar 2 name testcase + upvar 2 prog prog + + set gdb_name $::env(GUALITY_GDB_NAME) + set testname "$testcase line [lindex $args 0] [lindex $args 1] == [lindex $args 2]" + set output_file "[file rootname [file tail $prog]].exe" + set cmd_file "[file rootname [file tail $prog]].gdb" + + set fd [open $cmd_file "w"] + puts $fd "break [lindex $args 0]" + puts $fd "run" + puts $fd "print [lindex $args 1]" + puts $fd "print [lindex $args 2]" + puts $fd "quit" + close $fd + + send_log "Spawning: $gdb_name -nx -nw -quiet -x $cmd_file ./$output_file\n" + set res [remote_spawn target "$gdb_name -nx -nw -quiet -x $cmd_file ./$output_file"] + if { $res < 0 || $res == "" } { + unsupported "$testname" + return + } + + remote_expect target [timeout_value] { + -re {[\n\r]\$1 = ([^\n\r]*)[\n\r]+\$2 = ([^\n\r]*)[\n\r]} { + set first $expect_out(1,string) + set second $expect_out(2,string) + if { $first == $second } { + pass "$testname" + } else { + send_log "$first != $second\n" + fail "$testname" + } + remote_close target + return + } + # Too old GDB + -re "Unhandled dwarf expression|Error in sourced command file" { + unsupported "$testname" + remote_close target + return + } + timeout { + unsupported "$testname" + remote_close target + return + } + } + + remote_close target + unsupported "$testname" + return +} 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. |