diff options
author | Yiran Wang <yiran@google.com> | 2015-06-23 15:33:17 -0700 |
---|---|---|
committer | Yiran Wang <yiran@google.com> | 2015-06-29 10:56:28 -0700 |
commit | 1d9fec7937f45dde5e04cac966a2d9a12f2fc15a (patch) | |
tree | 3fbcd18a379a05fd6d43491a107e1f36bc61b185 /gcc-4.9/gcc/testsuite | |
parent | f378ebf14df0952eae870c9865bab8326aa8f137 (diff) | |
download | toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.gz toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.bz2 toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.zip |
Synchronize with google/gcc-4_9 to r224707 (from r214835)
Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d
Diffstat (limited to 'gcc-4.9/gcc/testsuite')
346 files changed, 7849 insertions, 494 deletions
diff --git a/gcc-4.9/gcc/testsuite/ChangeLog b/gcc-4.9/gcc/testsuite/ChangeLog index 4eefcba93..2d76bdc81 100644 --- a/gcc-4.9/gcc/testsuite/ChangeLog +++ b/gcc-4.9/gcc/testsuite/ChangeLog @@ -1,8 +1,411 @@ +2015-03-26 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport r214254 and related tests from mainline + * gcc.target/powerpc/swaps-p8-1.c: New test. + * gcc.target/powerpc/swaps-p8-2.c: New test. + * gcc.target/powerpc/swaps-p8-3.c: New test. + * gcc.target/powerpc/swaps-p8-4.c: New test. + * gcc.target/powerpc/swaps-p8-5.c: New test. + * gcc.target/powerpc/swaps-p8-6.c: New test. + * gcc.target/powerpc/swaps-p8-7.c: New test. + * gcc.target/powerpc/swaps-p8-8.c: New test. + * gcc.target/powerpc/swaps-p8-9.c: New test. + * gcc.target/powerpc/swaps-p8-10.c: New test. + * gcc.target/powerpc/swaps-p8-11.c: New test. + * gcc.target/powerpc/swaps-p8-12.c: New test. + * gcc.target/powerpc/swaps-p8-13.c: New test. + * gcc.target/powerpc/swaps-p8-14.c: New test. + * gcc.target/powerpc/swaps-p8-15.c: New test. + * gcc.target/powerpc/swaps-p8-16.c: New test. + * gcc.target/powerpc/swaps-p8-17.c: New test. + +2015-01-20 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2014-06-23 Marek Polacek <polacek@redhat.com> + + PR c/61553 + * c-c++-common/pr61553.c: New test. + +2015-01-16 Bernd Edlinger <bernd.edlinger@hotmail.de> + + * c-c++-common/tsan/tsan_barrier.h: New. + * c-c++-common/tsan/atomic_stack.c: Reworked to not depend on sleep. + * c-c++-common/tsan/fd_pipe_race.c: Likewise. + * c-c++-common/tsan/mutexset1.c: Likewise. + * c-c++-common/tsan/race_on_barrier.c: Likewise. + * c-c++-common/tsan/race_on_mutex.c: Likewise. + * c-c++-common/tsan/race_on_mutex2.c: Likewise. + * c-c++-common/tsan/simple_race.c: Likewise. + * c-c++-common/tsan/simple_stack.c: Likewise. + * c-c++-common/tsan/sleep_sync.c: Likewise. + * c-c++-common/tsan/tiny_race.c: Likewise. + * c-c++-common/tsan/tls_race.c: Likewise. + * c-c++-common/tsan/write_in_reader_lock.c: Likewise. + * g++.dg/tsan/atomic_free.C: Likewise. + * g++.dg/tsan/atomic_free2.C: Likewise. + * g++.dg/tsan/cond_race.C: Likewise. + * g++.dg/tsan/tsan_barrier.h: Copied from c-c++-common/tsan. + +2015-01-15 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt47.adb: New test. + +2015-01-14 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2015-01-12 Jakub Jelinek <jakub@redhat.com> + + PR target/64513 + * gcc.target/i386/pr64513.c: New test. + + 2015-01-13 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/64286 + * gcc.target/i386/avx2-pr64286.c: New test. + + PR fortran/64528 + * gfortran.dg/pr64528.f90: New test. + + 2015-01-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/64563 + * gcc.dg/pr64563.c: New test. + +2015-01-14 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2015-01-13 Marek Polacek <polacek@redhat.com> + + PR middle-end/64391 + * gcc.dg/tm/pr64391.c: New test. + +2015-01-13 Marc Glisse <marc.glisse@inria.fr> + + PR c++/54442 + * g++.dg/pr54442.C: New file. + +2015-01-13 Renlin Li <renlin.li@arm.com> + + Backported from mainline + 2014-11-19 Renlin Li <renlin.li@arm.com> + + PR target/63424 + * gcc.target/aarch64/pr63424.c: New Test. + +2015-01-12 Janus Weil <janus@gcc.gnu.org> + + Backport from mainline + PR fortran/63733 + * gfortran.dg/typebound_operator_20.f90: New. + +2015-01-09 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/64536 + * gcc.dg/pr64536.c: New test. + +2015-01-09 Michael Meissner <meissner@linux.vnet.ibm.com> + + Backport from mainline: + 2015-01-06 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/64505 + * gcc.target/powerpc/pr64505.c: New file to test -m32 -mpowerpc64 + fix is correct. + +2015-01-08 Christian Bruel <christian.bruel@st.com> + + PR target/64507 + * gcc.target/sh/pr64507.c: New test. + +2015-01-05 Ian Lance Taylor <iant@google.com> + + Backport from mainline: + 2014-11-21 Lynn Boger <laboger@linux.vnet.ibm.com> + + * go.test/go-test.exp (go-set-goarch): Add case for ppc64le goarch + value for go testing. + +2014-12-28 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline: + 2014-12-28 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.target/i386/pr57003.c: Skip on x32. + * gcc.target/i386/pr59927.c: Likewise. + * gcc.target/i386/pr60516.c: Likewise. + +2014-12-27 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline: + 2014-12-26 H.J. Lu <hongjiu.lu@intel.com> + + PR target/64409 + * gcc.target/i386/pr64409.c: New test. + +2014-12-23 Janus Weil <janus@gcc.gnu.org> + + Backport from mainline + PR fortran/64244 + * gfortran.dg/typebound_call_26.f90: New. + +2014-12-19 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/60955 + * g++.dg/warn/register-parm-1.C: New. + +2014-12-15 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63551 + * gcc.dg/ipa/pr63551.c (fn2): Use 4294967286U instead of + 4294967286 to avoid warnings. + +2014-12-14 H.J. Lu <hongjiu.lu@intel.com> + + Backported from mainline + 2014-12-14 H.J. Lu <hongjiu.lu@intel.com> + + PR rtl-optimization/64037 + * g++.dg/pr64037.C: New test. + +2014-12-14 H.J. Lu <hongjiu.lu@intel.com> + + Backported from mainline + 2014-12-06 H.J. Lu <hongjiu.lu@intel.com> + + PR target/64200 + * gcc.target/i386/memcpy-strategy-4.c: New test. + +2014-12-13 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2014-12-12 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/64269 + * gcc.c-torture/compile/pr64269.c: New test. + +2014-12-10 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline + 2014-09-02 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/builtins-1.c: Add tests for vec_ctf, + vec_cts, and vec_ctu. + * gcc.target/powerpc/builtins-2.c: Likewise. + + Backport from mainline + 2014-08-28 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/builtins-1.c: Add tests for vec_xl, vec_xst, + vec_round, vec_splat, vec_div, and vec_mul. + * gcc.target/powerpc/builtins-2.c: New test. + + Backport from mainline + 2014-08-20 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * testsuite/gcc.target/powerpc/builtins-1.c: New test. + +2014-12-10 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/62021 + * gcc.dg/vect/pr62021.c: New test. + +2014-12-09 Uros Bizjak <ubizjak@gmail.com> + + PR bootstrap/64213 + Revert: + 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> + + PR rtl-optimization/64037 + * g++.dg/pr64037.C: New test. + +2014-12-07 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2014-12-07 Oleg Endo <olegendo@gcc.gnu.org> + + * gcc.target/h8300/h8300.exp: Fix duplicated text. + * gcc.target/h8300/pragma-isr.c: Likewise. + * gcc.target/h8300/pragma-isr2.c: Likewise. + +2014-12-05 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2014-12-02 H.J. Lu <hongjiu.lu@intel.com> + + PR target/64108 + * gcc.target/i386/memset-strategy-2.c: New test. + +2014-12-05 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2014-11-28 H.J. Lu <hongjiu.lu@intel.com> + + PR rtl-optimization/64037 + * g++.dg/pr64037.C: New test. + +2014-12-04 Jakub Jelinek <jakub@redhat.com> + + PR c++/56493 + * c-c++-common/pr56493.c: New test. + +2014-12-03 Renlin Li <Renlin.Li@arm.com> + + Backported from mainline + 2014-12-03 Renlin Li <Renlin.Li@arm.com> + H.J. Lu <hongjiu.lu@intel.com> + + PR middle-end/63762 + PR target/63661 + * gcc.dg/pr63762.c: New test. + * gcc.target/i386/pr63661.c: New test. + +2014-12-01 Martin Jambor <mjambor@suse.cz> + + PR ipa/63551 + * gcc.dg/ipa/pr63551.c: New test. + * gcc.dg/ipa/pr64041.c: Likewise. + +2014-12-01 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63738 + * gcc.dg/torture/pr63738.c: Fix call to setjmp. + +2014-11-28 Jakub Jelinek <jakub@redhat.com> + + Backported from mainline + 2014-11-27 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/64067 + * gcc.c-torture/compile/pr64067.c: New test. + + 2014-11-19 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63915 + * c-c++-common/gomp/pr60823-4.c: New test. + + PR sanitizer/63913 + * g++.dg/ubsan/pr63913.C: New test. + + 2014-10-31 Jakub Jelinek <jakub@redhat.com> + + PR rtl-optimization/63659 + * gcc.c-torture/execute/pr63659.c: New test. + +2014-11-26 Richard Biener <rguenther@suse.de> + + PR middle-end/63738 + * gcc.dg/torture/pr63738.c: New testcase. + +2014-11-26 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-11-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62238 + * gcc.dg/torture/pr62238.c: New testcase. + + 2014-11-07 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63605 + * gcc.dg/vect/pr63605.c: New testcase. + + 2014-10-28 Richard Biener <rguenther@suse.de> + + PR middle-end/63665 + * gcc.dg/pr63665.c: New testcase. + +2014-11-24 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt45.adb: New test. + +2014-11-22 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2014-11-22 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/63783 + PR target/51244 + * gcc.target/sh/torture/pr63783-1.c: New. + * gcc.target/sh/torture/pr63783-2.c: New. + * gcc.target/sh/pr51244-20.c: Adjust. + * gcc.target/sh/pr51244-20-sh2a.c: Adjust. + 2014-11-19 Renlin Li <Renlin.Li@arm.com> PR middle-end/63762 * gcc.dg/pr63762.c: New test. +2014-11-19 Uros Bizjak <ubizjak@gmail.com> + + PR target/63947 + * gcc.target/i386/pr63947.c: New test. + +2014-11-19 Tom de Vries <tom@codesourcery.com> + + Backport from mainline + PR tree-optimization/62167 + * gcc.dg/pr51879-12.c: Add xfails. + * gcc.dg/pr62167-run.c: New test. + * gcc.dg/pr62167.c: New test. + +2014-11-13 Teresa Johnson <tejohnson@google.com> + + PR tree-optimization/63841 + * g++.dg/tree-ssa/pr63841.C: New test. + +2014-11-12 Jakub Jelinek <jakub@redhat.com> + + PR ipa/63838 + * g++.dg/ipa/pr63838.C: New test. + +2014-11-11 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/63265 + * g++.dg/cpp0x/constexpr-63265.C: New. + +2014-11-09 H.J. Lu <hongjiu.lu@intel.com> + + Backported from mainline + 2014-11-09 H.J. Lu <hongjiu.lu@intel.com> + + PR testsuite/63305 + * gcc.target/i386/avx256-unaligned-load-7.c (avx_test): Fix + buffer overflow. + * gcc.target/i386/avx256-unaligned-store-7.c (avx_test): Likewise. + +2014-11-07 Marek Polacek <polacek@redhat.com> + + * c-c++-common/ubsan/undefined-2.c: New test. + +2014-11-05 Uros Bizjak <ubizjak@gmail.com> + + PR target/63538 + * gcc.target/i386/pr63538.c: New test. + +2014-11-03 Marek Polacek <polacek@redhat.com> + + PR c/52769 + * gcc.dg/pr52769.c: New test. + +2014-10-31 DJ Delorie <dj@redhat.com> + + * gcc.dg/20141029-1.c: New. + +2014-10-31 Jakub Jelinek <jakub@redhat.com> + + PR sanitizer/63697 + * c-c++-common/ubsan/overflow-sub-3.c: New test. + +2014-10-30 Georg-Johann Lay <avr@gjlay.de> + + PR63633 + * gcc.target/avr/torture/pr63633-ice-mult.c: New test. + +2014-10-30 Release Manager + + * GCC 4.9.2 released. + 2014-10-29 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * gcc.target/aarch64/madd_after_asm_1.c: New test. @@ -12,17 +415,480 @@ PR tree-optimization/63530 gcc.dg/vect/pr63530.c: New test. +2014-10-27 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/entry_queues2.adb: New test. + +2014-10-25 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/63638 + * c-c++-common/asan/pr63638.c: New test. + +2014-10-24 Markus Trippelsdorf <markus@trippelsdorf.de> + + PR bootstrap/63632 + * g++.dg/torture/pr63632.C: New test. + 2014-10-21 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/63563 * gcc.target/i386/pr63563.c: New test. +2014-10-20 Yury Gribov <y.gribov@samsung.com> + + Backported from mainline + 2014-05-30 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/asan/misalign-1.c: New test. + * c-c++-common/asan/misalign-2.c: New test. + +2014-10-17 Jakub Jelinek <jakub@redhat.com> + + * c-c++-common/asan/instrument-with-calls-1.c: Add + -fno-sanitize=address -fsanitize=kernel-address to dg-options. + * c-c++-common/asan/instrument-with-calls-2.c: Likewise. + + PR tree-optimization/63302 + * gcc.c-torture/execute/pr63302.c: New test. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-09-01 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/61897 + PR sanitizer/62140 + + * c-c++-common/asan/pr62140-1.c: New test. + * c-c++-common/asan/pr62140-2.c: New test. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-08-18 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/62089 + + * c-c++-common/asan/pr62089.c: New test. + * c-c++-common/asan/bitfield-1.c: New test. + * c-c++-common/asan/bitfield-2.c: New test. + * c-c++-common/asan/bitfield-3.c: New test. + * c-c++-common/asan/bitfield-4.c: New test. + + Backport from mainline + 2014-08-28 Yury Gribov <y.gribov@samsung.com> + + * c-c++-common/asan/pr62089.c: Fix test on 32-bit platforms. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-08-11 Yury Gribov <y.gribov@samsung.com> + + * c-c++-common/asan/inc.c: Update test. + * c-c++-common/asan/instrument-with-calls-2.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-1.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-2.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-3.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-4.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-5.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-6.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-7.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-8.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-9.c: Likewise. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-06-24 Max Ostapenko <m.ostapenko@partner.samsung.com> + + * c-c++-common/asan/no-redundant-instrumentation-9.c: New test. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-06-16 Yury Gribov <y.gribov@samsung.com> + + * c-c++-common/asan/instrument-with-calls-1.c: New test. + * c-c++-common/asan/instrument-with-calls-2.c: Likewise. + * c-c++-common/asan/no-redundant-instrumentation-1.c: Update + test patterns. + * c-c++-common/asan/no-redundant-instrumentation-2.c: + Likewise. + * c-c++-common/asan/no-redundant-instrumentation-4.c: + Likewise. + * c-c++-common/asan/no-redundant-instrumentation-5.c: + Likewise. + * c-c++-common/asan/no-redundant-instrumentation-6.c: + Likewise. + * c-c++-common/asan/no-redundant-instrumentation-7.c: + Likewise. + * c-c++-common/asan/no-redundant-instrumentation-8.c: + Likewise. + + Backport from mainline + 2014-06-18 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/61530 + + * c-c++-common/asan/pr61530.c: New test. + + Backport from mainline + 2014-06-18 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/61547 + + * c-c++-common/asan/strlen-overflow-1.c: New test. + +2014-10-16 Yury Gribov <y.gribov@samsung.com> + + Backport from mainline + 2014-05-14 Yury Gribov <y.gribov@samsung.com> + + PR sanitizer/61100 + + * c-c++-common/asan/asan-interface-1.c: New test. + * lib/asan-dg.exp (asan_include_flags): New function. + (asan_init): Call asan_include_flags to obtain path + to sanitizer headers. + +2014-10-15 Vladimir Makarov <vmakarov@redhat.com> + + PR rtl-optimization/63448 + * gcc.target/i386/pr63448.c: New test. + +2014-10-15 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/opt41.adb: New test. + * gnat.dg/opt41_pkg.ad[sb]: New helper. + +2014-10-15 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-08-15 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62031 + * gcc.dg/torture/pr62031.c: New testcase. + +2014-10-12 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline r215880 + 2014-10-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * g++.dg/ext/altivec-2.C: Compile with -Wno-deprecated to avoid + failing with the new warning message. + * gcc.dg/vmx/3c-01a.c: Likewise. + * gcc.dg/vmx/ops-long-1.c: Likewise. + * gcc.dg/vmx/ops.c: Likewise. + * gcc.target/powerpc/altivec-20.c: Likewise. + * gcc.target/powerpc/altivec-6.c: Likewise. + * gcc.target/powerpc/altivec-vec-merge.c: Likewise. + * gcc.target/powerpc/vsx-builtin-8.c: Likewise. + * gcc.target/powerpc/warn-lvsl-lvsr.c: New test. + + Backport from mainline r215882 + 2014-10-03 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/lvsl-lvsr.c: New test. + + Backport from mainline r216017 + 2014-10-08 Pat Haugen <pthaugen@us.ibm.com> + + * gcc.dg/vmx/3c-01a.c: Add default options from vmx.exp. + * gcc.dg/vmx/ops.c: Likewise. + * gcc.dg/vmx/ops-long-1.c: Likewise. + +2014-10-11 Christophe Lyon <christophe.lyon@linaro.org> + + Backport from mainline r216117. + 2014-10-11 Christophe Lyon <christophe.lyon@linaro.org> + * lib/target-supports.exp (check_effective_target_shared): New + function. + * g++.dg/ipa/devirt-28a.C: Check if -shared is supported. + +2014-10-10 Jakub Jelinek <jakub@redhat.com> + + PR c/63495 + * gcc.target/i386/pr63495.c: New test. + +2014-10-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63379 + * gcc.dg/vect/pr63379.c: New testcase. + +2014-10-10 Jakub Jelinek <jakub@redhat.com> + + PR fortran/59488 + * gfortran.dg/gomp/pr59488-1.f90: New test. + * gfortran.dg/gomp/pr59488-2.f90: New test. + +2014-10-10 Richard Biener <rguenther@suse.de> + + PR tree-optimization/63380 + * gcc.dg/torture/pr63380-1.c: New testcase. + * gcc.dg/torture/pr63380-2.c: Likewise. + +2014-10-10 Uros Bizjak <ubizjak@gmail.com> + + * g++.dg/cpp1y/feat-cxx14.C: Variable templates not in yet. + (dg-do): Use c++1y target. + +2014-10-08 Edward Smith-Rowland <3dw4rd@verizon.net> + + Implement SD-6: SG10 Feature Test Recommendations + * g++.dg/cpp1y/feat-cxx11-neg.C: New. + * g++.dg/cpp1y/feat-cxx11.C: New. + * g++.dg/cpp1y/feat-cxx14.C: New. + * g++.dg/cpp1y/feat-cxx98.C: New. + * g++.dg/cpp1y/feat-cxx98-neg.C: New. + * g++.dg/cpp1y/phoobhar.h: New. + * g++.dg/cpp1y/testinc/phoobhar.h: New. + +2014-10-03 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/61144 + * gcc.dg/tree-ssa/pr61144.c: New testcase. + +2014-10-03 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/62121 + * g++.dg/torture/pr62121.C: New testcase. + +2014-10-03 Jan Hubicka <hubicka@ucw.cz> + + PR lto/62026 + * g++.dg/lto/pr62026.C: New testcase. + +2014-10-03 Jakub Jelinek <jakub@redhat.com> + + PR libgomp/61200 + * c-c++-common/gomp/pr61200.c: New test. + +2014-10-01 Jakub Jelinek <jakub@redhat.com> + + PR debug/63342 + * gcc.dg/pr63342.c: New test. + + PR target/63428 + * gcc.dg/torture/vshuf-4.inc: Move test 122 from EXPTESTS + to test 24 in TESTS. + + PR c++/63306 + * g++.dg/ipa/pr63306.C: New test. + + 2014-09-18 Vladimir Makarov <vmakarov@redhat.com> + + PR debug/63285 + * gcc.target/i386/pr63285.c: New test. + + 2014-09-10 Jan Hubicka <hubicka@ucw.cz> + + PR tree-optimization/63186 + * gcc.dg/pr63186.c: New testcase. + +2014-09-30 Jakub Jelinek <jakub@redhat.com> + + PR inline-asm/63282 + * gcc.c-torture/compile/pr63282.c: New test. + +2014-09-29 James Clarke <jrtc27@jrtc27.com> + + PR target/61407 + * gcc.dg/darwin-minversion-1.c: Fixed formatting. + * gcc.dg/darwin-minversion-2.c: Fixed formatting. + * gcc.dg/darwin-minversion-3.c: Fixed formatting. + * gcc.dg/darwin-minversion-4.c: Added test for OS X 10.10. + +2014-09-26 Jakub Jelinek <jakub@redhat.com> + + * g++.dg/compat/struct-layout-1_generate.c: Add -Wno-abi + to default options. + +2014-09-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backport from mainline r215559 + 2014-09-25 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + PR target/63335 + * gcc.target/powerpc/pr63335.c: New test. + 2014-09-25 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/63341 * gcc.dg/vect/pr63341-1.c: New test. * gcc.dg/vect/pr63341-2.c: New test. + PR c++/63249 + * g++.dg/gomp/pr63249.C: New test. + * c-c++-common/gomp/pr63249.c: New test. + +2014-09-22 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/62219 + * g++.dg/cpp0x/lambda/lambda-template14.C: New. + +2014-09-22 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2014-05-21 Marek Polacek <polacek@redhat.com> + + PR sanitizer/61272 + * g++.dg/ubsan/pr61272.C: New test. + +2014-09-22 Jakub Jelinek <jakub@redhat.com> + + PR debug/63328 + * c-c++-common/gomp/pr63328.c: New test. + +2014-09-18 H.J. Lu <hongjiu.lu@intel.com> + + Backport from mainline + 2014-09-18 H.J. Lu <hongjiu.lu@intel.com> + + * gcc.dg/pr61053.c: Updated for x32. + +2014-09-18 Jakub Jelinek <jakub@redhat.com> + + PR c++/62017 + * g++.dg/asan/pr62017.C: New test. + + PR testsuite/63292 + * gcc.dg/vect/pr59594.c (b): Increase size to N + 2 elements. + +2014-09-18 Joseph Myers <joseph@codesourcery.com> + + * gcc.dg/torture/float128-exact-underflow.c: New test. + +2014-09-17 Jakub Jelinek <jakub@redhat.com> + + PR debug/63284 + * gcc.dg/pr63284.c: New test. + +2014-09-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/63241 + * g++.dg/cpp0x/constexpr-63241.C: New. + +2014-09-15 Sharad Singhai <singhai@google.com> + + * g++.dg/tree-prof/lipo/static1_0.C: New test. + * g++.dg/tree-prof/lipo/static1_1.C: New file. + * g++.dg/tree-prof/lipo/static1_2.C: New file. + +2014-09-12 Martin Jambor <mjambor@suse.cz> + + PR ipa/61654 + * g++.dg/ipa/pr61654.C: New test. + +2014-09-11 Alan Lawrence <alan.lawrence@arm.com> + + Backport r214953 from mainline + 2014-09-05 Alan Lawrence <alan.lawrence@arm.com> + + * gcc.target/aarch64/scalar_intrinsics.c (*): Replace all + int{32,16,8}x1_t with int{32,16,8}_t. + * gcc.target/aarch64/simd/vqdmlalh_lane_s16.c: Likewise. + * gcc.target/aarch64/simd/vqdmlslh_lane_s16.c: Likewise. + * gcc.target/aarch64/simd/vqdmullh_lane_s16.c: Likewise. + * gcc.target/aarch64/simd/vqdmulls_lane_s32.c: Likewise. + +2014-09-10 Xinliang David Li <davidxl@google.com> + + Backport from mainline + PR target/63209 + * gcc.c-torture/execute/pr63209.c: New test. + +2014-09-09 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + Backported from mainline + 2014-09-04 Bill Schmidt <wschmidt@linux.vnet.ibm.com> + + * gcc.target/powerpc/vsx-extract-1.c: Test 0th doubleword + regardless of endianness. + +2014-09-09 Richard Biener <rguenther@suse.de> + + Backport from mainline + 2014-08-11 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62075 + * gcc.dg/vect/pr62075.c: New testcase. + + 2014-08-14 Richard Biener <rguenther@suse.de> + + PR rtl-optimization/62079 + * g++.dg/pr62079.C: New testcase. + + 2014-08-26 Richard Biener <rguenther@suse.de> + + PR tree-optimization/62175 + * g++.dg/torture/pr62175.C: New testcase. + +2014-09-08 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/60196 + PR tree-optimization/63189 + * gcc.dg/vect/pr63189.c: New test. + * gcc.dg/vect/pr60196-1.c: New test. + * gcc.dg/vect/pr60196-2.c: New test. + +2014-09-06 John David Anglin <danglin@gcc.gnu.org> + + PR testsuite/56194 + * g++.dg/init/const9.C: Skip scan-assembler-not "rodata" on hppa*-*-*. + +2014-09-05 Easwaran Raman <eraman@google.com> + + Backport from mainline + PR rtl-optimization/62146 + * testsuite/g++.dg/opt/pr62146.C: New. + +2014-09-04 Guozhi Wei <carrot@google.com> + + PR target/62040 + * gcc.target/aarch64/pr62040.c: New test. + +2014-09-03 Martin Jambor <mjambor@suse.cz> + + PR ipa/62015 + * g++.dg/ipa/pr62015.C: New test. + +2014-09-03 Martin Jambor <mjambor@suse.cz> + + PR ipa/61986 + * gcc.dg/ipa/pr61986.c: New test. + +2014-09-03 Marek Polacek <polacek@redhat.com> + + Backport from mainline + 2014-09-02 Marek Polacek <polacek@redhat.com> + + PR fortran/62270 + * gfortran.dg/pointer_intent_7.f90: Adjust dg-error. + +2014-09-03 Marek Polacek <polacek@redhat.com> + + PR c/62294 + * gcc.dg/pr56724-1.c: New test. + * gcc.dg/pr56724-2.c: New test. + * gcc.dg/pr62294.c: New test. + * gcc.dg/pr62294.h: New file. + +2014-09-01 Oleg Endo <olegendo@gcc.gnu.org> + + Backport from mainline + 2014-09-01 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/62312 + * gcc.c-torture/compile/pr62312.c: New. + +2014-09-01 Maciej W. Rozycki <macro@codesourcery.com> + + Backport from mainline + 2014-09-01 Maciej W. Rozycki <macro@codesourcery.com> + + * gcc.dg/tree-ssa/loop-19.c: Exclude classic FPU Power targets. + 2014-09-04 Guozhi Wei <carrot@google.com> PR target/62040 @@ -4619,6 +5485,11 @@ PR middle-end/59471 * gcc.dg/pr59471.c: New testcase. +2014-01-08 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/56867 + * gfortran.dg/dependency_45.f90: New test. + 2014-01-07 Jeff Law <law@redhat.com> PR middle-end/53623 diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/asan-interface-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/asan-interface-1.c new file mode 100644 index 000000000..8cd80caaa --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/asan-interface-1.c @@ -0,0 +1,14 @@ +/* Check that interface headers work. */ + +/* { dg-do run { target { *-*-linux* } } } */ + +#include <stdbool.h> +#include <sanitizer/asan_interface.h> + +int main() { + char tmp; + if (__asan_address_is_poisoned((volatile char *)&tmp + 1)) + return 0; + return 1; +} + diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-1.c new file mode 100644 index 000000000..b3f300c64 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-1.c @@ -0,0 +1,25 @@ +/* Check that Asan correctly instruments bitfields with non-round size. */ + +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +struct A +{ + char base; + int : 4; + long x : 7; +}; + +int __attribute__ ((noinline, noclone)) +f (void *p) { + return ((struct A *)p)->x; +} + +int +main () +{ + char a = 0; + return f (&a); +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-2.c new file mode 100644 index 000000000..8ab0f8069 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-2.c @@ -0,0 +1,25 @@ +/* Check that Asan correctly instruments bitfields with non-round offset. */ + +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +struct A +{ + char base; + int : 7; + int x : 8; +}; + +int __attribute__ ((noinline, noclone)) +f (void *p) { + return ((struct A *)p)->x; +} + +int +main () +{ + char a = 0; + return f (&a); +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-3.c new file mode 100644 index 000000000..c5907786f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-3.c @@ -0,0 +1,25 @@ +/* Check that Asan correctly instruments bitfields with round offset. */ + +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +struct A +{ + char base; + int : 8; + int x : 8; +}; + +int __attribute__ ((noinline, noclone)) +f (void *p) { + return ((struct A *)p)->x; +} + +int +main () +{ + char a = 0; + return f (&a); +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-4.c new file mode 100644 index 000000000..94de9a437 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/bitfield-4.c @@ -0,0 +1,25 @@ +/* Check that Asan correctly instruments bitfields with round offset. */ + +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +struct A +{ + char base; + int : 0; + int x : 8; +}; + +int __attribute__ ((noinline, noclone)) +f (void *p) { + return ((struct A *)p)->x; +} + +int +main () +{ + char a = 0; + return f (&a); +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c index b9c6734ea..36cc3d8d8 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/inc.c @@ -16,6 +16,6 @@ main () return 0; } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 1 "asan0" } } */ -/* { dg-final { scan-tree-dump "__builtin___asan_report_load4" "asan0" } } */ +/* { dg-final { scan-tree-dump-times "ASAN_" 1 "asan0" } } */ +/* { dg-final { scan-tree-dump "ASAN_CHECK \\(.*, 4\\);" "asan0" } } */ /* { dg-final { cleanup-tree-dump "asan0" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c new file mode 100644 index 000000000..32e32a600 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-1.c @@ -0,0 +1,10 @@ +/* { dg-do assemble } */ +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=0 -save-temps" } */ + +void f(char *a, int *b) { + *b = *a; +} + +/* { dg-final { scan-assembler "__asan_load1" } } */ +/* { dg-final { scan-assembler "__asan_store4" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c new file mode 100644 index 000000000..1b361e627 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/instrument-with-calls-2.c @@ -0,0 +1,16 @@ +/* { dg-do assemble } */ +/* { dg-options "-fno-sanitize=address -fsanitize=kernel-address --param asan-instrumentation-with-call-threshold=1 -save-temps" } */ + +int x; + +void f(int *a, int *b) { + *a = 0; + asm volatile ("" ::: "memory"); + x = *b; +} + +/* { dg-final { scan-assembler "__asan_store4" } } */ +/* { dg-final { scan-assembler-not "__asan_report_store4" } } */ +/* { dg-final { scan-assembler "__asan_load4" } } */ +/* { dg-final { scan-assembler-not "__asan_report_load4" } } */ +/* { dg-final { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-1.c new file mode 100644 index 000000000..0c5b6e0c7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-1.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { ilp32 || lp64 } } } */ +/* { dg-options "-O2" } */ +/* { dg-shouldfail "asan" } */ + +struct S { int i; } __attribute__ ((packed)); + +__attribute__((noinline, noclone)) int +foo (struct S *s) +{ + return s->i; +} + +__attribute__((noinline, noclone)) int +bar (int *s) +{ + return *s; +} + +__attribute__((noinline, noclone)) struct S +baz (struct S *s) +{ + return *s; +} + +int +main () +{ + struct T { char a[3]; struct S b[3]; char c; } t; + int v = 5; + struct S *p = t.b; + asm volatile ("" : "+rm" (p)); + p += 3; + if (bar (&v) != 5) __builtin_abort (); + volatile int w = foo (p); + return 0; +} + +/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */ +/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ (in _*foo(\[^\n\r]*misalign-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-1.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-2.c new file mode 100644 index 000000000..7fbe299cc --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/misalign-2.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { ilp32 || lp64 } } } */ +/* { dg-options "-O2" } */ +/* { dg-shouldfail "asan" } */ + +struct S { int i; } __attribute__ ((packed)); + +__attribute__((noinline, noclone)) int +foo (struct S *s) +{ + return s->i; +} + +__attribute__((noinline, noclone)) int +bar (int *s) +{ + return *s; +} + +__attribute__((noinline, noclone)) struct S +baz (struct S *s) +{ + return *s; +} + +int +main () +{ + struct T { char a[3]; struct S b[3]; char c; } t; + int v = 5; + struct S *p = t.b; + asm volatile ("" : "+rm" (p)); + p += 3; + if (bar (&v) != 5) __builtin_abort (); + volatile struct S w = baz (p); + return 0; +} + +/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */ +/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ (in _*baz(\[^\n\r]*misalign-2.c:22|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-2.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c index fa52e0ca8..028f8d715 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c @@ -2,7 +2,7 @@ location in the same basic block, the second reference should not be instrumented by the Address Sanitizer. */ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ @@ -16,12 +16,11 @@ test0 () tab[0] = 1; tab[1] = 2; - /* __builtin___asan_report_load1 called 1 time for the store - below. */ - char t0 = tab[1]; - /* This load should not be instrumented because it is to the same memory location as above. */ + char t0 = tab[1]; + + /* Likewise. */ char t1 = tab[1]; return t0 + t1; @@ -36,7 +35,7 @@ test1 (int i) the initialization. */ foo[i] = 1; - /*__builtin___asan_report_store1 called 2 times here to instrument + /*__builtin___asan_report_store_n called once here to instrument the store to the memory region of tab. */ __builtin_memset (tab, 3, sizeof (tab)); @@ -44,8 +43,8 @@ test1 (int i) __builtin_memset (tab, 4, sizeof (tab)); __builtin_memset (tab, 5, sizeof (tab)); - /* There are 2 calls to __builtin___asan_report_store1 and 2 calls - to __builtin___asan_report_load1 to instrument the store to + /* There is a call to __builtin___asan_report_store_n and a call + to __builtin___asan_report_load_n to instrument the store to (subset of) the memory region of tab. */ __builtin_memcpy (&tab[1], foo + i, 3); @@ -53,7 +52,7 @@ test1 (int i) the reference to tab[1] has been already instrumented above. */ return tab[1]; - /* So for these function, there should be 7 calls to + /* So for these functions, there should be 3 calls to __builtin___asan_report_store1. */ } @@ -63,6 +62,7 @@ main () return test0 () && test1 (0); } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 7 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 2 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 3 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c index 28525e0ff..a58411c3a 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-2.c @@ -3,7 +3,7 @@ be instrumented by the Address Sanitizer. But in case of access to overlapping regions we must be precise. */ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ @@ -20,6 +20,7 @@ main () __builtin_memset (tab, 1, 3); } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 3 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 3 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 3 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c index 420a26309..5193ae06f 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-3.c @@ -1,4 +1,4 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ @@ -12,7 +12,7 @@ foo (__INT32_TYPE__ *p) return ret; } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store" 1 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report" 2 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c index b2e72841b..c3632aa3d 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-4.c @@ -1,13 +1,17 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ void foo (int *a, char *b, char *c) { + /* One check for c[0], one check for a[], one check for c, two checks for b. */ __builtin_memmove (c, b, a[c[0]]); + /* For a total of 5 checks. */ } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 1 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c index ead3f5823..077ea34d0 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-5.c @@ -1,13 +1,18 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ void foo (int *a, char *b, char *c) { + /* One check for b[0], one check for a[], 2 checks for c and one checks for b. */ __builtin_memmove (c, b, a[b[0]]); + /* For a total of 5 checks. */ } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 2 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c index e4691bc47..6d87104aa 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-6.c @@ -1,14 +1,20 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ void foo (int *a, char *b, char *c) { + /* One check for c[0], one check for a[], one check for c and 2 checks for b. */ __builtin_memmove (c, b, a[c[0]]); + /* One check for a[], one check for c and one check for b. */ __builtin_memmove (c, b, a[b[0]]); + /* For a total of 8 checks. */ } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 5 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 8 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 2 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 2 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 2 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c index bf40a0376..5baa10dcd 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-7.c @@ -1,4 +1,4 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ @@ -13,11 +13,15 @@ struct S int foo (int *a, char *b, char *c) { + /* 2 checks for s.a, 2 checks for e. */ int d = __builtin_memcmp (s.a, e, 100); + /* One check for s.a and one check for e. */ d += __builtin_memcmp (s.a, e, 200); + /* For a total of 6 checks. */ return d; } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load" 6 "asan0" } } */ -/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 6 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 4 "sanopt" } } */ +/* { dg-final { scan-tree-dump-not "__builtin___asan_report_store" "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c index 38ea7a21d..2a4c0812f 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-8.c @@ -1,14 +1,20 @@ -/* { dg-options "-fdump-tree-asan0" } */ +/* { dg-options "-fdump-tree-sanopt" } */ /* { dg-do compile } */ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ char foo (int *a, char *b, char *c) { + /* One check for b[0], one check for a[], two checks for c and one check for b. */ __builtin_memmove (c, b, a[b[0]]); + /* No checks here. */ return c[0] + b[0]; + /* For a total of 5 checks. */ } -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 3 "asan0" } } */ -/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store1" 2 "asan0" } } */ -/* { dg-final { cleanup-tree-dump "asan0" } } */ +/* { dg-final { scan-tree-dump-times "& 7" 5 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load4" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_load_n" 1 "sanopt" } } */ +/* { dg-final { scan-tree-dump-times "__builtin___asan_report_store_n" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c new file mode 100644 index 000000000..9449de578 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-9.c @@ -0,0 +1,13 @@ +/* { dg-options "-fdump-tree-sanopt" } */ +/* { dg-do compile } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +__SIZE_TYPE__ +f (char *a) +{ + a[0] = '1'; + return __builtin_strlen (a); +} + +/* { dg-final { scan-tree-dump-times "__asan_report_load1" 1 "sanopt" } } */ +/* { dg-final { cleanup-tree-dump "sanopt" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr61530.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr61530.c new file mode 100644 index 000000000..e306a71be --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr61530.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +__attribute__((noinline,noclone)) void +foo (char *a, char *b) { + a[0] = b[0] = 0; + __builtin_memcpy(a, b, 4); +} + +int +main () { + char a, b; + foo (&a, &b); + return 0; +} + +/* { dg-output "ERROR: AddressSanitizer: stack-buffer-overflow" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c new file mode 100644 index 000000000..9b92e9bbf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62089.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-shouldfail "asan" } */ + +#include <stdbool.h> +#include <sanitizer/asan_interface.h> + +struct vfsmount {}; +struct dentry {}; + +struct path { + struct vfsmount *mnt; + struct dentry *dentry; +}; + +struct fs_struct { + int users; + int lock; + int seq; + int umask; + int in_exec; + struct path root, pwd; +}; + +void __attribute__((noinline, noclone)) +copy_fs_struct(struct fs_struct *a, struct fs_struct *b) { + a->root = b->root; +} + +struct fs_struct a, b; + +int +main () { + __asan_poison_memory_region (&a.root, sizeof (a.root)); + copy_fs_struct (&a, &b); + return 0; +} + +/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-1.c new file mode 100644 index 000000000..f0b026de2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-w -fpermissive" } */ + +int memcmp (const void *p, const void *q, int len); + +int f (int *p, int *q, int len) +{ + return memcmp (p, q, len); +} + diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-2.c new file mode 100644 index 000000000..0bb2563ab --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr62140-2.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-w -fpermissive" } */ + +int strlen (const char *p); + +int f (char *p) +{ + int x = strlen (p); + return x; +} + diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr63638.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr63638.c new file mode 100644 index 000000000..a8bafc5aa --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/pr63638.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +extern +#ifdef __cplusplus +"C" +#endif +void *memcpy (void *, const void *, __SIZE_TYPE__); + +struct S{ + long d0, d1, d2, d3, d4, d5, d6; +}; + +struct S s[6]; + +int f(struct S *p) +{ + memcpy(p, &s[2], sizeof(*p)); + memcpy(p, &s[1], sizeof(*p)); +} + diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c new file mode 100644 index 000000000..4833dc778 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/asan/strlen-overflow-1.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ +/* { dg-shouldfail "asan" } */ + +#include <stdbool.h> +#include <sanitizer/asan_interface.h> + +char a[2] = "0"; + +#ifdef __cplusplus +extern "C" +#endif + +__attribute__((no_sanitize_address, noinline)) __SIZE_TYPE__ +strlen (const char *p) { + + __SIZE_TYPE__ n = 0; + for (; *p; ++n, ++p); + return n; +} + +int main () { + char *p = &a[0]; + asm ("" : "+r"(p)); + __asan_poison_memory_region ((char *)&a[1], 1); + return __builtin_strlen (a); +} + +/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */ +/* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strlen-overflow-1.c:26|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-4.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-4.c new file mode 100644 index 000000000..a9bc0fa25 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr60823-4.c @@ -0,0 +1,7 @@ +/* PR tree-optimization/63915 */ +/* { dg-do run } */ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-options "-O2 -fopenmp-simd" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +#include "pr60823-2.c" diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61200.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61200.c new file mode 100644 index 000000000..d0d699dfa --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr61200.c @@ -0,0 +1,13 @@ +/* PR libgomp/61200 */ + +int +main () +{ + int var = 1; + #pragma omp parallel + if (var != 1) + __builtin_abort (); + #pragma omp task shared(var) + var = 2; + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63249.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63249.c new file mode 100644 index 000000000..878788ad7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63249.c @@ -0,0 +1,16 @@ +/* PR c++/63249 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -W -fopenmp" } */ + +int +foo (int *v, int A, int B) /* { dg-bogus "set but not used" } */ +{ + int r = 0; + int a = 2; /* { dg-bogus "set but not used" } */ + int b = 4; /* { dg-bogus "set but not used" } */ +#pragma omp target map(to: v[a:b]) + r |= v[3]; +#pragma omp target map(to: v[A:B]) + r |= v[3]; + return r; +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63328.c b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63328.c new file mode 100644 index 000000000..3958abe16 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/gomp/pr63328.c @@ -0,0 +1,5 @@ +/* PR debug/63328 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fopenmp-simd -fno-strict-aliasing -fcompare-debug" } */ + +#include "pr60823-3.c" diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr56493.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr56493.c new file mode 100644 index 000000000..418126043 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr56493.c @@ -0,0 +1,16 @@ +/* PR c++/56493 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-gimple" } */ + +unsigned long long bar (void); +int x; + +void +foo (void) +{ + x += bar (); +} + +/* Verify we narrow the addition from unsigned long long to unsigned int type. */ +/* { dg-final { scan-tree-dump " (\[a-zA-Z._0-9]*) = \\(unsigned int\\) \[^;\n\r]*;.* (\[a-zA-Z._0-9]*) = \\(unsigned int\\) \[^;\n\r]*;.* = \\1 \\+ \\2;" "gimple" { target { ilp32 || lp64 } } } } */ +/* { dg-final { cleanup-tree-dump "gimple" } } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/pr61553.c b/gcc-4.9/gcc/testsuite/c-c++-common/pr61553.c new file mode 100644 index 000000000..8a3b699ee --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/pr61553.c @@ -0,0 +1,8 @@ +/* PR c/61553 */ +/* { dg-do compile } */ + +void +foo (char *s) +{ + __atomic_store (s, (void *) 0, __ATOMIC_SEQ_CST); /* { dg-error "size mismatch" } */ +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c index 6a3795120..746afa7b4 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/atomic_stack.c @@ -1,22 +1,26 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int Global; void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); __atomic_fetch_add(&Global, 1, __ATOMIC_RELAXED); return NULL; } void *Thread2(void *x) { Global++; + barrier_wait(&barrier); return NULL; } int main() { + barrier_init(&barrier, 2); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c index 28cd630d2..e2176da4b 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/fd_pipe_race.c @@ -1,30 +1,35 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> #include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int fds[2]; void *Thread1(void *x) { write(fds[1], "a", 1); + barrier_wait(&barrier); return NULL; } void *Thread2(void *x) { - sleep(1); + barrier_wait(&barrier); close(fds[0]); close(fds[1]); return NULL; } int main() { + barrier_init(&barrier, 2); pipe(fds); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); pthread_join(t[0], NULL); pthread_join(t[1], NULL); + return 0; } /* { dg-output "WARNING: ThreadSanitizer: data race.*\n" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c index 7c32a8524..084f5141d 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/mutexset1.c @@ -1,14 +1,15 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int Global; pthread_mutex_t mtx; void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); pthread_mutex_lock(&mtx); Global++; pthread_mutex_unlock(&mtx); @@ -17,11 +18,13 @@ void *Thread1(void *x) { void *Thread2(void *x) { Global--; + barrier_wait(&barrier); return NULL;/* { dg-output ".*" } */ } int main() { + barrier_init(&barrier, 2); pthread_mutex_init(&mtx, 0); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c index 0a0e5faba..3de3ff225 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_barrier.c @@ -1,26 +1,28 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> -#include <stddef.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; pthread_barrier_t B; int Global; void *Thread1(void *x) { pthread_barrier_init(&B, 0, 2); + barrier_wait(&barrier); pthread_barrier_wait(&B); return NULL; } void *Thread2(void *x) { - sleep(1); + barrier_wait(&barrier); pthread_barrier_wait(&B); return NULL; } int main() { + barrier_init(&barrier, 2); pthread_t t; pthread_create(&t, NULL, Thread1, NULL); Thread2(0); diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c index 5dad345d8..ae30d053c 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex.c @@ -1,10 +1,10 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> -#include <stddef.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; pthread_mutex_t Mtx; int Global; @@ -13,11 +13,12 @@ void *Thread1(void *x) { pthread_mutex_lock(&Mtx); Global = 42; pthread_mutex_unlock(&Mtx); + barrier_wait(&barrier); return NULL; } void *Thread2(void *x) { - sleep(1); + barrier_wait(&barrier); pthread_mutex_lock(&Mtx); Global = 43; pthread_mutex_unlock(&Mtx); @@ -25,6 +26,7 @@ void *Thread2(void *x) { } int main() { + barrier_init(&barrier, 2); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); @@ -37,7 +39,7 @@ int main() { /* { dg-output "WARNING: ThreadSanitizer: data race.*(\n|\r\n|\r)" } */ /* { dg-output " Atomic read of size 1 at .* by thread T2:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_mutex_lock.*" } */ -/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:21|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 Thread2.* .*(race_on_mutex.c:22|\\?{2}:0) (.*)" } */ /* { dg-output " Previous write of size 1 at .* by thread T1:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_mutex_init .* (.)*" } */ /* { dg-output " #1 Thread1.* .*(race_on_mutex.c:12|\\?{2}:0) .*" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c index 80a6fb6c0..57d7e21e7 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/race_on_mutex2.c @@ -1,22 +1,25 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> -#include <stddef.h> -#include <unistd.h> +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; void *Thread(void *x) { pthread_mutex_lock((pthread_mutex_t*)x); pthread_mutex_unlock((pthread_mutex_t*)x); + barrier_wait(&barrier); return 0; } int main() { + barrier_init(&barrier, 2); pthread_mutex_t Mtx; pthread_mutex_init(&Mtx, 0); pthread_t t; pthread_create(&t, 0, Thread, &Mtx); - sleep(1); + barrier_wait(&barrier); pthread_mutex_destroy(&Mtx); pthread_join(t, 0); return 0; diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c index a40accd40..c1a369b45 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_race.c @@ -1,13 +1,15 @@ /* { dg-set-target-env-var TSAN_OPTIONS "halt_on_error=1" } */ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> #include <unistd.h> +#include "tsan_barrier.h" -#define MAX_ITERATIONS_NUMBER 100 -#define SLEEP_STEP 128000 +#define MAX_ITERATIONS_NUMBER 1 +#define SLEEP_STEP 128000 +static pthread_barrier_t barrier; unsigned int delay_time = 1000; static inline void delay () { @@ -17,6 +19,7 @@ static inline void delay () { extern int main_1(); int main() { + barrier_init(&barrier, 2); int i; for (i = 0; i < MAX_ITERATIONS_NUMBER; i++) { main_1(); @@ -28,6 +31,7 @@ int main() { int Global; void *Thread1(void *x) { + barrier_wait(&barrier); delay(); Global = 42; return NULL; @@ -35,6 +39,7 @@ void *Thread1(void *x) { void *Thread2(void *x) { Global = 43; + barrier_wait(&barrier); return NULL; } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c index b66a67085..a4d0aba69 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/simple_stack.c @@ -1,9 +1,10 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stdio.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int Global; void __attribute__((noinline)) foo1() { @@ -25,13 +26,14 @@ void __attribute__((noinline)) bar2() { } void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); bar1(); return NULL; } void *Thread2(void *x) { bar2(); + barrier_wait(&barrier); return NULL; } @@ -40,6 +42,7 @@ void StartThread(pthread_t *t, void *(*f)(void*)) { } int main() { + barrier_init(&barrier, 2); pthread_t t[2]; StartThread(&t[0], Thread1); StartThread(&t[1], Thread2); @@ -50,16 +53,16 @@ int main() { /* { dg-output "WARNING: ThreadSanitizer: data race.*" } */ /* { dg-output " Write of size 4 at .* by thread T1:(\n|\r\n|\r)" } */ -/* { dg-output " #0 foo1.* .*(simple_stack.c:10|\\?{2}:0) (.*)" } */ -/* { dg-output " #1 bar1.* .*(simple_stack.c:15|\\?{2}:0) (.*)" } */ -/* { dg-output " #2 Thread1.* .*(simple_stack.c:29|\\?{2}:0) (.*)" } */ +/* { dg-output " #0 foo1.* .*(simple_stack.c:11|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 bar1.* .*(simple_stack.c:16|\\?{2}:0) (.*)" } */ +/* { dg-output " #2 Thread1.* .*(simple_stack.c:30|\\?{2}:0) (.*)" } */ /* { dg-output " Previous read of size 4 at .* by thread T2:(\n|\r\n|\r)" } */ -/* { dg-output " #0 foo2.* .*(simple_stack.c:19|\\?{2}:0) (.*)" } */ -/* { dg-output " #1 bar2.* .*(simple_stack.c:24|\\?{2}:0) (.*)" } */ -/* { dg-output " #2 Thread2.* .*(simple_stack.c:34|\\?{2}:0) (.*)" } */ +/* { dg-output " #0 foo2.* .*(simple_stack.c:20|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 bar2.* .*(simple_stack.c:25|\\?{2}:0) (.*)" } */ +/* { dg-output " #2 Thread2.* .*(simple_stack.c:35|\\?{2}:0) (.*)" } */ /* { dg-output " Thread T1 \\(tid=.*, running\\) created by main thread at:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_create .* (.*)" } */ -/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 StartThread.* .*(simple_stack.c:41|\\?{2}:0) (.*)" } */ /* { dg-output " Thread T2 (.*) created by main thread at:(\n|\r\n|\r)" } */ /* { dg-output " #0 pthread_create .* (.*)" } */ -/* { dg-output " #1 StartThread.* .*(simple_stack.c:39|\\?{2}:0) (.*)" } */ +/* { dg-output " #1 StartThread.* .*(simple_stack.c:41|\\?{2}:0) (.*)" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c index 44d44554c..c681dcef1 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/sleep_sync.c @@ -1,8 +1,11 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> #include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int X = 0; void MySleep() { @@ -10,15 +13,18 @@ void MySleep() { } void *Thread(void *p) { + barrier_wait(&barrier); MySleep(); // Assume the main thread has done the write. X = 42; return 0; } int main() { + barrier_init(&barrier, 2); pthread_t t; pthread_create(&t, 0, Thread, 0); X = 43; + barrier_wait(&barrier); pthread_join(t, 0); return 0; } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c index 962497b28..10a3feb9b 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tiny_race.c @@ -1,20 +1,24 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; int Global; void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); Global = 42; return x; } int main() { + barrier_init(&barrier, 2); pthread_t t; pthread_create(&t, 0, Thread1, 0); Global = 43; + barrier_wait(&barrier); pthread_join(t, 0); return Global; } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c index 423867e38..4dd650604 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tls_race.c @@ -1,18 +1,24 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <stddef.h> +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; void *Thread(void *a) { + barrier_wait(&barrier); *(int*)a = 43; return 0; } int main() { + barrier_init(&barrier, 2); static __thread int Var = 42; pthread_t t; pthread_create(&t, 0, Thread, &Var); Var = 43; + barrier_wait(&barrier); pthread_join(t, 0); } diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h new file mode 100644 index 000000000..5d37a6475 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/tsan_barrier.h @@ -0,0 +1,14 @@ +/* TSAN-invisible barriers. Link with -ldl. */ +#include <pthread.h> +#include <dlfcn.h> + +static __typeof(pthread_barrier_wait) *barrier_wait; + +static +void barrier_init (pthread_barrier_t *barrier, unsigned count) +{ + void *h = dlopen ("libpthread.so.0", RTLD_LAZY); + barrier_wait = (__typeof (pthread_barrier_wait) *) + dlsym (h, "pthread_barrier_wait"); + pthread_barrier_init (barrier, NULL, count); +} diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c index 898d23d50..df32632bf 100644 --- a/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c +++ b/gcc-4.9/gcc/testsuite/c-c++-common/tsan/write_in_reader_lock.c @@ -1,8 +1,10 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <unistd.h> +#include "tsan_barrier.h" +static pthread_barrier_t barrier; pthread_rwlock_t rwlock; int GLOB; @@ -10,13 +12,14 @@ void *Thread1(void *p) { (void)p; pthread_rwlock_rdlock(&rwlock); // Write under reader lock. - sleep(1); + barrier_wait(&barrier); GLOB++; pthread_rwlock_unlock(&rwlock); return 0; } int main(int argc, char *argv[]) { + barrier_init(&barrier, 2); pthread_rwlock_init(&rwlock, NULL); pthread_rwlock_rdlock(&rwlock); pthread_t t; @@ -24,6 +27,7 @@ int main(int argc, char *argv[]) { volatile int x = GLOB; (void)x; pthread_rwlock_unlock(&rwlock); + barrier_wait(&barrier); pthread_join(t, 0); pthread_rwlock_destroy(&rwlock); return 0; diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c new file mode 100644 index 000000000..deec5c411 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/overflow-sub-3.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=signed-integer-overflow" } */ + +__attribute__((noinline, noclone)) int +foo1 (int x, int y) +{ + return x - y; +} + +__attribute__((noinline, noclone)) int +foo2 (int x, int y) +{ + unsigned int xa = (unsigned int) x - (__INT_MAX__ - 3); + xa &= 3; + x = __INT_MAX__ - 3 + xa; + unsigned int ya = y + 1U; + ya &= 1; + y = ya - 1; + return x - y; +} + +int +main () +{ + int xm1, y; + for (xm1 = __INT_MAX__ - 4; xm1 < __INT_MAX__; xm1++) + for (y = -1; y <= 0; y++) + if (foo1 (xm1 + 1, y) != (int) (xm1 + 1U - y) + || foo2 (xm1 + 1, y) != (int) (xm1 + 1U - y)) + __builtin_abort (); + return 0; +} +/* { dg-output ":7:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*:19:\[0-9]\[^\n\r]*signed integer overflow: 2147483647 - -1 cannot be represented in type 'int'" } */ diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c new file mode 100644 index 000000000..fd5b4d3e9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/undefined-2.c @@ -0,0 +1,26 @@ +/* { dg-do run } */ +/* { dg-options "-fsanitize=undefined" } */ +/* { dg-additional-options "-std=gnu11" { target c } } */ +/* { dg-additional-options "-std=c++11" { target c++ } } */ + +#include <stdio.h> + +volatile int w, z; + +__attribute__ ((noinline, noclone)) int +foo (int x, int y) +{ + z++; + return x << y; +} + +int +main () +{ + fputs ("1st\n", stderr); + w = foo (0, -__INT_MAX__); + return 0; +} + +/* { dg-output "1st(\n|\r\n|\r)" } */ +/* { dg-output "\[^\n\r]*shift exponent -\[^\n\r]* is negative\[^\n\r]*(\n|\r\n|\r)" } */ diff --git a/gcc-4.9/gcc/testsuite/g++.dg/abi/aarch64_guard1.C b/gcc-4.9/gcc/testsuite/g++.dg/abi/aarch64_guard1.C index ca1778b87..e2669a89f 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/abi/aarch64_guard1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/abi/aarch64_guard1.C @@ -13,5 +13,4 @@ int *foo () } // { dg-final { scan-assembler _ZGVZ3foovE1x,8,8 } } -// { dg-final { scan-tree-dump "_ZGVZ3foovE1x & 1" "original" } } -// { dg-final { cleanup-tree-dump "original" } } +// { dg-final { scan-tree-dump "& 1" "original" } } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/abi/no-weak1.C b/gcc-4.9/gcc/testsuite/g++.dg/abi/no-weak1.C new file mode 100644 index 000000000..d53901531 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/abi/no-weak1.C @@ -0,0 +1,13 @@ +// { dg-options "-fno-weak" } +// { dg-final { scan-assembler "local\[ \t\]*_ZZL1fvE1i" { target x86_64-*-*gnu } } } + +static inline void f() +{ + static int i; + ++i; +}; + +int main() +{ + f(); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/abi/spec1.C b/gcc-4.9/gcc/testsuite/g++.dg/abi/spec1.C new file mode 100644 index 000000000..153c0cfe7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/abi/spec1.C @@ -0,0 +1,4 @@ +// { dg-final { scan-assembler-not "weak" } } + +template <class T> struct A { static int i; }; +template<> int A<int>::i = 42; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/asan/pr62017.C b/gcc-4.9/gcc/testsuite/g++.dg/asan/pr62017.C new file mode 100644 index 000000000..74ef37fd2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/asan/pr62017.C @@ -0,0 +1,17 @@ +// PR c++/62017 +// { dg-do run } + +struct A +{ + int x; + virtual ~A () {} +}; +struct B : public virtual A {}; +struct C : public virtual A {}; +struct D : public B, virtual public C {}; + +int +main () +{ + D d; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c b/gcc-4.9/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c index 2cf08946e..2884c25f3 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c +++ b/gcc-4.9/gcc/testsuite/g++.dg/compat/struct-layout-1_generate.c @@ -1,5 +1,5 @@ /* Structure layout test generator. - Copyright (C) 2004, 2005, 2007, 2008, 2009, 2011, 2012 + Copyright (C) 2004-2014 Free Software Foundation, Inc. Contributed by Jakub Jelinek <jakub@redhat.com>. @@ -44,7 +44,7 @@ along with GCC; see the file COPYING3. If not see #endif const char *dg_options[] = { -"/* { dg-options \"%s-I%s\" } */\n", +"/* { dg-options \"%s-I%s -Wno-abi\" } */\n", "/* { dg-options \"%s-I%s -mno-mmx -Wno-abi\" { target i?86-*-* x86_64-*-* } } */\n", "/* { dg-options \"%s-I%s -fno-common\" { target hppa*-*-hpux* powerpc*-*-darwin* *-*-mingw32* *-*-cygwin* } } */\n", "/* { dg-options \"%s-I%s -mno-mmx -fno-common -Wno-abi\" { target i?86-*-darwin* x86_64-*-darwin* i?86-*-mingw32* x86_64-*-mingw32* i?86-*-cygwin* } } */\n", diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C new file mode 100644 index 000000000..bd20b54f1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C @@ -0,0 +1,43 @@ +// PR c++/63849 +// { dg-do compile { target c++11 } } + +template <class _T, class...> +using First = _T; // we should not use this + // alias with only + // one pack parameter (?) + +template <template <class...> class _Successor, + int, + class... _Xs> +struct Overlay +{ + using O = _Successor<_Xs...>; +}; + +template <class... _Pack> +struct List +{ + template <int _s> + using O = typename Overlay<List, _s, _Pack...>::O; + + template <template <class...> class _S> + using Pass = _S<_Pack...>; + + template <int _i> + using At = typename O<_i> + ::template Pass<First>; +}; + +template <int _i> +using At = typename List<int, char> +::template At<_i>; + +template <int _i> +void func_crash(At<_i>&) {} + +int main(int argc, char *argv[]) +{ + char ccc; + int iii; + func_crash<0>(iii); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C new file mode 100644 index 000000000..2553cae34 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C @@ -0,0 +1,13 @@ +// PR c++/63241 +// { dg-do compile { target c++11 } } + +struct A { + constexpr A(int){} +}; + +int main() { + int i = 1; + A array[2][2] = + {{{0}, {i}}, + {{0}, {0}}}; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C new file mode 100644 index 000000000..aa0ce5e7c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C @@ -0,0 +1,19 @@ +// PR c++/63265 +// { dg-do compile { target c++11 } } + +#define LSHIFT (sizeof(unsigned int) * __CHAR_BIT__) + +template <int lshift> +struct SpuriouslyWarns1 { + static constexpr unsigned int v = lshift < LSHIFT ? 1U << lshift : 0; +}; + +static_assert(SpuriouslyWarns1<LSHIFT>::v == 0, "Impossible occurred"); + +template <int lshift> +struct SpuriouslyWarns2 { + static constexpr bool okay = lshift < LSHIFT; + static constexpr unsigned int v = okay ? 1U << lshift : 0; +}; + +static_assert(SpuriouslyWarns2<LSHIFT>::v == 0, "Impossible occurred"); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C new file mode 100644 index 000000000..3d859a852 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C @@ -0,0 +1,7 @@ +// PR c++/63415 +// { dg-do compile { target c++11 } } + +template <typename T> +struct A { + static constexpr int value = int(T{}); +}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C new file mode 100644 index 000000000..af97be7c3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C @@ -0,0 +1,31 @@ +// PR c++/64352 +// { dg-do compile { target c++11 } } + +template<bool B> struct bool_type +{ static constexpr bool value = B; }; + +using true_type = bool_type<true>; +using false_type = bool_type<false>; + +template<typename T> T&& declval(); + +template<typename...> struct void_ { using type = void; }; +template<typename... I> using void_t = typename void_<I...>::type; + +template<typename _Tp, typename = void> +struct _Has_addressof_free: false_type { }; + +template<typename _Tp> +struct _Has_addressof_free +<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>> +: true_type { }; + +struct foo {}; +void operator&(foo) = delete; + +int main() +{ + static_assert( !_Has_addressof_free<int>::value, "" ); + // error: use of deleted function 'void operator&(foo)' + static_assert( !_Has_addressof_free<foo>::value, "" ); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C new file mode 100644 index 000000000..e221664e3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C @@ -0,0 +1,4 @@ +// PR c++/64029 +// { dg-do compile { target c++11 } } + +const int (&in)[]{1,2,3,4,5}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C new file mode 100644 index 000000000..b73ef753e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C @@ -0,0 +1,11 @@ +// PR c++/62219 +// { dg-do compile { target c++11 } } + +template< class = void > +struct S +{ + friend void foo( S ) + { + [](){}; + } +}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C new file mode 100644 index 000000000..1d7650bb6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C @@ -0,0 +1,12 @@ +// PR c++/64297 +// { dg-do compile { target c++11 } } + +struct A { + typedef int X; + template <int> X m_fn1() const; +}; +template <typename> struct is_function {}; +is_function<int() const &> i; +struct D { + template <typename Y, typename = is_function<Y>> D(Y); +} b(&A::m_fn1<0>); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C new file mode 100644 index 000000000..ac6eaf6a3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C @@ -0,0 +1,51 @@ +// PR c++/63139 +// { dg-do compile { target c++11 } } + +template<typename ...T> +struct type_list {}; + +template<typename ...T> +struct make_type_list +{ + using type = type_list<T...>; +}; + +// The bug disappears if you use make_type_list directly. +template<typename ...T> +using make_type_list_t = typename make_type_list<T...>::type; + + +struct ContainerEndA {}; + +template<typename ...Ts> +struct ContainerA +{ + using type = make_type_list_t<Ts..., ContainerEndA>; +}; + + +struct ContainerEndB {}; + +template<typename ...Ts> +struct ContainerB +{ + using type = make_type_list_t<Ts..., ContainerEndB>; +}; + +template<typename T, typename U> +struct is_same +{ + static const bool value = false; +}; + +template<typename T> +struct is_same<T, T> +{ + static const bool value = true; +}; + +#define SA(X) static_assert((X), #X) + +SA((is_same<ContainerB<>::type, type_list<ContainerEndB>>::value)); +SA((!is_same<ContainerA<>::type, type_list<ContainerEndB>>::value)); +SA((!is_same<ContainerA<>::type, ContainerB<>::type>::value)); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C new file mode 100644 index 000000000..9e5386deb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C @@ -0,0 +1,14 @@ +// PR c++/63405 +// { dg-do compile { target c++11 } } + +template <typename _Tp> _Tp forward(_Tp); +template <typename Args> struct Format { Format(int, Args); }; +template <typename... Args> auto format(Args &&... args) -> Format<Args...> { + return {0, args...}; +} + +template <typename... Args> void msg(Args... args) { + format(forward(args)...); +} + +void some_function() { msg('x'); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C new file mode 100644 index 000000000..8719577c5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11-neg.C @@ -0,0 +1,40 @@ +// { dg-do compile { target c++11_only } } +// { dg-options "-pedantic-errors" } + +// These *are* defined in C++14 onwards. + +#ifndef __cpp_binary_literals +# error "__cpp_binary_literals" // { dg-error "error" } +#endif + +#ifndef __cpp_init_captures +# error "__cpp_init_captures" // { dg-error "error" } +#endif + +#ifndef __cpp_generic_lambdas +# error "__cpp_generic_lambdas" // { dg-error "error" } +#endif + +#ifndef __cpp_decltype_auto +# error "__cpp_decltype_auto" // { dg-error "error" } +#endif + +#ifndef __cpp_return_type_deduction +# error "__cpp_return_type_deduction" // { dg-error "error" } +#endif + +#ifndef __cpp_variable_templates +# error "__cpp_variable_templates" // { dg-error "error" } +#endif + +#ifndef __cpp_digit_separators +# error "__cpp_digit_separators" // { dg-error "error" } +#endif + +#ifndef __cpp_attribute_deprecated +# error "__cpp_attribute_deprecated" // { dg-error "error" } +#endif + +#ifndef __cpp_runtime_arrays +# error "__cpp_runtime_arrays" // { dg-error "error" } +#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C new file mode 100644 index 000000000..606a5cec6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx11.C @@ -0,0 +1,81 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +#ifndef __cpp_unicode_characters +# error "__cpp_unicode_characters" +#elif __cpp_unicode_characters != 200704 +# error "__cpp_unicode_characters != 200704" +#endif + +#ifndef __cpp_raw_strings +# error "__cpp_raw_strings" +#elif __cpp_raw_strings != 200710 +# error "__cpp_raw_strings != 200710" +#endif + +#ifndef __cpp_unicode_literals +# error "__cpp_unicode_literals" +#elif __cpp_unicode_literals != 200710 +# error "__cpp_unicode_literals != 200710" +#endif + +#ifndef __cpp_user_defined_literals +# error "__cpp_user_defined_literals" +#elif __cpp_user_defined_literals != 200809 +# error "__cpp_user_defined_literals != 200809" +#endif + +#ifndef __cpp_lambdas +# error "__cpp_lambdas" +#elif __cpp_lambdas != 200907 +# error "__cpp_lambdas != 200907" +#endif + +#ifndef __cpp_constexpr +# error "__cpp_constexpr" +#elif __cpp_constexpr != 200704 +# error "__cpp_constexpr != 200704" +#endif + +#ifndef __cpp_static_assert +# error "__cpp_static_assert" +#elif __cpp_static_assert != 200410 +# error "__cpp_static_assert != 200410" +#endif + +#ifndef __cpp_decltype +# error "__cpp_decltype" +#elif __cpp_decltype != 200707 +# error "__cpp_decltype != 200707" +#endif + +#ifndef __cpp_attributes +# error "__cpp_attributes" +#elif __cpp_attributes != 200809 +# error "__cpp_attributes != 200809" +#endif + +#ifndef __cpp_rvalue_reference +# error "__cpp_rvalue_reference" +#elif __cpp_rvalue_reference != 200610 +# error "__cpp_rvalue_reference != 200610" +#endif + +#ifndef __cpp_variadic_templates +# error "__cpp_variadic_templates" +#elif __cpp_variadic_templates != 200704 +# error "__cpp_variadic_templates != 200704" +#endif + +#ifndef __cpp_alias_templates +# error "__cpp_alias_templates" +#elif __cpp_alias_templates != 200704 +# error "__cpp_alias_templates != 200704" +#endif + +// These C++14 features are allowed in C++11 in non-ANSI modes. +#ifndef __cpp_binary_literals +# error "__cpp_binary_literals" +#elif __cpp_binary_literals != 201304 +# error "__cpp_binary_literals != 201304" +#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C new file mode 100644 index 000000000..8a05f6660 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx14.C @@ -0,0 +1,231 @@ +// { dg-do compile { target c++1y } } +// { dg-options "-I${srcdir}/g++.dg/cpp1y -I${srcdir}/g++.dg/cpp1y/testinc" } + +// Begin C++11 tests. + +#ifndef __cpp_unicode_characters +# error "__cpp_unicode_characters" +#elif __cpp_unicode_characters != 200704 +# error "__cpp_unicode_characters != 200704" +#endif + +#ifndef __cpp_raw_strings +# error "__cpp_raw_strings" +#elif __cpp_raw_strings != 200710 +# error "__cpp_raw_strings != 200710" +#endif + +#ifndef __cpp_unicode_literals +# error "__cpp_unicode_literals" +#elif __cpp_unicode_literals != 200710 +# error "__cpp_unicode_literals != 200710" +#endif + +#ifndef __cpp_user_defined_literals +# error "__cpp_user_defined_literals" +#elif __cpp_user_defined_literals != 200809 +# error "__cpp_user_defined_literals != 200809" +#endif + +#ifndef __cpp_lambdas +# error "__cpp_lambdas" +#elif __cpp_lambdas != 200907 +# error "__cpp_lambdas != 200907" +#endif + +#ifndef __cpp_constexpr +# error "__cpp_constexpr" +#elif __cpp_constexpr != 200704 +# error "__cpp_constexpr != 200704" +#endif + +#ifndef __cpp_static_assert +# error "__cpp_static_assert" +#elif __cpp_static_assert != 200410 +# error "__cpp_static_assert != 200410" +#endif + +#ifndef __cpp_decltype +# error "__cpp_decltype" +#elif __cpp_decltype != 200707 +# error "__cpp_decltype != 200707" +#endif + +#ifndef __cpp_attributes +# error "__cpp_attributes" +#elif __cpp_attributes != 200809 +# error "__cpp_attributes != 200809" +#endif + +#ifndef __cpp_rvalue_reference +# error "__cpp_rvalue_reference" +#elif __cpp_rvalue_reference != 200610 +# error "__cpp_rvalue_reference != 200610" +#endif + +#ifndef __cpp_variadic_templates +# error "__cpp_variadic_templates" +#elif __cpp_variadic_templates != 200704 +# error "__cpp_variadic_templates != 200704" +#endif + +#ifndef __cpp_alias_templates +# error "__cpp_alias_templates" +#elif __cpp_alias_templates != 200704 +# error "__cpp_alias_templates != 200704" +#endif + +// Begin C++14 tests. + +#ifndef __cpp_binary_literals +# error "__cpp_binary_literals" +#elif __cpp_binary_literals != 201304 +# error "__cpp_binary_literals != 201304" +#endif + +#ifndef __cpp_init_captures +# error "__cpp_init_captures" +#elif __cpp_init_captures != 201304 +# error "__cpp_init_captures != 201304" +#endif + +#ifndef __cpp_generic_lambdas +# error "__cpp_generic_lambdas" +#elif __cpp_generic_lambdas != 201304 +# error "__cpp_generic_lambdas != 201304" +#endif + +// TODO: Change 200704 to 201304 when C++14 constexpr goes in. +#ifndef __cpp_constexpr +# error "__cpp_constexpr" +#elif __cpp_constexpr != 200704 +# error "__cpp_constexpr != 200704" +#endif + +#ifndef __cpp_decltype_auto +# error "__cpp_decltype_auto" +#elif __cpp_decltype_auto != 201304 +# error "__cpp_decltype_auto != 201304" +#endif + +#ifndef __cpp_return_type_deduction +# error "__cpp_return_type_deduction" +#elif __cpp_return_type_deduction != 201304 +# error "__cpp_return_type_deduction != 201304" +#endif + +#ifndef __cpp_runtime_arrays +# error "__cpp_runtime_arrays" +#elif __cpp_runtime_arrays != 201304 +# error "__cpp_runtime_arrays != 201304" +#endif + +// Aggregate initializers not in yet. +#ifdef __cpp_aggregate_nsdmi +# error "__cpp_aggregate_nsdmi" +#endif + +// Variable templates not in yet. +#ifdef __cpp_variable_templates +# error "__cpp_variable_templates" +#endif + +#ifndef __cpp_digit_separators +# error "__cpp_digit_separators" +#elif __cpp_digit_separators != 201309 +# error "__cpp_digit_separators != 201309" +#endif + +#ifndef __cpp_attribute_deprecated +# error "__cpp_attribute_deprecated" +#elif __cpp_attribute_deprecated != 201309 +# error "__cpp_attribute_deprecated != 201309" +#endif + +// Sized deallocation not in yet. +#ifdef __cpp_sized_deallocation +# error "__cpp_sized_deallocation" +#endif + +// Begin include checks. + +// Check for __has_include macro. +#ifndef __has_include +# error "__has_include" +#endif + +// Quoted complex.h should find at least the bracket version (use operator). +#if __has_include__ "complex.h" +#else +# error "complex.h" +#endif + +// Try known bracket header (use operator). +#if __has_include__(<complex>) +#else +# error "<complex>" +#endif + +// Define and use a macro to invoke the operator. +#define sluggo(TXT) __has_include__(TXT) + +#if sluggo(<complex>) +#else +# error "<complex>" +#endif + +#if ! sluggo(<complex>) +# error "<complex>" +#else +#endif + +// Quoted complex.h should find at least the bracket version. +#if __has_include("complex.h") +#else +# error "complex.h" +#endif + +// Try known local quote header. +#if __has_include("complex_literals.h") +#else +# error "\"complex_literals.h\"" +#endif + +// Try nonexistent bracket header. +#if __has_include(<stuff>) +# error "<stuff>" +#else +#endif + +// Try nonexistent quote header. +#if __has_include("phlegm") +# error "\"phlegm\"" +#else +#endif + +// Test __has_include_next. +#if __has_include("phoobhar.h") +# include "phoobhar.h" +#else +# error "__has_include(\"phoobhar.h\")" +#endif + +// Try a macro. +#define COMPLEX_INC "complex.h" +#if __has_include(COMPLEX_INC) +#else +# error COMPLEX_INC +#endif + +// Realistic use of __has_include. +#if __has_include(<array>) +# define STD_ARRAY 1 +# include <array> + template<typename _Tp, size_t _Num> + using array = std::array<_Tp, _Num>; +#elif __has_include(<tr1/array>) +# define TR1_ARRAY 1 +# include <tr1/array> + template<typename _Tp, size_t _Num> + typedef std::tr1::array<_Tp, _Num> array; +#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C new file mode 100644 index 000000000..b99b57efe --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98-neg.C @@ -0,0 +1,99 @@ +// { dg-do compile { target c++98_only } } +// { dg-options "-ansi" } + +#ifndef __cpp_runtime_arrays +# error "__cpp_runtime_arrays" // { dg-error "error" } +#endif + +#ifndef __cpp_unicode_characters +# error "__cpp_unicode_characters" // { dg-error "error" } +#endif + +#ifndef __cpp_raw_strings +# error "__cpp_raw_strings" // { dg-error "error" } +#endif + +#ifndef __cpp_unicode_literals +# error "__cpp_unicode_literals" // { dg-error "error" } +#endif + +#ifndef __cpp_user_defined_literals +# error "__cpp_user_defined_literals" // { dg-error "error" } +#endif + +#ifndef __cpp_lambdas +# error "__cpp_lambdas" // { dg-error "error" } +#endif + +#ifndef __cpp_constexpr +# error "__cpp_constexpr" // { dg-error "error" } +#endif + +#ifndef __cpp_static_assert +# error "__cpp_static_assert" // { dg-error "error" } +#endif + +#ifndef __cpp_decltype +# error "__cpp_decltype" // { dg-error "error" } +#endif + +#ifndef __cpp_attributes +# error "__cpp_attributes" // { dg-error "error" } +#endif + +#ifndef __cpp_rvalue_reference +# error "__cpp_rvalue_reference" // { dg-error "error" } +#endif + +#ifndef __cpp_variadic_templates +# error "__cpp_variadic_templates" // { dg-error "error" } +#endif + +#ifndef __cpp_alias_templates +# error "__cpp_alias_templates" // { dg-error "error" } +#endif + +// C++14 + +// C++98 gets binary literals. +//#ifndef __cpp_binary_literals +//# error "__cpp_binary_literals" +//#endif + +#ifndef __cpp_init_captures +# error "__cpp_init_captures" // { dg-error "error" } +#endif + +#ifndef __cpp_generic_lambdas +# error "__cpp_generic_lambdas" // { dg-error "error" } +#endif + +#ifndef __cpp_decltype_auto +# error "__cpp_decltype_auto" // { dg-error "error" } +#endif + +#ifndef __cpp_return_type_deduction +# error "__cpp_return_type_deduction" // { dg-error "error" } +#endif + +// Aggregate initializers not in yet. +//#ifdef __cpp_aggregate_nsdmi +//# error "__cpp_aggregate_nsdmi" +//#endif + +#ifndef __cpp_variable_templates +# error "__cpp_variable_templates" // { dg-error "error" } +#endif + +#ifndef __cpp_digit_separators +# error "__cpp_digit_separators" // { dg-error "error" } +#endif + +#ifndef __cpp_attribute_deprecated +# error "__cpp_attribute_deprecated" // { dg-error "error" } +#endif + +// Sized deallocation not in yet. +//#ifdef __cpp_sized_deallocation +//# error "__cpp_sized_deallocation" +//#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C new file mode 100644 index 000000000..a0a2b75e3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/feat-cxx98.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++98_only } } +// { dg-options "" } + +// These C++14 features are allowed in C++98 in non-ANSI modes. +#ifndef __cpp_binary_literals +# error "__cpp_binary_literals" +#elif __cpp_binary_literals != 201304 +# error "__cpp_binary_literals != 201304" +#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/paren1.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/paren1.C new file mode 100644 index 000000000..809f25100 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/paren1.C @@ -0,0 +1,31 @@ +// PR c++/63437 +// { dg-do compile { target c++11 } } + +struct X // movable but not copyable +{ + X() = default; + X(X &&) = default; + + X(const X &) = delete; +}; + +X non_parenthesized() +{ + X x; + return x; // works +} + +X parenthesized() +{ + X x; + return (x); // error: use of deleted function 'X::X(const X&)' +} + +template <class T> +T parenthesized_t() +{ + T t; + return (t); +} + +template X parenthesized_t<X>(); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/phoobhar.h b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/phoobhar.h new file mode 100644 index 000000000..7feec3649 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/phoobhar.h @@ -0,0 +1,16 @@ + +int +phoo(); + +int +bhar(); + +#ifndef __has_include_next +# error "__has_include_next" +#else +# if __has_include_next("phoobhar.h") +# include_next "phoobhar.h" +# else +# error "__has_include_next(\"phoobhar.h\")" +# endif +#endif diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/pr57644.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/pr57644.C new file mode 100644 index 000000000..080572168 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/pr57644.C @@ -0,0 +1,13 @@ +// { dg-do compile { target c++1y } } + +struct Foo +{ + unsigned i: 32; +}; + +int +main() +{ + Foo f{}; + return f.i; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ext/altivec-2.C b/gcc-4.9/gcc/testsuite/g++.dg/ext/altivec-2.C index eb8a92942..e14e6f800 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ext/altivec-2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ext/altivec-2.C @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable" } */ +/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable -Wno-deprecated" } */ /* This test checks if AltiVec builtins accept const-qualified arguments. */ diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ext/stmtexpr16.C b/gcc-4.9/gcc/testsuite/g++.dg/ext/stmtexpr16.C new file mode 100644 index 000000000..ddce40c05 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ext/stmtexpr16.C @@ -0,0 +1,10 @@ +// PR c++/63455 +// { dg-options "-std=gnu++11" } + +int main() +{ + int x = 0; + + // without '+0', gcc 4.6 gives a different error (no ICE though) + decltype(({ int y = x; y; })+0) v1 = 0; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/gomp/pr63249.C b/gcc-4.9/gcc/testsuite/g++.dg/gomp/pr63249.C new file mode 100644 index 000000000..80f763a4c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/gomp/pr63249.C @@ -0,0 +1,35 @@ +// PR c++/63249 +// { dg-do compile } +// { dg-options "-Wall -W -fopenmp" } + +template <int N> +int +foo (int *v, int A, int B) // { dg-bogus "set but not used" } +{ + int r = 0; + int a = 2; // { dg-bogus "set but not used" } + int b = 4; // { dg-bogus "set but not used" } +#pragma omp target map(to: v[a:b]) + r |= v[3]; +#pragma omp target map(to: v[A:B]) + r |= v[3]; + return r; +} + +template <typename T> +int +bar (T *v, T A, T B) // { dg-bogus "set but not used" } +{ + T r = 0, a = 2, b = 4; // { dg-bogus "set but not used" } +#pragma omp target map(to: v[a:b]) + r |= v[3]; +#pragma omp target map(to: v[A:B]) + r |= v[3]; + return r; +} + +int +baz (int *v, int A, int B) +{ + return foo<0> (v, A, B) + bar (v, A, B); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/init/const9.C b/gcc-4.9/gcc/testsuite/g++.dg/init/const9.C index ba1dfd4bc..d733e9533 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/init/const9.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/init/const9.C @@ -1,5 +1,5 @@ // PR c++/55893 -// { dg-final { scan-assembler-not "rodata" } } +// { dg-final { scan-assembler-not "rodata" { target { ! hppa*-*-* } } } } struct foo { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-1.C index de0f665c4..710a99c6f 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-1.C @@ -1,6 +1,6 @@ /* Verify that simple virtual calls are converted to direct calls by ipa-cp. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-10.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-10.C index 658442e34..b58e1e036 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-10.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-10.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-ipa-inline -fdump-ipa-cp -fno-early-inlining" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fdump-ipa-cp -fno-early-inlining -fdevirtualize" } */ class wxPaintEvent { }; struct wxDCBase { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-11.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-11.C index e31832b87..dae47f700 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-11.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-11.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-inline --param=early-inlining-insns-comdat=0 -fno-devirtualize-speculatively" } */ +/* { dg-options "-O2 -fdump-ipa-inline --param=early-inlining-insns-comdat=0 -fno-devirtualize-speculatively -fdevirtualize" } */ int baz (); struct A { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-12.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-12.C index 16bae4d8d..4d713714c 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-12.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-12.C @@ -1,5 +1,5 @@ // { dg-do compile { target c++11 } } -// { dg-options "-O -fdump-ipa-inline" } +// { dg-options "-O -fdump-ipa-inline -fdevirtualize" } class Foo { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-13.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-13.C index b338a4c34..4b2ff069b 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-13.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-13.C @@ -1,6 +1,6 @@ /* { dg-do run } */ /* Call to foo should be devirtualized because there are no derived types of A. */ -/* { dg-options "-O2 -fdump-tree-ssa" } */ +/* { dg-options "-O2 -fdump-tree-ssa -fdevirtualize" } */ namespace { class A { public: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-14.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-14.C index 456d44f84..517173065 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-14.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-14.C @@ -2,7 +2,7 @@ because the constructor of A is unreachable and therefore the virtual method table referring to A::foo is optimized out. */ /* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-ssa" } */ +/* { dg-options "-O2 -fdump-tree-ssa -fdevirtualize" } */ class B { public: virtual int foo(void) diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-15.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-15.C index 2ea85f487..2c041b5a2 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-15.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-15.C @@ -1,7 +1,7 @@ /* Check that we speculatively devirutalize call to FOO to B::foo becuase A is noreturn. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-devirt -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-ipa-devirt -fdump-tree-optimized -fdevirtualize" } */ class A { public: virtual int foo(void) diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-16.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-16.C index 85567867f..d0ac06134 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-16.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-16.C @@ -1,7 +1,7 @@ /* We shall devirtualize to unreachable. No anonymous type method should surivve reachability. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-whole-program" } */ +/* { dg-options "-O2 -fdump-ipa-whole-program -fdevirtualize" } */ namespace { class B { public: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-17.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-17.C index 9edfd73af..56e4294ab 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-17.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-17.C @@ -1,7 +1,7 @@ /* We shall devirtualize to B::foo since it is the only live candidate of an anonymous type. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-whole-program" } */ +/* { dg-options "-O2 -fdump-ipa-whole-program -fdevirtualize" } */ namespace { class B { public: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-18.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-18.C index dbbe597c9..6729d7c42 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-18.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-18.C @@ -1,7 +1,7 @@ /* We shall devirtualize to unreachable. No anonymous type method should surivve reachability. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-ssa" } */ +/* { dg-options "-O2 -fdump-tree-ssa -fdevirtualize" } */ namespace { class B { public: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-19.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-19.C index 13686e3e0..8fb82a288 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-19.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-19.C @@ -2,7 +2,7 @@ Previously we were failing by considering CLOBBER statement to be a type change. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-cp" } */ +/* { dg-options "-O2 -fdump-ipa-cp -fdevirtualize" } */ struct A { void operator==(const A &); }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-2.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-2.C index d3181e4c0..95eba9c60 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-2.C @@ -1,7 +1,7 @@ /* Verify that simple virtual calls using this pointer are converted to direct calls by ipa-cp. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-20.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-20.C index 0ea245baf..85e064b99 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-20.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-20.C @@ -1,6 +1,6 @@ #include <stdlib.h> /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-release_ssa" } */ +/* { dg-options "-O2 -fdump-tree-release_ssa -fdevirtualize" } */ namespace { struct A { int a; virtual int foo() {return a;} void bar() {a=7;} }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-21.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-21.C index 675bd08d7..7791cb94f 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-21.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-21.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fdump-ipa-cp -fdevirtualize" } */ /* Main purpose is to verify that we do not produce wrong devirtualization to C::m_fn1. We currently devirtualize to B::m_fn1, so check that. */ #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-22.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-22.C index 37e766945..194d60004 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-22.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-22.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-ipa-sra -fdump-ipa-cp -fdevirtualize" } */ class A {}; class B { public: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-23.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-23.C index 98d86aee8..52e3c9cef 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-23.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-23.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O3 -fno-partial-inlining -fdump-ipa-cp -fno-devirtualize-speculatively" } */ +/* { dg-options "-O3 -fno-partial-inlining -fdump-ipa-cp -fno-devirtualize-speculatively -fdevirtualize" } */ /* Main purpose is to verify that we do not produce wrong devirtualization to C::m_fn1. We currently devirtualize to B::m_fn1, so check that. */ #include <stdlib.h> diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-24.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-24.C index 01bfdc2ec..4bba9b0c9 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-24.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-24.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-inline -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fno-ipa-sra -fdump-ipa-inline -fdump-ipa-cp --param=early-inlining-insns-comdat=0 -fdevirtualize" } */ void pad(void); class A {}; class B { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-25.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-25.C index 1da44f5d1..fed7a96ef 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-25.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-25.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-cp -fdevirtualize" } */ class ert_RefCounter { protected: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-26.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-26.C index 2df429c34..f8b33e288 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-26.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-26.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-ipa-devirt" } */ +/* { dg-options "-O3 -fdump-ipa-devirt -fdevirtualize" } */ struct A { int a; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-27.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-27.C index 749f40af1..eb064990b 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-27.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-27.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fdump-tree-optimized -fdevirtualize" } */ struct A { int a; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28.C index e18b81897..9bfef924d 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28.C @@ -1,5 +1,5 @@ // PR c++/58678 -// { dg-options "-O3 -fdump-ipa-devirt" } +// { dg-options "-O3 -fdump-ipa-devirt -fdevirtualize" } struct A { virtual ~A(); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28a.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28a.C new file mode 100644 index 000000000..65d5fcdf3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-28a.C @@ -0,0 +1,15 @@ +// PR c++/58678 +// { dg-options "-O3 -flto -shared -fPIC -Wl,--no-undefined" } +// { dg-do link { target { { gld && fpic } && shared } } } + +struct A { + virtual ~A(); +}; +struct B : A { + virtual int m_fn1(); +}; +void fn1(B* b) { + delete b; +} + +int main() {} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-29.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-29.C index b4f24a104..ebfd01b60 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-29.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-29.C @@ -1,7 +1,7 @@ /* { dg-do run { target c++11 } } */ /* There is a devirtualizable call. In PR60306 we deduced wrong target to cxa_pure_virtual. For gcc 4.10 we temporarily disable the devirtualization. */ -/* { dg-options "-O3" } */ +/* { dg-options "-O3 -fdevirtualize" } */ #include <vector> diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-3.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-3.C index a68eb024f..45ad33756 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-3.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-3.C @@ -1,7 +1,7 @@ /* Verify that simple virtual calls on an object refrence are converted to simple calls by ipa-cp. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-30.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-30.C index c4ac6940a..b147476f7 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-30.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-30.C @@ -1,5 +1,5 @@ // PR c++/58678 -// { dg-options "-O3 -fdump-ipa-devirt" } +// { dg-options "-O3 -fdump-ipa-devirt -fdevirtualize" } // We shouldn't speculatively devirtualize to ~B because B is an abstract // class; any actual object passed to f will be of some derived class which diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-31.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-31.C index 64c44ba1e..16c782025 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-31.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-31.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -std=c++11 -fdump-ipa-inline" } */ +/* { dg-options "-O2 -std=c++11 -fdump-ipa-inline -fdevirtualize" } */ #include <new> class EmbeddedObject { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-39.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-39.C index fbeea126e..38e280899 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-39.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-39.C @@ -1,5 +1,5 @@ // PR c++/61214 -/* { dg-options "-O2 -fdump-tree-optimized" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdevirtualize" } */ struct Base { @@ -24,5 +24,4 @@ int main() return 0; } -/* { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" } } */ -/* { dg-final { cleanup-tree-dump "optimized" } } */ +/* { dg-final { scan-assembler-not "_ZN3Foo5cloneEv" } } */ diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-4.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-4.C index 72c883b3f..64f8eb05d 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-4.C @@ -1,7 +1,7 @@ /* Verify that ipa-co can convert virtual calls to direct ones even when a typecast to an ancestor is involved along the way. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-40.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-40.C new file mode 100644 index 000000000..9c3bdf5e9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-40.C @@ -0,0 +1,21 @@ +// PR c++/62224 +// { dg-options "-O2" } +// For 4.9, we don't want to devirtualize f and thus create a reference to g. + +struct A +{ + virtual void f () = 0; +}; + +class B : A +{ + virtual void f () { g(); } + void g(); +}; + +void h (A *a) +{ + a->f (); +} + +// { dg-final { scan-assembler-not "_ZN1B1gEv" } } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-5.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-5.C index 575bc0271..980b59617 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-5.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-5.C @@ -2,7 +2,7 @@ ones even when a typecast to an ancestor is involved along the way and that ancestor is not the first one with virtual functions. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-6.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-6.C index e9a5d7093..4599878d1 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-6.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-6.C @@ -2,7 +2,7 @@ spot that foo changes the dynamic type of the passed object. */ /* { dg-do run } */ -/* { dg-options "-O3" } */ +/* { dg-options "-O3 -fdevirtualize" } */ extern "C" void abort (void); extern "C" void *malloc(__SIZE_TYPE__); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-7.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-7.C index 1c5912230..d2059baf6 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-7.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-7.C @@ -1,7 +1,7 @@ /* Verify that IPA-CP can do devirtualization even if the virtual call comes from a method that has been early-inlined into a descendant. */ /* { dg-do run } */ -/* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-9.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-9.C index dc6c6c940..ce4febd9f 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-9.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-9.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-whole-program --param=early-inlining-insns-comdat=0" } */ +/* { dg-options "-O2 -fdump-ipa-whole-program --param=early-inlining-insns-comdat=0 -fdevirtualize" } */ double foo (); struct B { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-1.C index dcd804659..5e1348baa 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-1.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-2.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-2.C index b9a36e29f..451b2293e 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-2.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-3.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-3.C index c8791f79e..321eea478 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-3.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-3.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-inline" } */ +/* { dg-options "-O3 -fno-inline -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-4.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-4.C index 56d41e496..24dfe3dab 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-4.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-inline" } */ +/* { dg-options "-O3 -fno-inline -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-5.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-5.C index 637d7d4be..f3d6b0014 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-5.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-5.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-6.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-6.C index f9b8b6954..8e5a2bf47 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-6.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-6.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-inline" } */ +/* { dg-options "-O3 -fno-inline -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-7.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-7.C index 2e76cbe40..08f2d3043 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-7.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-7.C @@ -2,7 +2,7 @@ object within another one when looking for dynamic type change . */ /* { dg-do run } */ /* { dg-require-effective-target nonpic } */ -/* { dg-options "-O3 -Wno-attributes" } */ +/* { dg-options "-O3 -Wno-attributes -fdevirtualize" } */ extern "C" void abort (void); namespace std { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-8.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-8.C index 309644d92..2e417ec2c 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-8.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-c-8.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under construction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-d-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-d-1.C index 3897a7782..d84dd9fe0 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-d-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-d-1.C @@ -1,7 +1,7 @@ /* Verify that ipa-cp correctly detects the dynamic type of an object under destruction when doing devirtualization. */ /* { dg-do run } */ -/* { dg-options "-O3 -fno-early-inlining -fno-inline" } */ +/* { dg-options "-O3 -fno-early-inlining -fno-inline -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-g-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-g-1.C index 175f24efb..41f23453c 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-g-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/devirt-g-1.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-O2 -fdump-ipa-cp -fdump-tree-optimized" } +// { dg-options "-O2 -fdump-ipa-cp -fdump-tree-optimized -fdevirtualize" } struct S { S(); virtual void xyzzy(); void otherstuff(); }; struct R { int a; S s; R(); }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C index 32f7258a4..f530adad2 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-1.C @@ -1,7 +1,7 @@ /* Verify that virtual calls are folded even early inlining puts them into one function with the definition. */ /* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-fre1-details" } */ +/* { dg-options "-O2 -fdump-tree-fre1-details -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-2.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-2.C index 5bddc2fcb..bce0e96ed 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/imm-devirt-2.C @@ -1,7 +1,7 @@ /* Verify that virtual calls are folded even early inlining puts them into one function with the definition. */ /* { dg-do run } */ -/* { dg-options "-O2 -fdump-tree-fre1-details" } */ +/* { dg-options "-O2 -fdump-tree-fre1-details -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-1.C index bc4dfea5c..39dbf59f0 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-1.C @@ -1,7 +1,7 @@ /* Verify that simple virtual calls are inlined even without early inlining. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-2.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-2.C index 001cff204..0607ffbbe 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-2.C @@ -1,7 +1,7 @@ /* Verify that simple virtual calls using this pointer are inlined even without early inlining.. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-3.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-3.C index 637a6aecc..5b6322ed1 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-3.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-3.C @@ -1,7 +1,7 @@ /* Verify that simple virtual calls on an object refrence are inlined even without early inlining. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-4.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-4.C index f5b8f8e5d..5358ebfde 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-4.C @@ -2,7 +2,7 @@ inlining, even when a typecast to an ancestor is involved along the way. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-5.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-5.C index d78173d69..33c1d7bf5 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-5.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-5.C @@ -1,7 +1,7 @@ /* Verify that virtual call inlining does not pick a wrong method when there is a user defined ancestor in an object. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-7.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-7.C index 9d725a508..e6ba8505d 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-7.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-7.C @@ -2,7 +2,7 @@ inlining, even when a typecast to an ancestor is involved along the way and that ancestor is not the first one with virtual functions. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-8.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-8.C index eebfc6af1..606049aad 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-8.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-8.C @@ -1,7 +1,7 @@ /* Verify that virtual calls are inlined (ithout early inlining) even when their caller is itself indirectly inlined. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-9.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-9.C index 586c3af30..dec234e06 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-9.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/ivinline-9.C @@ -3,7 +3,7 @@ way and that ancestor itself has an ancestor wich is not the primary base class. */ /* { dg-do run { target nonpic } } */ -/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-inline -fno-early-inlining -fno-ipa-cp -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60600.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60600.C index b9039cb85..4d0db6be4 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60600.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60600.C @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O3 -fdump-ipa-cp" } */ +/* { dg-options "-O3 -fdump-ipa-cp -fdevirtualize" } */ struct data { data(int); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60640-4.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60640-4.C index eb9eb627f..d290450cd 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60640-4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr60640-4.C @@ -1,5 +1,5 @@ // { dg-do run } -// { dg-options "-O3 -fdump-ipa-cp" } +// { dg-options "-O3 -fdump-ipa-cp -fdevirtualize" } struct Distraction { diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr61654.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr61654.C new file mode 100644 index 000000000..d07e4586b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr61654.C @@ -0,0 +1,40 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +/* The bug only presented itself on a 32 bit i386 but in theory it might also + pop up elsewhere and we do not want to put -m32 options to testcase + options. */ + +struct A +{ + virtual int a (int, int = 0) = 0; + void b (); + void c (); + int d; +}; + +struct B : virtual A +{ + int a (int, int); + int e; +}; + +int f; + +void +A::b () +{ + a (0); +} + +void +A::c () +{ + a (f); +} + +int +B::a (int, int) +{ + return e; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr62015.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr62015.C new file mode 100644 index 000000000..950b46e75 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr62015.C @@ -0,0 +1,55 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -std=c++11" } */ + + +extern "C" int printf(const char *fmt, ...); +extern "C" void abort(void); + +struct Side { + enum _Value { Left, Right, Invalid }; + + constexpr Side() : _value(Invalid) {} + constexpr Side(_Value value) : _value(value) {} + operator _Value() const { return (_Value)_value; } + + private: + char _value; +}; + +struct A { + void init(); + void adjust(Side side, bool final); + void move(Side side); +}; + +void A::init() +{ + adjust(Side::Invalid, false); +} + +static void __attribute__((noinline)) +check (int v, int final) +{ + if (v != 0) + abort(); +} + + +__attribute__((noinline)) +void A::adjust(Side side, bool final) +{ + check ((int)side, final); +} + +void A::move(Side side) +{ + adjust(side, false); + adjust(side, true); +} + +int main() +{ + A t; + t.move(Side::Left); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63306.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63306.C new file mode 100644 index 000000000..e22a4c2a0 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63306.C @@ -0,0 +1,14 @@ +// PR c++/63306 +// { dg-do compile { target c++11 } } + +template <typename...> +class A; + +class B +{ + B (const int &, const A<int, int> &); +}; + +B::B (const int &, const A<int, int> &) +{ +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C new file mode 100644 index 000000000..d67364900 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr63838.C @@ -0,0 +1,56 @@ +// PR ipa/63838 +// { dg-do run } +// { dg-options "-O2 -fdump-ipa-pure-const" } +// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void foo" "pure-const" } } +// { dg-final { scan-ipa-dump-not "Function found to be nothrow: void bar" "pure-const" } } +// { dg-final { cleanup-ipa-dump "pure-const" } } + +__attribute__((noinline, noclone)) static void bar (int); +volatile int v; +void (*fn) (); +struct S { S () { v++; } ~S () { v++; } }; + +__attribute__((noinline, noclone)) static void +foo (int x) +{ + v++; + if (x == 5) + bar (x); +} + +__attribute__((noinline, noclone)) static void +bar (int x) +{ + v++; + if (x == 6) + foo (x); + else if (x == 5) + fn (); +} + +__attribute__((noinline, noclone)) int +baz (int x) +{ + S s; + foo (x); +} + +void +throw0 () +{ + throw 0; +} + +int +main () +{ + fn = throw0; + asm volatile ("" : : : "memory"); + try + { + baz (5); + } + catch (int) + { + } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr64068.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr64068.C new file mode 100644 index 000000000..95288836c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/pr64068.C @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +typedef int PROV_ENUMALGS_EX, PCCRYPT_OID_INFO; +class A { + int m_fn2(); + virtual bool m_fn1(PCCRYPT_OID_INFO); +}; +int fn1(); +void fn2(); +int A::m_fn2() { m_fn1(0); } + +bool fn3() { + for (;;) { + if (fn1()) { + if (fn1() != 259) + fn2(); + break; + } + return 1; + } + return 0; +} + +class B { +public: + B() { fn3(); } +}; +class C : A { + bool m_fn1(PCCRYPT_OID_INFO) { m_fn3(); } + int isSupportedByProvider_algId; + PROV_ENUMALGS_EX isSupportedByProvider_outEnumAlgs; + PROV_ENUMALGS_EX isSupportedByProvider_enumAlgs; + bool m_fn3() { + while (1) { + if (fn1()) { + if (fn1() != 259) + fn2(); + break; + } + if (isSupportedByProvider_algId) + isSupportedByProvider_outEnumAlgs = isSupportedByProvider_enumAlgs; + return 1; + } + return 0; + } +}; + +void fn4() { B(); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ipa/type-inheritance-1.C b/gcc-4.9/gcc/testsuite/g++.dg/ipa/type-inheritance-1.C index 818002ec1..a0c151122 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/ipa/type-inheritance-1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/ipa/type-inheritance-1.C @@ -1,7 +1,7 @@ /* Verify that callgraph construction keeps FOO for possible devirtualization and removes BAR. */ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-ipa-visibility" } */ +/* { dg-options "-O2 -fdump-ipa-visibility -fdevirtualize" } */ extern "C" void abort (void); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/lto/pr62026.C b/gcc-4.9/gcc/testsuite/g++.dg/lto/pr62026.C new file mode 100644 index 000000000..63766a85b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/lto/pr62026.C @@ -0,0 +1,22 @@ +// { dg-lto-do link } +// { dg-lto-options {{-flto -O3 -r -nostdlib}} } +class C; +class F { + virtual C m_fn1(); +}; +class C { + public: + virtual int *m_fn3(int); +}; +class G : F, C { + int offsets; + int *m_fn3(int); +}; +C *a; +int *G::m_fn3(int) { + if (offsets) return 0; +} + +void fn1() { + for (;;) a->m_fn3(0); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt1.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt1.C index f9b4dc2fc..2524dd138 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt1.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-O2" } +// { dg-options "-O2 -fdevirtualize" } // { dg-final { scan-assembler "xyzzy" } } struct S { S(); virtual void xyzzy(); }; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt2.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt2.C index cf4842bd4..ef8c1a123 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt2.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-O2" } +// { dg-options "-O2 -fdevirtualize" } /* Using -mshort-calls avoids loading the function addresses in registers and thus getting the counts wrong. */ // { dg-additional-options "-mshort-calls" {target epiphany-*-*} } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt3.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt3.C index 673867361..1f3331c5d 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt3.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt3.C @@ -1,5 +1,5 @@ // { dg-do compile } -// { dg-options "-O2" } +// { dg-options "-O2 -fdevirtualize" } class ert_RefCounter { protected: diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt4.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt4.C index 5a24eecbd..72f56afca 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt4.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt4.C @@ -1,8 +1,7 @@ // PR lto/53808 -// Devirtualization + inlining should produce a non-virtual -// call to ~foo. -// { dg-options "-O -fdevirtualize" } -// { dg-final { scan-assembler "_ZN3fooD2Ev" } } +// Devirtualization should not produce an external ref to ~bar. +// { dg-options "-O2" } +// { dg-final { scan-assembler-not "_ZN3barD0Ev" } } struct foo { virtual ~foo(); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt5.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt5.C new file mode 100644 index 000000000..f839cbeae --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/devirt5.C @@ -0,0 +1,19 @@ +// PR c++/61659 +// { dg-options "-O3" } +// { dg-final { scan-assembler-not "_ZN6parserIiE9getOptionEv" } } + +struct generic_parser_base { + virtual void getOption(); + void getExtraOptionNames() { getOption(); } +}; +template <class DataType> struct parser : public generic_parser_base { + virtual void getOption() {} +}; +struct PassNameParser : public parser<int> { + PassNameParser(); +}; +struct list { + PassNameParser Parser; + virtual void getExtraOptionNames() { return Parser.getExtraOptionNames(); } +}; +list PassList; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/opt/flifetime-dse1.C b/gcc-4.9/gcc/testsuite/g++.dg/opt/flifetime-dse1.C new file mode 100644 index 000000000..733d28a79 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/opt/flifetime-dse1.C @@ -0,0 +1,23 @@ +// { dg-options "-O3 -fno-lifetime-dse" } +// { dg-do run } + +typedef __SIZE_TYPE__ size_t; +inline void * operator new (size_t, void *p) { return p; } + +struct A +{ + int i; + A() {} + ~A() {} +}; + +int main() +{ + int ar[1]; + + A* ap = new(ar) A; + ap->i = 42; + ap->~A(); + + if (ar[0] != 42) __builtin_abort(); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/pr54442.C b/gcc-4.9/gcc/testsuite/g++.dg/pr54442.C new file mode 100644 index 000000000..a48956561 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/pr54442.C @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +struct S +{ + void s (int) const throw (); + void s (int) throw (); +}; + +typedef int index_t; + +void (S::*f) (index_t) = &S::s; +void (S::*g) (index_t) const = &S::s; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/pr62079.C b/gcc-4.9/gcc/testsuite/g++.dg/pr62079.C new file mode 100644 index 000000000..919c3e5de --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/pr62079.C @@ -0,0 +1,78 @@ +// { dg-do compile } +// { dg-options "-std=c++11 -O2 -fnon-call-exceptions" } + +template < typename > class allocator; + +template < class _CharT > struct char_traits; +template < typename _CharT, typename _Traits = char_traits < _CharT >, + typename _Alloc = allocator < _CharT > >class basic_string; +typedef basic_string < char >string; + +template < typename _Tp > class new_allocator +{ + template < typename _Tp1 > struct rebind + { + typedef new_allocator < _Tp1 > other; + }; +}; + +template < typename _Tp > using __allocator_base = new_allocator < _Tp >; +template < typename _Tp > class allocator:public __allocator_base < _Tp > +{ +}; + +template < typename _CharT, typename _Traits, typename _Alloc > + class basic_string +{ +public: + basic_string (const _CharT * __s, const _Alloc & __a = _Alloc ()); + ~basic_string ()noexcept; +}; + +template < typename T > struct add_reference +{ + typedef T & type; +}; + +template < typename ... Values > class tuple; +template <> class tuple <> +{ +}; + +template < typename Head, typename ... Tail > class tuple < Head, Tail ... >:private tuple < + Tail ... + > +{ + typedef tuple < Tail ... >inherited; +public: + template < typename ... VValues > + tuple (const tuple < VValues ... >&other):inherited (other.tail ()), + m_head (other.head ()) + { + } + typename add_reference < const Head >::type head () const + { + return m_head; + } + const inherited & tail () const + { + return *this; + } + Head m_head; +}; + +template < typename T > struct make_tuple_result +{ + typedef T type; +}; + +template < typename ... Values > + tuple < typename make_tuple_result < + Values >::type ... >make_tuple (const Values & ... values); + +int +main () +{ + tuple < int, float, string > t3c = + make_tuple (17, 2.718281828, string ("Fun")); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/pr64037.C b/gcc-4.9/gcc/testsuite/g++.dg/pr64037.C new file mode 100644 index 000000000..e5cd0e2ee --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/pr64037.C @@ -0,0 +1,27 @@ +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-options "-std=c++11 -Os" } + +enum class X : unsigned char { + V = 2, +}; + +static void +__attribute__((noinline,noclone)) +foo(unsigned &out, unsigned a, X b) +{ + out = static_cast<unsigned>(b); +} + +int main() +{ + unsigned deadbeef = 0xDEADBEEF; + asm volatile ("" : "+d" (deadbeef), "+c" (deadbeef)); + + unsigned out; + foo(out, 2, X::V); + + if (out != 2) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/friend56.C b/gcc-4.9/gcc/testsuite/g++.dg/template/friend56.C new file mode 100644 index 000000000..7dd5d486f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/friend56.C @@ -0,0 +1,13 @@ +// Make sure we don't mistakenly mark f as DECL_COMDAT. +// { dg-final { scan-assembler "_Z1fv" } } + +void f(); + +template <class T> struct A +{ + friend void f(); +}; + +A<int> a; + +void f() { } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent14.C b/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent14.C new file mode 100644 index 000000000..b257d9baf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/non-dependent14.C @@ -0,0 +1,7 @@ +// PR c++/64251 + +class DictionaryValue {}; +template <typename T> void CreateValue(T) { + DictionaryValue(0); + CreateValue(0); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/offsetof3.C b/gcc-4.9/gcc/testsuite/g++.dg/template/offsetof3.C new file mode 100644 index 000000000..b17374645 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/offsetof3.C @@ -0,0 +1,18 @@ +// PR c++/64487 + +struct foo { + int member; +}; + +template < int N> +struct bar {}; + +template <int N> +struct qux { + static bar<N+__builtin_offsetof(foo,member)> static_member; +}; + +template <int N> +bar<N+__builtin_offsetof(foo,member)> qux<N>::static_member; + +int main() { } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem29.C b/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem29.C new file mode 100644 index 000000000..7700c0b97 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/ptrmem29.C @@ -0,0 +1,10 @@ +// PR c++/62659 + +struct D { + typedef int (D::*cont_func)(); + template <cont_func> struct B; + template <cont_func cont_f> void wait(B<cont_f> ***); + + int done(); + template <bool> void fix() { wait<&D::done>(0); } +}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/ref9.C b/gcc-4.9/gcc/testsuite/g++.dg/template/ref9.C new file mode 100644 index 000000000..983f62788 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/ref9.C @@ -0,0 +1,15 @@ +// PR c++/63658 + +struct Descriptor {}; + +template <Descriptor & D> +struct foo +{ + void size (); +}; + +Descriptor g_descriptor = {}; + +template<> void foo<g_descriptor>::size() +{ +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/template/spec38.C b/gcc-4.9/gcc/testsuite/g++.dg/template/spec38.C new file mode 100644 index 000000000..6f06f1495 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/template/spec38.C @@ -0,0 +1,6 @@ +// PR ipa/61659 + +// { dg-final { scan-assembler "_Z1fIiEvPT_" } } + +template <typename T> inline void f (T *); +template <> void f (int *) { } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62121.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62121.C new file mode 100644 index 000000000..de1196a62 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62121.C @@ -0,0 +1,12 @@ +// { dg-do compile } +class A +{ + virtual double operator()(); +}; +class B : A +{ +public: + double operator()(); +}; +extern B a[]; +int b = a[0](); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62175.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62175.C new file mode 100644 index 000000000..bcdea61e1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr62175.C @@ -0,0 +1,36 @@ +// { dg-do compile } +// { dg-additional-options "-ftrapv" } + +struct B { + B(int = 0); +}; +int c; +int *d; +struct G { + G(); + int numProcs_; +}; +int fn1(); +B fn2() { + if (c) + return 0; + return B(); +} + +long &fn3(long &p1, long &p2) { + if (p2 < p1) + return p2; + return p1; +} + +void fn4(long p1) { + long a = fn1(); + fn2(); + int b = fn3(p1, a); + for (int i; i < b; ++i) + d[0] = 0; + for (; a < p1; ++a) + d[a] = 0; +} + +G::G() { fn4(numProcs_ + 1); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/torture/pr63632.C b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr63632.C new file mode 100644 index 000000000..48cd86924 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/torture/pr63632.C @@ -0,0 +1,5 @@ +// PR bootstrap/63632 +// { dg-do link } +// { dg-options "-fno-lto" } + +int main () {} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C index c58f3ca94..9c532c195 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/func_reorder_gold_plugin_1.C @@ -38,7 +38,7 @@ int main () /* { dg-final-use { scan-assembler "\.string \"Weight 1000 1000\"" } } */ /* { dg-final-use { scan-assembler "\.string \"Weight 1001 1001\"" } } */ /* Check if main is next to foo or bar */ -/* { dg-final-use { scan-file linker.dump "Callgraph group : *\(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } } */ +/* { dg-final-use { scan-file linker.dump "Callgraph group : *\.*(_Z3foov main|main _Z3foov|_Z3barv main|main _Z3barv\).*\n" } } */ /* { dg-final-use { scan-file linker.dump ".text\..*\._Z9notcalledv entry count = 0 computed = 0 max count = 0" } } */ /* { dg-final-use { scan-file linker.dump "Moving .* section\\(s\\) to new segment" } } */ /* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt new file mode 100644 index 000000000..c7a82f77e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/buildinfo.txt @@ -0,0 +1 @@ +Test -fprofile-generate-buildinfo option diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h new file mode 100644 index 000000000..bf28164a0 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup.h @@ -0,0 +1,5 @@ +class Foo +{ + public: + int foo(int x) { return x; } +}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C new file mode 100644 index 000000000..7743a0b36 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_0.C @@ -0,0 +1,9 @@ +/* { dg-options "-O2 -fno-inline -fprofile-generate-buildinfo=$srcdir/g++.dg/tree-prof/lipo/buildinfo.txt" } */ +#include <stdio.h> + +extern int foo1(int x); +extern int foo2(int x); +int main() +{ + printf ("Result = %d\n", foo1(1) + foo2(1)); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C new file mode 100644 index 000000000..5f24dc1eb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_1.C @@ -0,0 +1,7 @@ +/* { dg-options "-O2 -fno-inline" } */ +#include "comdat_fixup.h" +int foo1(int x) +{ + Foo f; + return f.foo(x); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C new file mode 100644 index 000000000..1416129c0 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/comdat_fixup_2.C @@ -0,0 +1,7 @@ +/* { dg-options "-O2 -fno-inline" } */ +#include "comdat_fixup.h" +int foo2(int x) +{ + Foo f; + return f.foo(x); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C index b34b937fd..78fd0c583 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/indir-call-prof_0.C @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=1" } */ struct A { A () {} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C new file mode 100644 index 000000000..525480dab --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_0.C @@ -0,0 +1,48 @@ +// { dg-options "-std=c++11 -O2" } + +// A test case for static var promotion on targets like powerpc, where +// the static initializer data is loaded via indirection through +// TOC. Ensure that the global label for static initializer data is +// unique via *.cmo* suffix. + +// Bug: after static var promotion in two different modules, we have +// the following which leads to multiple definition of ._41" error during +// link time. + +// Module 1 Module 2 +// .hidden ._41.cmo.1 .hidden ._41.cmo.3 +// .globl ._41 .globl ._41 +// ._41: ._41: +// ... ... + + +// Instead we should use the appropriate unique names for initializer +// data as in the following. + +// Module 1 Module 2 +// .hidden ._41.cmo.1 .hidden ._41.cmo.3 +// .globl ._41.cmo.1 .globl ._41.cmo.3 +// ._41.cmo.1: ._41.cmo.3: +// ... ... + +class A { + public: + int f(int x) const; +}; + +class B { + public: + int f(int x) const; +}; + +int main() +{ + A *a = new A(); + B *b = new B(); + int total = 0; + for (int i=0; i<3; ++i) { + total += a->f(1); + total += b->f(1); + } + return (total > 0) ? 0 : 1; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C new file mode 100644 index 000000000..0236e16d3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_1.C @@ -0,0 +1,14 @@ +/* { dg-options "-std=c++11 -O2" } */ + +#include <vector> + +class A { + public: + int f(int x) const; +}; + +static const std::vector<int> point1_{42}; + +int A::f(int x) const { + return x+1; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C new file mode 100644 index 000000000..d39095de5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/static1_2.C @@ -0,0 +1,14 @@ +/* { dg-options "-std=c++11 -O2" } */ + +#include <vector> + +class B { + public: + int f(int x) const; +}; + +static const std::vector<int> point2_{43}; + +int B::f(int x) const { + return x+1; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h new file mode 100644 index 000000000..5eb102d74 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls.h @@ -0,0 +1,16 @@ +extern int NextId(); + +class TLSClass { + public: + TLSClass() { + id = NextId(); + bar = 1; + } + ~TLSClass() {} + int id; + int bar; +}; +extern TLSClass* NextTLSClass(); +extern void *SetTLSClass(TLSClass *a); +extern TLSClass *GetTLSClass(); +extern thread_local TLSClass* current_tls_; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h new file mode 100644 index 000000000..9ba0945c2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2.h @@ -0,0 +1,15 @@ +extern int NextId(); + +class TLSClass { + public: + TLSClass() { + id = NextId(); + bar = 1; + } + ~TLSClass() {} + int id; + int bar; +}; +extern TLSClass* NextTLSClass(); +extern void *SetTLSClass(TLSClass *a); +extern TLSClass *GetTLSClass(); diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C new file mode 100644 index 000000000..9ccd5b96b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_0.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" } +#include "tls2.h" + +static thread_local TLSClass* current_tls_ = NextTLSClass(); +void *SetTLSClass(TLSClass *a) { + current_tls_ = a; +} +TLSClass *GetTLSClass() { + return current_tls_; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C new file mode 100644 index 000000000..43c108526 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls2_1.C @@ -0,0 +1,31 @@ +// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" } +#include <stdio.h> +#include <stdlib.h> +#include <new> +#include "tls2.h" +TLSClass* NextTLSClass() { + return new TLSClass(); +} +int NextId() { + static int id = 0; + return id++; +} +static thread_local TLSClass* current_tls2_ = NextTLSClass(); +void *SetTLSClass2(TLSClass *a) { + current_tls2_ = a; +} +int main() { + int i = 0; + if (GetTLSClass()->id != i++) + abort(); + TLSClass *A = NextTLSClass(); + SetTLSClass(A); + if (GetTLSClass()->id != i++) + abort(); + if (current_tls2_->id != i++) + abort(); + A = NextTLSClass(); + SetTLSClass2(A); + if (current_tls2_->id != i++) + abort(); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C new file mode 100644 index 000000000..f3e5e376e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_0.C @@ -0,0 +1,10 @@ +// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" } +#include "tls.h" + +thread_local TLSClass* current_tls_ = NextTLSClass(); +void *SetTLSClass(TLSClass *a) { + current_tls_ = a; +} +TLSClass *GetTLSClass() { + return current_tls_; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C new file mode 100644 index 000000000..fcf8c2101 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/lipo/tls_1.C @@ -0,0 +1,38 @@ +// { dg-options "-std=c++11 -O2 --param=lipo-sampling-period=1" } +#include <stdio.h> +#include <stdlib.h> +#include <new> +#include "tls.h" +TLSClass* NextTLSClass() { + return new TLSClass(); +} +int NextId() { + static int id = 0; + return id++; +} +void *SetTLSClassHere(TLSClass *a) { + current_tls_ = a; +} +thread_local TLSClass* current_tls2_ = NextTLSClass(); +void *SetTLSClass2(TLSClass *a) { + current_tls2_ = a; +} +int main() { + int i = 0; + if (GetTLSClass()->id != i++) + abort(); + TLSClass *A = NextTLSClass(); + SetTLSClass(A); + if (GetTLSClass()->id != i++) + abort(); + A = NextTLSClass(); + SetTLSClassHere(A); + if (GetTLSClass()->id != i++) + abort(); + if (current_tls2_->id != i++) + abort(); + A = NextTLSClass(); + SetTLSClass2(A); + if (current_tls2_->id != i++) + abort(); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C new file mode 100644 index 000000000..b1225a0f8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/partition_patch.C @@ -0,0 +1,19 @@ +// Check if patching works with function splitting. +// { dg-require-effective-target freorder } +// { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition " { target { ! x86_64-*-* } } } +// { dg-options "-O2 -fnon-call-exceptions -freorder-blocks-and-partition -mpatch-functions-for-instrumentation -fno-optimize-sibling-calls " { target x86_64-*-* } } + +int k; + +int +main () +{ + try + { + if (k) + throw 6; + } + catch (...) + { + } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C new file mode 100644 index 000000000..c8caf0765 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-prof/pr63581.C @@ -0,0 +1,91 @@ +// { dg-require-effective-target freorder } +/* { dg-options "-O2 -g -fno-peel-loops" } */ + +struct page { + int i; +} global; + +__attribute__((noinline)) static struct page* find_page1 (int i) +{ + if ( i< 150) + return 0; + global.i = i; + return &global; +} + +__attribute__((noinline)) static struct page* find_page2 (int i) +{ + global.i = i; + return &global; +} + +volatile int ii; +__attribute__((noinline)) static int zero (void) +{ + return ii; +} + +static inline int uptodate (struct page* p) +{ + return (p->i < 709); +} + +static struct page* bar(int i) +{ + struct page *page; + +repeat: + page = find_page1 (i); + if (!page) { + page = find_page2 (i); + if (!page) + return 0; + if (zero () ) { + zero (); + goto repeat; + } + } + return page; +} + +__attribute__((noinline)) int foo (int n) +{ + struct page *page; + +retry: + page = bar (n); + if (page == 0) + return 0; + if (uptodate (page)) + goto out; + + zero (); + if (page->i < 0) { + zero (); + goto retry; + } +out: + return 1; +} + +__attribute__((noinline)) int hot (void) +{ + int i; + int sum = 0; + + for (i = 0; i < 433038; i++) + sum+=i; + + return sum; +} + +int main(void) +{ + int i; + + global.i = hot (); + for (i = 0; i < 858; i++) + foo (i); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/pr63841.C b/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/pr63841.C new file mode 100644 index 000000000..2a2c78f9f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tree-ssa/pr63841.C @@ -0,0 +1,35 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +#include <string> + +std::string __attribute__ ((noinline)) comp_test_write() { + std::string data; + + for (int i = 0; i < 2; ++i) { + char b = 1 >> (i * 8); + data.append(&b, 1); + } + + return data; +} + +std::string __attribute__ ((noinline)) comp_test_write_good() { + std::string data; + + char b; + for (int i = 0; i < 2; ++i) { + b = 1 >> (i * 8); + data.append(&b, 1); + } + + return data; +} + +int main() { + std::string good = comp_test_write_good(); + std::string bad = comp_test_write(); + + if (good != bad) + __builtin_abort (); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free.C b/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free.C index 26d01ae3f..20429f159 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free.C @@ -1,18 +1,23 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <unistd.h> +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; void *Thread(void *a) { __atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST); + barrier_wait(&barrier); return 0; } int main() { + barrier_init(&barrier, 2); int *a = new int(0); pthread_t t; pthread_create(&t, 0, Thread, a); - sleep(1); + barrier_wait(&barrier); delete a; pthread_join(t, 0); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free2.C b/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free2.C index 1fe512cde..3b6a8e3af 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free2.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/tsan/atomic_free2.C @@ -1,19 +1,24 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ #include <pthread.h> -#include <unistd.h> +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; void *Thread(void *a) { - sleep(1); + barrier_wait(&barrier); __atomic_fetch_add((int*)a, 1, __ATOMIC_SEQ_CST); return 0; } int main() { + barrier_init(&barrier, 2); int *a = new int(0); pthread_t t; pthread_create(&t, 0, Thread, a); delete a; + barrier_wait(&barrier); pthread_join(t, 0); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tsan/cond_race.C b/gcc-4.9/gcc/testsuite/g++.dg/tsan/cond_race.C index a93761477..d72d0fb54 100644 --- a/gcc-4.9/gcc/testsuite/g++.dg/tsan/cond_race.C +++ b/gcc-4.9/gcc/testsuite/g++.dg/tsan/cond_race.C @@ -1,10 +1,12 @@ /* { dg-shouldfail "tsan" } */ +/* { dg-additional-options "-ldl" } */ /* { dg-output "ThreadSanitizer: data race.*" } */ /* { dg-output "pthread_cond_signal.*" } */ -#include <stdio.h> -#include <stdlib.h> #include <pthread.h> +#include "tsan_barrier.h" + +static pthread_barrier_t barrier; struct Ctx { pthread_mutex_t m; @@ -18,10 +20,12 @@ void *thr(void *p) { c->done = true; pthread_mutex_unlock(&c->m); pthread_cond_signal(&c->c); + barrier_wait(&barrier); return 0; } int main() { + barrier_init(&barrier, 2); Ctx *c = new Ctx(); pthread_mutex_init(&c->m, 0); pthread_cond_init(&c->c, 0); @@ -31,6 +35,7 @@ int main() { while (!c->done) pthread_cond_wait(&c->c, &c->m); pthread_mutex_unlock(&c->m); + barrier_wait(&barrier); delete c; pthread_join(th, 0); } diff --git a/gcc-4.9/gcc/testsuite/g++.dg/tsan/tsan_barrier.h b/gcc-4.9/gcc/testsuite/g++.dg/tsan/tsan_barrier.h new file mode 100644 index 000000000..5d37a6475 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/tsan/tsan_barrier.h @@ -0,0 +1,14 @@ +/* TSAN-invisible barriers. Link with -ldl. */ +#include <pthread.h> +#include <dlfcn.h> + +static __typeof(pthread_barrier_wait) *barrier_wait; + +static +void barrier_init (pthread_barrier_t *barrier, unsigned count) +{ + void *h = dlopen ("libpthread.so.0", RTLD_LAZY); + barrier_wait = (__typeof (pthread_barrier_wait) *) + dlsym (h, "pthread_barrier_wait"); + pthread_barrier_init (barrier, NULL, count); +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr61272.C b/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr61272.C new file mode 100644 index 000000000..064678d37 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr61272.C @@ -0,0 +1,24 @@ +// PR sanitizer/61272 +// { dg-do compile } +// { dg-options "-fsanitize=undefined -std=c++11" } + +namespace std +{ + template < typename _Tp > class allocator; + template < typename _Alloc > struct allocator_traits { + private: + template < typename _Tp > auto construct ( _Alloc & __a, _Tp * __p)-> // { dg-error "is private" } + decltype (_S_construct (__a, __p)) { } + }; + namespace __gnu_cxx + { + template < typename _Alloc > struct __alloc_traits:std::allocator_traits < _Alloc > // { dg-error "within this context" } + { + typedef std::allocator_traits < _Alloc > _Base_type; + using _Base_type::construct; + }; + template < typename _Tp, typename _Alloc > struct _Vector_base { typedef typename __gnu_cxx::__alloc_traits < _Alloc >::template rebind < _Tp >::other _Tp_alloc_type; }; // { dg-error "no class template" } + template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class vector : protected _Vector_base < _Tp, _Alloc > { }; + template < typename NumberT > struct Point2d { }; + typedef Point2d < int >GdsPoint; + class GdsPointList : public vector < GdsPoint > {};}} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr63913.C b/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr63913.C new file mode 100644 index 000000000..34dceb4d8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/ubsan/pr63913.C @@ -0,0 +1,12 @@ +// PR sanitizer/63913 +// { dg-do compile } +// { dg-options "-fsanitize=bool -fnon-call-exceptions" } + +struct B { B (); ~B (); }; + +double +foo (bool *x) +{ + B b; + return *x; +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-parm-6.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-parm-6.C new file mode 100644 index 000000000..95fb7e2db --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-parm-6.C @@ -0,0 +1,8 @@ +// PR c++/61465 +// { dg-do compile { target c++11 } } +// { dg-options "-Wunused-but-set-parameter" } + +struct Foo { + Foo(void* x) : y{static_cast<char*>(x)} {} + char* y; +}; diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-22.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-22.C new file mode 100644 index 000000000..8ae46c17f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/Wunused-var-22.C @@ -0,0 +1,12 @@ +// PR c++/63657 +// { dg-options "-Wunused-variable" } + +class Bar +{ + virtual ~Bar() {} +}; +Bar& getbar(); +void bar() +{ + Bar& b = getbar(); // { dg-warning "unused" } +} diff --git a/gcc-4.9/gcc/testsuite/g++.dg/warn/register-parm-1.C b/gcc-4.9/gcc/testsuite/g++.dg/warn/register-parm-1.C new file mode 100644 index 000000000..44232d3cf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/g++.dg/warn/register-parm-1.C @@ -0,0 +1,9 @@ +// PR c++/60955 +// { dg-options "-Wextra" } + +unsigned int erroneous_warning(register int a) { + if ((a) & 0xff) return 1; else return 0; +} +unsigned int no_erroneous_warning(register int a) { + if (a & 0xff) return 1; else return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr62312.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr62312.c new file mode 100644 index 000000000..2e87bb9bd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr62312.c @@ -0,0 +1,23 @@ +/* PR target/62312 */ + +typedef struct { unsigned int arg[100]; } *FunctionCallInfo; +typedef struct { int day; int month; } Interval; +void* palloc (unsigned int); +int bar (void); +void baz (void); + +void +interval_pl (FunctionCallInfo fcinfo) +{ + Interval *span1 = ((Interval *) ((char *) ((fcinfo->arg[0])))); + Interval *span2 = ((Interval *) ((char *) ((fcinfo->arg[1])))); + Interval *result = (Interval *) palloc (sizeof (Interval)); + + if ((((span1->month) < 0) == ((span2->month) < 0)) + && !(((result->month) < 0) == ((span1->month) < 0))) + do { + if (bar ()) + baz (); + } while(0); + result->day = span1->day + span2->day; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr63282.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr63282.c new file mode 100644 index 000000000..cb23278d5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr63282.c @@ -0,0 +1,13 @@ +/* PR inline-asm/63282 */ + +void bar (void); + +void +foo (void) +{ + asm volatile goto ("" : : : : a, b); +a: + bar (); +b: + return; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64067.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64067.c new file mode 100644 index 000000000..24ad996ef --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64067.c @@ -0,0 +1,10 @@ +/* PR middle-end/64067 */ + +struct S { int s; }; +int *const v[1] = { &((struct S) { .s = 42 }).s }; + +int * +foo (void) +{ + return v[0]; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64269.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64269.c new file mode 100644 index 000000000..640758d3f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/compile/pr64269.c @@ -0,0 +1,9 @@ +/* PR tree-optimization/64269 */ + +void +foo (char *p) +{ + __SIZE_TYPE__ s = ~(__SIZE_TYPE__)0; + *p = 0; + __builtin_memset (p + 1, 0, s); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63209.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63209.c new file mode 100644 index 000000000..9bcb58745 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63209.c @@ -0,0 +1,27 @@ +static int Sub(int a, int b) { + return b -a; +} + +static unsigned Select(unsigned a, unsigned b, unsigned c) { + const int pa_minus_pb = + Sub((a >> 8) & 0xff, (b >> 8) & 0xff) + + Sub((a >> 0) & 0xff, (b >> 0) & 0xff); + return (pa_minus_pb <= 0) ? a : b; +} + +__attribute__((noinline)) unsigned Predictor(unsigned left, const unsigned* const top) { + const unsigned pred = Select(top[1], left, top[0]); + return pred; +} + +int main(void) { + const unsigned top[2] = {0xff7a7a7a, 0xff7a7a7a}; + const unsigned left = 0xff7b7b7b; + const unsigned pred = Predictor(left, top /*+ 1*/); + if (pred == left) + return 0; + return 1; +} + + + diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63302.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63302.c new file mode 100644 index 000000000..99670241b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63302.c @@ -0,0 +1,60 @@ +/* PR tree-optimization/63302 */ + +#ifdef __SIZEOF_INT128__ +#if __SIZEOF_INT128__ * __CHAR_BIT__ == 128 +#define USE_INT128 +#endif +#endif +#if __SIZEOF_LONG_LONG__ * __CHAR_BIT__ == 64 +#define USE_LLONG +#endif + +#ifdef USE_INT128 +__attribute__((noinline, noclone)) int +foo (__int128 x) +{ + __int128 v = x & (((__int128) -1 << 63) | 0x7ff); + + return v == 0 || v == ((__int128) -1 << 63); +} +#endif + +#ifdef USE_LLONG +__attribute__((noinline, noclone)) int +bar (long long x) +{ + long long v = x & (((long long) -1 << 31) | 0x7ff); + + return v == 0 || v == ((long long) -1 << 31); +} +#endif + +int +main () +{ +#ifdef USE_INT128 + if (foo (0) != 1 + || foo (1) != 0 + || foo (0x800) != 1 + || foo (0x801) != 0 + || foo ((__int128) 1 << 63) != 0 + || foo ((__int128) -1 << 63) != 1 + || foo (((__int128) -1 << 63) | 1) != 0 + || foo (((__int128) -1 << 63) | 0x800) != 1 + || foo (((__int128) -1 << 63) | 0x801) != 0) + __builtin_abort (); +#endif +#ifdef USE_LLONG + if (bar (0) != 1 + || bar (1) != 0 + || bar (0x800) != 1 + || bar (0x801) != 0 + || bar (1LL << 31) != 0 + || bar (-1LL << 31) != 1 + || bar ((-1LL << 31) | 1) != 0 + || bar ((-1LL << 31) | 0x800) != 1 + || bar ((-1LL << 31) | 0x801) != 0) + __builtin_abort (); +#endif + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63659.c b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63659.c new file mode 100644 index 000000000..780dc8a7e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.c-torture/execute/pr63659.c @@ -0,0 +1,29 @@ +/* PR rtl-optimization/63659 */ + +int a, b, c, *d = &b, g, h, i; +unsigned char e; +char f; + +int +main () +{ + while (a) + { + for (a = 0; a; a++) + for (; c; c++) + ; + if (i) + break; + } + + char j = c, k = -1, l; + l = g = j >> h; + f = l == 0 ? k : k % l; + e = 0 ? 0 : f; + *d = e; + + if (b != 255) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c new file mode 100644 index 000000000..b25af5769 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/20141029-1.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */ + +#define PERIPH (*(volatile struct system_periph *)0x81234) + +struct system_periph { + union { + unsigned short WORD; + struct { + unsigned short a:1; + unsigned short b:1; + unsigned short :5; + unsigned short c:1; + unsigned short :8; + } BIT; + } ALL; +}; + +void +foo() +{ + while (1) + { + PERIPH.ALL.BIT.a = 1; + } +} +/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:HI" 4 "final" } } */ +/* { dg-final { cleanup-rtl-dump "final" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c index d8a3243bb..6221d617b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-1.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.1" } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1010 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c index fd4975a52..8e18d5273 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-2.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.1 -mmacosx-version-min=10.3" } */ /* { dg-do run { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1030 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c index d0c5934b4..4fcb9693c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-3.c @@ -2,7 +2,8 @@ /* { dg-options "-mmacosx-version-min=10.4.10" } */ /* { dg-do compile { target *-*-darwin* } } */ -int main(void) +int +main () { #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 1040 fail me; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c new file mode 100644 index 000000000..1cb42ebe3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/darwin-minversion-4.c @@ -0,0 +1,12 @@ +/* Test that major versions greater than 9 work and have the additional 0. */ +/* { dg-options "-mmacosx-version-min=10.10.0" } */ +/* { dg-do compile { target *-*-darwin* } } */ + +int +main () +{ +#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ != 101000 + fail me; +#endif + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c new file mode 100644 index 000000000..c5398070b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-1.c @@ -0,0 +1,25 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ +/* { dg-final { scan-assembler-times "pop\[^\n\r\]*bp" 1 } } */ + +/* Check there is 1 push, 1 pop and 1 mov-sp-to-bp. */ + +unsigned M; +int cond1, cond2; +extern void goo(); +extern void hoo(); +extern void ioo(); + +void foo() { + unsigned i; + for (i = 0; i <= M; i++) { + if (cond1) { + goo(); + } else if (cond2) { + hoo(); + } else { + ioo(); + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c new file mode 100644 index 000000000..25a99a92f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-2.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -mno-omit-leaf-frame-pointer -fno-schedule-insns2" } */ +/* { dg-final { scan-assembler-not "mov\[^\n\r\]*bp" } } */ + +/* Check fp is the last register to use. */ + +int a[1000], b[1000]; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c new file mode 100644 index 000000000..00f8ca331 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-3.c @@ -0,0 +1,56 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ + +/* Check both loop1 and loop2 should not set fp free, and fp setting + will be promoted outside all the loops. */ +int a[1000], b[1000], cond1, cond2; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + for (i = 0; i <= M; i++) { + goo(); + if (__builtin_expect(cond1, 0)) { + if (__builtin_expect(cond2, 0)) { + for (j = 0; j <= N; j++) { + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + *p = 3; + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + } + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c new file mode 100644 index 000000000..cff83f2db --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-4.c @@ -0,0 +1,64 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler-times "lea\[^\n\r\]*bp" 2 } } */ +/* { dg-final { scan-rtl-dump-not "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check the fp setting of goo and hoo inside loops could be + promoted to loop header. */ + +int a[1000], b[1000], cond1, cond2, x, y; +unsigned M, N; +extern void goo(); +extern void hoo(); + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + if (cond1) + hoo(); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + + for (i = 0; i < M; i++) { + r1 = x; + goo(); + y = r1; + if (cond1) { + for (j = 0; j < N; j++) { + r2 = a[j]; + hoo(); + b[j] = r2; + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c new file mode 100644 index 000000000..7eba71e21 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-5.c @@ -0,0 +1,59 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler-times "lea\[^\n\r\]*bp" 1 } } */ +/* { dg-final { scan-rtl-dump "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { scan-rtl-dump-not "loop 2\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check loop1 should set fp_is_free and loop2 should not. */ +int a[1000], b[1000], cond1, cond2, x, y; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + for (i = 0; i < M; i++) { + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + r13 = a[13]; + r14 = a[14]; + r15 = a[15]; + *p = 3; + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + b[13] = r13; + b[14] = r14; + b[15] = r15; + + if (cond1) { + for (j = 0; j < N; j++) { + r2 = a[j]; + goo(); + b[j] = r2; + } + } + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c new file mode 100644 index 000000000..42b7c6a28 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-6.c @@ -0,0 +1,50 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2 -fdisable-rtl-ce1 -fdisable-rtl-ce2 -fdisable-rtl-ce3 -ffixed-ax -fdump-rtl-ira-details-blocks" } */ +/* { dg-final { scan-assembler "mov\[^\n\r\]*a\\+56\[^\n\r\]*bp\[^\n\r\]*\[\n\r\]\[^\n\r\]*mov\[^\n\r\]*bp\[^\n\r\]*b\\+56" } } */ +/* { dg-final { scan-rtl-dump "loop 1\[^\n\r\]*fp" "ira" } } */ +/* { dg-final { cleanup-rtl-dump "ira" } } */ + +/* Check loop1 should set fp free, and lra could use fp too. */ +int a[1000], b[1000], M, N, cond1, cond2, cond3; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + int i, j; + + r15 = a[15]; + for (i = 0; i < M; i++) { + if (__builtin_expect(cond1, 0)) + if (__builtin_expect(cond2, 0)) + goo(); + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + asm volatile ("" : : : "memory"); + b[14] = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + } + b[15] = r15; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c new file mode 100644 index 000000000..fa466424f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-7.c @@ -0,0 +1,50 @@ +/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2 -fdisable-rtl-ce1 -fdisable-rtl-ce2 -fdisable-rtl-ce3 -ffixed-ax -dA" } */ +/* { dg-final { scan-assembler-times "BLOCK 2.*push\[^\n\r\]*bp.*mov\[^\n\r\]*sp\[^\n\r\]*bp.*BLOCK 3" 1 } } */ + +/* Check loop1 should not set fp free, and lra should not use fp too. */ +int a[1000], b[1000], cond1, cond2, cond3; +unsigned M, N; +extern void goo(); +int *p; + +void foo() { + int r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15; + unsigned i, j; + + r15 = a[15]; + for (i = 0; i <= M; i++) { + goo(); + goo(); + goo(); + goo(); + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + r5 = a[5]; + r6 = a[6]; + r7 = a[7]; + r8 = a[8]; + r9 = a[9]; + r10 = a[10]; + r11 = a[11]; + r12 = a[12]; + asm volatile ("" : : : "memory"); + b[14] = a[14]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; + b[5] = r5; + b[6] = r6; + b[7] = r7; + b[8] = r8; + b[9] = r9; + b[10] = r10; + b[11] = r11; + b[12] = r12; + } + b[15] = r15; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c new file mode 100644 index 000000000..471cdf5c5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-8.c @@ -0,0 +1,84 @@ +/* { dg-do run { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer" } */ +/* { dg-output "stack_depth = 8" } */ + +#include <stdio.h> + +void* address[1000]; +int sizes[1000]; +int N; +int main(); +void *main_ret_address; + +__attribute((noinline)) int +get_stack_traces (void **result) +{ + void **sp = (void**) __builtin_frame_address (0); + int n = 0; + while (sp) { + if ((*(char **)(sp+1)) == main_ret_address) + return n; + + void **next_sp = (void**) *sp; + result[n] = *(sp+1); + if (next_sp > sp) + sizes[n] = (char*)next_sp - (char*)sp; + else + sizes[n] = 0; + sp = next_sp; + n++; + } + return n; +} + +__attribute__((noinline)) int bar(int level) +{ + int a[100]; + + int i; + + if (level == 0) + { + N = get_stack_traces (address); + return 0; + } + + for (i = 0; i < 100; i++) + a[i] = i + 10; + + return bar (level - 1) + a[0] + a[99]; +} + +__attribute__((noinline)) int foo() +{ + + int a[100]; + + int i; + + for (i = 0; i < 100; i++) + a[i] = i + 10; + + + return bar (5) + a[0] + a[99]; +} + + +int main() +{ + int i, n; + + main_ret_address = __builtin_return_address (0); + n = foo(); + + fprintf (stderr, "return value = %d, stack_depth = %d\n", n, N); + + for (i = 0; i < N; i++) + { + fprintf (stderr, "Frame[%d]: addr = %p, stack_size = %d\n", i, + address[i], sizes[i]); + + } + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c new file mode 100644 index 000000000..7c1e8b85d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/fpomit-9.c @@ -0,0 +1,23 @@ +/* { dg-do compile { target {{ i?86-*-* x86_64-*-* } && lp64 } } } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -fshrink-wrap-frame-pointer -fno-schedule-insns2" } */ +/* { dg-final { scan-assembler-not "push" } } */ +/* { dg-final { scan-assembler-not "pop" } } */ + +/* Check -fshrink-wrap-frame-pointer can enable omitting leaf frame pointer + if -mno-omit-leaf-frame-pointer is not specified explicitly. */ + +int a[1000], b[1000]; + +void foo() { + int r1, r2, r3, r4; + + r1 = a[1]; + r2 = a[2]; + r3 = a[3]; + r4 = a[4]; + asm volatile ("" : : : "memory"); + b[1] = r1; + b[2] = r2; + b[3] = r3; + b[4] = r4; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c new file mode 100644 index 000000000..463afdc26 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/PR64559.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ + +int a, b, c, d; + +struct S +{ + int f0; +}; + +static int +fn1 (int p) +{ + return p == 0 || a; +} + +static int +fn2 () +{ + d = fn1 (c); + return 0; +} + +static int +fn3 (struct S p) +{ + p.f0 || fn2 (); + if (fn1 (1)) + b = 0; + return 0; +} + +int +main () +{ + struct S e = { 1 }; + fn3 (e); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c new file mode 100644 index 000000000..8d2f658b8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr61986.c @@ -0,0 +1,48 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +int a, b, c; + +struct S +{ + int f0; + int f1; +} d; + +static int fn2 (struct S); +void fn3 (struct S); + +void +fn1 (struct S p) +{ + struct S h = { 0, 0 }; + fn3 (p); + fn2 (h); +} + +int +fn2 (struct S p) +{ + struct S j = { 0, 0 }; + fn3 (p); + fn2 (j); + return 0; +} + +void +fn3 (struct S p) +{ + for (; b; a++) + c = p.f0; + fn1 (d); +} + +void +fn4 () +{ + for (;;) + { + struct S f = { 0, 0 }; + fn1 (f); + } +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c new file mode 100644 index 000000000..48b020aee --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr63551.c @@ -0,0 +1,33 @@ +/* { dg-do run } */ +/* { dg-options "-Os" } */ + +union U +{ + unsigned int f0; + int f1; +}; + +int a, d; + +void +fn1 (union U p) +{ + if (p.f1 <= 0) + if (a) + d = 0; +} + +void +fn2 () +{ + d = 0; + union U b = { 4294967286U }; + fn1 (b); +} + +int +main () +{ + fn2 (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c new file mode 100644 index 000000000..4877b4b68 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/ipa/pr64041.c @@ -0,0 +1,64 @@ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +int printf (const char *, ...); + +int a, b = 1, d; + +union U1 +{ + unsigned int f0; + int f1; +}; + +union U2 +{ + int f2; + int f3; +} c; + +int +fn1 (int p) +{ + int t = p && a || p && a && p; + return t ? t : a; +} + +unsigned +fn2 (union U1 p1, union U2 p2) +{ + if (p1.f1 <= 0) + { + for (; p2.f2;) + c.f2 = 0; + p2.f2 = fn1 (d); + } + return p2.f3; +} + +int g = 0; + +int +foo () +{ + if (b) + { + union U1 f = { 0xFFFFFFFFU }; + + fn2 (f, c); + } + g = 1; + return 0; +} + + +int +main () +{ + foo (); + + if (g == 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c b/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c new file mode 100644 index 000000000..b5d29095a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/option_no-pie.c @@ -0,0 +1,7 @@ +/* { dg-do link { target pie } } */ +/* { dg-options "-no-pie" } */ + +int main(void) +{ + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c index 1b25e296f..7490e33f0 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr51879-12.c @@ -24,6 +24,6 @@ foo (int y) baz (a); } -/* { dg-final { scan-tree-dump-times "bar \\(" 1 "pre"} } */ -/* { dg-final { scan-tree-dump-times "bar2 \\(" 1 "pre"} } */ +/* { dg-final { scan-tree-dump-times "bar \\(" 1 "pre" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "bar2 \\(" 1 "pre" { xfail *-*-* } } } */ /* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c new file mode 100644 index 000000000..138cecb14 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr52769.c @@ -0,0 +1,24 @@ +/* PR c/52769 */ +/* { dg-do run } */ +/* { dg-options "-O3" } */ + +typedef struct +{ + int should_be_zero; + char s[6]; + int x; +} foo_t; + +int +main (void) +{ + volatile foo_t foo = { + .s = "123456", + .x = 2 + }; + + if (foo.should_be_zero != 0) + __builtin_abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c new file mode 100644 index 000000000..4276c3f15 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-1.c @@ -0,0 +1,33 @@ +/* PR c/56724 */ +/* { dg-do compile } */ +/* { dg-options "-Wtraditional-conversion" } */ + +extern void foo (int p[2][]); /* { dg-error "array type has incomplete element type" } */ +extern void foo_i (int, int); +extern void foo_u (unsigned int); +extern void foo_f (int, float); +extern void foo_ll (long long); +extern void foo_cd (int, int, __complex__ double); +extern signed char sc; +extern int i; +extern unsigned int u; +extern float f; +extern double d; +extern __complex__ double cd; + +void +fn () +{ + int p[1][1]; + foo (p); /* { dg-error "8:type of formal parameter" } */ + foo_i (1, f); /* { dg-warning "13:passing argument" } */ + foo_i (1, cd); /* { dg-warning "13:passing argument" } */ + foo_cd (1, 2, f); /* { dg-warning "17:passing argument" } */ + foo_f (9, i); /* { dg-warning "13:passing argument" } */ + foo_cd (2, 2, i); /* { dg-warning "17:passing argument" } */ + foo_f (2, cd); /* { dg-warning "13:passing argument" } */ + foo_f (2, d); /* { dg-warning "13:passing argument" } */ + foo_ll (sc); /* { dg-warning "11:passing argument" } */ + foo_u (i); /* { dg-warning "10:passing argument" } */ + foo_i (1, u); /* { dg-warning "13:passing argument" } */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c new file mode 100644 index 000000000..4abb7d899 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr56724-2.c @@ -0,0 +1,31 @@ +/* PR c/56724 */ +/* { dg-do compile } */ +/* { dg-options "-Wc++-compat -Wpedantic" } */ + +enum E1 { A }; +enum E2 { B }; +extern void foo_E (enum E1); +extern void foo_v (void *p); +extern void foo_sc (int, int, signed char *); +extern unsigned char *uc; +extern signed char sc; +extern const signed char *csc; +extern float *f; + +void +foo (void) +{ + void (*fp)(void); + const void (*ffp)(void); + foo_v (fp); /* { dg-warning "10:ISO C forbids passing argument" } */ + foo_E (B); /* { dg-warning "10:enum conversion when passing argument" } */ + foo_sc (1, 2, uc); /* { dg-warning "17:pointer targets in passing argument" } */ + foo_sc (1, 2, f); /* { dg-warning "17:passing argument" } */ + foo_sc (1, 2, sc); /* { dg-warning "17:passing argument" } */ + foo_sc (uc, 2, &sc); /* { dg-warning "11:passing argument" } */ + foo_sc (1, 2, csc); /* { dg-warning "17:passing argument" } */ +} + +typedef void (*fp)(void); +typedef void (*nrfp)(void) __attribute__((noreturn)); +void f1 (nrfp); void f2 (fp x) { f1 (x); } extern int e; /* { dg-warning "38:passing argument" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c index 4fd531974..e27042030 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr61053.c @@ -31,17 +31,17 @@ _Alignas (long double) int ild; _Alignas (char) long int lic; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) long int lis; /* { dg-error "cannot reduce alignment" } */ -_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (int) long int lii; /* { dg-error "cannot reduce alignment" "" { target { ! { ilp32 } } } } */ _Alignas (long int) long int lil; _Alignas (long long int) long int lill; -_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ +_Alignas (float) long int lif; /* { dg-error "cannot reduce alignment" "" { target { ! { ilp32 } } } } */ _Alignas (double) long int lid; _Alignas (long double) long int lild; _Alignas (char) long long int llic; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) long long int llis; /* { dg-error "cannot reduce alignment" } */ _Alignas (int) long long int llii; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ -_Alignas (long int) long long int llil; +_Alignas (long int) long long int llil; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */ _Alignas (long long int) long long int llill; _Alignas (float) long long int llif; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ _Alignas (double) long long int llid; @@ -59,7 +59,7 @@ _Alignas (long double) float fld; _Alignas (char) double dc; /* { dg-error "cannot reduce alignment" } */ _Alignas (short int) double ds; /* { dg-error "cannot reduce alignment" } */ _Alignas (int) double di; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ -_Alignas (long int) double dl; +_Alignas (long int) double dl; /* { dg-error "cannot reduce alignment" "" { target { x32 } } } */ _Alignas (long long int) double dll; _Alignas (float) double df; /* { dg-error "cannot reduce alignment" "" { target { ! { ia32 } } } } */ _Alignas (double) double dd; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c new file mode 100644 index 000000000..37214a3ec --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167-run.c @@ -0,0 +1,47 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-tail-merge" } */ + +struct node +{ + struct node *next; + struct node *prev; +}; + +struct node node; + +struct head +{ + struct node *first; +}; + +struct head heads[5]; + +int k = 2; + +struct head *head = &heads[2]; + +int +main () +{ + struct node *p; + + node.next = (void*)0; + + node.prev = (void *)head; + + head->first = &node; + + struct node *n = head->first; + + struct head *h = &heads[k]; + + heads[2].first = n->next; + + if ((void*)n->prev == (void *)h) + p = h->first; + else + /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */ + p = n->prev->next; + + return !(p == (void*)0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62167.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167.c new file mode 100644 index 000000000..f8c31a079 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62167.c @@ -0,0 +1,50 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-tail-merge -fdump-tree-pre" } */ + +struct node +{ + struct node *next; + struct node *prev; +}; + +struct node node; + +struct head +{ + struct node *first; +}; + +struct head heads[5]; + +int k = 2; + +struct head *head = &heads[2]; + +int +main () +{ + struct node *p; + + node.next = (void*)0; + + node.prev = (void *)head; + + head->first = &node; + + struct node *n = head->first; + + struct head *h = &heads[k]; + + heads[2].first = n->next; + + if ((void*)n->prev == (void *)h) + p = h->first; + else + /* Dead tbaa-unsafe load from ((struct node *)&heads[2])->next. */ + p = n->prev->next; + + return !(p == (void*)0); +} + +/* { dg-final { scan-tree-dump-not "Removing basic block" "pre"} } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c new file mode 100644 index 000000000..c6ec5a753 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.c @@ -0,0 +1,10 @@ +/* PR c/62294 */ +/* { dg-do compile } */ + +#include "pr62294.h" + +void +fn (int *u) +{ + foo (u); /* { dg-error "passing argument 1 of .bar. from incompatible pointer type" } */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h new file mode 100644 index 000000000..9be45adea --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr62294.h @@ -0,0 +1,3 @@ +#pragma GCC system_header +#define foo bar +extern void foo (float *); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c new file mode 100644 index 000000000..b3648757c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63186.c @@ -0,0 +1,30 @@ +/* { dg-do link } */ +/* { dg-options "-O2" } */ +void *a; +int b, c, d; + +void +bar () +{ + switch (c) + { + case 0: + lab: + __asm__ (""); + return; + default: + break; + } + b = 0; + d = 0; + a = &&lab; +} + +void +foo () +{ + bar (); +} +main() +{ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c new file mode 100644 index 000000000..dc7fc28b8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63284.c @@ -0,0 +1,42 @@ +/* PR debug/63284 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +int a[10], *b, *d, c, f; +int fn2 (void); +void fn3 (void); +void fn4 (int); + +static int +fn1 (int x) +{ + int e = a[0]; + if (e) + return 1; + if (b) + switch (x) + { + case 1: + if (d) + e = fn2 (); + else + fn3 (); + break; + case 0: + if (d) + { + fn3 (); + if (c) + fn4 (1); + } + else + fn4 (0); + } + return e; +} + +void +fn6 (void) +{ + f = fn1 (0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c new file mode 100644 index 000000000..499d508c1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63342.c @@ -0,0 +1,26 @@ +/* PR debug/63342 */ +/* { dg-do compile } */ +/* { dg-options "-g -O2" } */ +/* { dg-additional-options "-fpic" { target fpic } } */ + +static __thread double u[9], v[9]; + +void +foo (double **p, double **q) +{ + *p = u; + *q = v; +} + +double +bar (double x) +{ + int i; + double s = 0.0; + for (i = 0; i < 9; i++) + { + double a = x + v[i]; + s += u[i] * a * a; + } + return s; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c new file mode 100644 index 000000000..4fa199af7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63538.c @@ -0,0 +1,14 @@ +/* PR63538 is about not using 64-bit addresses for .lrodata accesses when it + involves STRING_CSTs. */ +/* { dg-do compile { target x86_64-*-* } } */ +/* { dg-options "-O2 -mcmodel=medium -mlarge-data-threshold=0" { target x86_64-*-* } } */ + +#include <stdio.h> + +const char *str = "Hello World"; + +int main() { + printf("str = %p %s\n",str, str); + return 0; +} +/* { dg-final { scan-assembler-not "movl" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c new file mode 100644 index 000000000..046ecae7c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr63665.c @@ -0,0 +1,18 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ +/* { dg-options "-O -fno-tree-ccp -fno-tree-fre -fno-tree-copy-prop -fwrapv" } */ + +static inline int +test5 (int x) +{ + int y = 0x80000000; + return x + y; +} + +int +main () +{ + if (test5 (0x80000000) != 0) + __builtin_abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c new file mode 100644 index 000000000..9a7982997 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64536.c @@ -0,0 +1,67 @@ +/* PR rtl-optimization/64536 */ +/* { dg-do link } */ +/* { dg-options "-O2" } */ +/* { dg-additional-options "-fPIC" { target fpic } } */ + +struct S { long q; } *h; +long a, b, g, j, k, *c, *d, *e, *f, *i; +long *baz (void) +{ + asm volatile ("" : : : "memory"); + return e; +} + +void +bar (int x) +{ + int y; + for (y = 0; y < x; y++) + { + switch (b) + { + case 0: + case 2: + a++; + break; + case 3: + a++; + break; + case 1: + a++; + } + if (d) + { + f = baz (); + g = k++; + if (&h->q) + { + j = *f; + h->q = *f; + } + else + i = (long *) (h->q = *f); + *c++ = (long) f; + e += 6; + } + else + { + f = baz (); + g = k++; + if (&h->q) + { + j = *f; + h->q = *f; + } + else + i = (long *) (h->q = *f); + *c++ = (long) f; + e += 6; + } + } +} + +int +main () +{ + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c b/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c new file mode 100644 index 000000000..7223349c4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/pr64563.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/64563 */ +/* { dg-do compile } */ +/* { dg-options "-Os -Wtype-limits" } */ + +int a, b, c, d, f; +unsigned int e; + +void +foo (void) +{ + d = b = (a != (e | 4294967288UL)); + if (!d) + c = f || b; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c b/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c new file mode 100644 index 000000000..235118aa3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tm/pr64391.c @@ -0,0 +1,10 @@ +/* PR middle-end/64391 */ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm" } */ + +void +foo (void) +{ +#pragma GCC ivdep + while (1); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c new file mode 100644 index 000000000..ea11f26e2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/float128-exact-underflow.c @@ -0,0 +1,41 @@ +/* Test that exact underflow in __float128 signals the underflow + exception if trapping is enabled, but does not raise the flag + otherwise. */ + +/* { dg-do run { target i?86-*-*gnu* x86_64-*-*gnu* } } */ +/* { dg-options "-D_GNU_SOURCE" } */ +/* { dg-require-effective-target fenv_exceptions } */ + +#include <fenv.h> +#include <setjmp.h> +#include <signal.h> +#include <stdlib.h> + +volatile sig_atomic_t caught_sigfpe; +sigjmp_buf buf; + +static void +handle_sigfpe (int sig) +{ + caught_sigfpe = 1; + siglongjmp (buf, 1); +} + +int +main (void) +{ + volatile __float128 a = 0x1p-16382q, b = 0x1p-2q; + volatile __float128 r; + r = a * b; + if (fetestexcept (FE_UNDERFLOW)) + abort (); + if (r != 0x1p-16384q) + abort (); + feenableexcept (FE_UNDERFLOW); + signal (SIGFPE, handle_sigfpe); + if (sigsetjmp (buf, 1) == 0) + r = a * b; + if (!caught_sigfpe) + abort (); + exit (0); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c new file mode 100644 index 000000000..f0dcef44b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62031.c @@ -0,0 +1,52 @@ +/* { dg-do run } */ + +#include <stdlib.h> + +#define NUM_OF_STATES 4 +typedef unsigned int entry_t[2]; +typedef struct entries_item { entry_t metricEntries_[0]; } entries_item_t; + +void __attribute__((noinline,noclone)) +test_00(size_t numOfStates, entries_item_t* p_bm, + const unsigned int* polyArray, + size_t polyArraySize) +{ + size_t idx; + unsigned int hlp0, hlp1; + for (idx = 0; idx < numOfStates; ++idx) + { + size_t idy; + + hlp0 = (idx << 1) | 0x00; + hlp1 = (idx << 1) | 0x01; + p_bm->metricEntries_[idx][0] = 0; + p_bm->metricEntries_[idx][1] = 0; + for (idy = 0; idy < polyArraySize; ++idy) + { + p_bm->metricEntries_[idx][0] + |= __builtin_parity(hlp0 & polyArray[idy]) << idy; + p_bm->metricEntries_[idx][1] + |= __builtin_parity(hlp1 & polyArray[idy]) << idy; + } + } +} + +int main() +{ + unsigned int polyArray[] = { 0x07, 0x05 }; + entries_item_t* pBranchMetrics; + pBranchMetrics = malloc(sizeof(entry_t) * NUM_OF_STATES); + test_00(NUM_OF_STATES, pBranchMetrics, polyArray, + sizeof(polyArray) / sizeof(polyArray[0])); + if (pBranchMetrics->metricEntries_[0][0] != 0 + || pBranchMetrics->metricEntries_[0][1] != 3 + || pBranchMetrics->metricEntries_[1][0] != 1 + || pBranchMetrics->metricEntries_[1][1] != 2 + || pBranchMetrics->metricEntries_[2][0] != 3 + || pBranchMetrics->metricEntries_[2][1] != 0 + || pBranchMetrics->metricEntries_[3][0] != 2 + || pBranchMetrics->metricEntries_[3][1] != 1) + abort (); + free(pBranchMetrics); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c new file mode 100644 index 000000000..de8951aae --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr62238.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +int a[4], b, c, d; + +int +fn1 (int p) +{ + for (; d; d++) + { + unsigned int h; + for (h = 0; h < 3; h++) + { + if (a[c+c+h]) + { + if (p) + break; + return 0; + } + b = 0; + } + } + return 0; +} + +int +main () +{ + fn1 (0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c new file mode 100644 index 000000000..29deface8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-1.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ + +int a = 0, b = 1, c = 0, d = 1, e, f, g, h; +int +main () +{ + e = 1 >> d; + f = ((31 / (1 > e)) || c) / 2; + g = b || a; + h = 31 / g; + if (!h) + __builtin_abort(); + return 0; +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c new file mode 100644 index 000000000..f4cbc43eb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63380-2.c @@ -0,0 +1,10 @@ +/* { dg-do run } */ + +int a = 0, b = 0, c = 0, d, e; +int +main (void) +{ + d = ((20 % (1 != b)) && c) + 2147483647; + e = 20 % (a >= 0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c new file mode 100644 index 000000000..06ede5461 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr63738.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ + +#include <setjmp.h> + +struct longjmp_buffer { + jmp_buf buf; +}; + +void plouf(); + +extern long interprete() +{ + long * sp; + int i; + long *args; + int n; + + struct longjmp_buffer raise_buf; + setjmp (raise_buf.buf); + + plouf(); + sp -= 4; + for (i = 0; i < n; i++) + args[i] = sp[10-i]; + plouf(); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c new file mode 100644 index 000000000..169993e6d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr64365.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-require-effective-target int32plus } */ + +extern void abort (void); +extern int memcmp (const void * , const void *, __SIZE_TYPE__); + +void __attribute__((noinline,noclone)) +foo(int *in) +{ + int i; + for (i = 62; i >= 10; i--) + { + in[i - 8] -= in[i]; + in[i - 5] += in[i] * 2; + in[i - 4] += in[i]; + } +} + +int main() +{ + int x[64]; + int y[64] = { 0, 1, -2380134, -1065336, -1026376, 3264240, 3113534, 2328130, 3632054, 3839634, 2380136, 1065339, 1026380, 1496037, 1397286, 789976, 386408, 450984, 597112, 497464, 262008, 149184, 194768, 231519, 173984, 87753, 60712, 82042, 87502, 60014, 30050, 25550, 33570, 32386, 20464, 10675, 10868, 13329, 11794, 6892, 3988, 4564, 5148, 4228, 2284, 1568, 1848, 1943, 1472, 741, 628, 702, 714, 474, 230, 234, 238, 242, 120, 59, 60, 61, 62, 63 }; + int i; + + for (i = 0; i < 64; ++i) + { + x[i] = i; + __asm__ volatile (""); + } + + foo (x); + + if (memcmp (x, y, sizeof (x)) != 0) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc index c50fa8e9d..d0cb7387c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc +++ b/gcc-4.9/gcc/testsuite/gcc.dg/torture/vshuf-4.inc @@ -23,7 +23,8 @@ T (19, 3, 2, 1, 0) \ T (20, 0, 4, 1, 5) \ T (21, 2, 6, 3, 7) \ T (22, 1, 2, 3, 0) \ -T (23, 2, 1, 0, 3) +T (23, 2, 1, 0, 3) \ +T (24, 2, 5, 6, 3) #define EXPTESTS \ T (116, 1, 2, 4, 3) \ T (117, 7, 3, 3, 0) \ @@ -31,7 +32,6 @@ T (118, 5, 3, 2, 7) \ T (119, 0, 3, 5, 6) \ T (120, 0, 0, 1, 5) \ T (121, 4, 6, 2, 1) \ -T (122, 2, 5, 6, 3) \ T (123, 4, 6, 3, 2) \ T (124, 4, 7, 5, 6) \ T (125, 0, 4, 2, 4) \ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c index a03aad7f6..643707f75 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_label.c @@ -35,4 +35,6 @@ main (int argc, char *argv[]) return 0; } +/* { dg-final-use { scan-assembler "foo\[._\]+cold\[\._\]+0" } } */ +/* { dg-final-use { scan-assembler "size\[ \ta-zA-Z0-0\]+foo\[._\]+cold\[\._\]+0" } } */ /* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c new file mode 100644 index 000000000..fe86963b7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/cold_partition_patch.c @@ -0,0 +1,37 @@ +/* Check if patching works with function splitting. */ +/* { dg-require-effective-target freorder } */ +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps " { target { ! x86_64-*-* } } } +/* { dg-options "-O2 -freorder-blocks-and-partition -save-temps -mpatch-functions-for-instrumentation -fno-optimize-sibling-calls " { target x86_64-*-* } } */ +#define SIZE 10000 + +const char *sarr[SIZE]; +const char *buf_hot; +const char *buf_cold; + +__attribute__((noinline)) +void +foo (int path) +{ + int i; + if (path) + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_hot; + } + else + { + for (i = 0; i < SIZE; i++) + sarr[i] = buf_cold; + } +} + +int +main (int argc, char *argv[]) +{ + buf_hot = "hello"; + buf_cold = "world"; + foo (argc); + return 0; +} + +/* { dg-final-use { cleanup-saved-temps } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c index ff103a8c5..a5aeffb17 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/ic-misattribution-1_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=lipo-sampling-period=1" } */ extern void callee (void); extern void caller (void (*func) (void)); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c index 29a216c69..8d78bb589 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof-single_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=1" } */ static int a1 (void) { diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c index 6bd048df6..3b681b2e5 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/lipo/indir-call-prof_0.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile --param=lipo-sampling-period=3" } */ extern void setp (int (**pp) (void), int i); diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c index c61b534a2..b61045b5e 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-1.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */ __attribute__ ((noinline)) int foo() diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c index 041134197..2f65d4e43 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-prof/time-profiler-2.c @@ -1,4 +1,4 @@ -/* { dg-options "-O2 -fdump-ipa-profile" } */ +/* { dg-options "-O2 -fdump-ipa-profile --param=profile-values-time=1" } */ #include <unistd.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c index 74b60a054..49163c243 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/loop-19.c @@ -4,7 +4,7 @@ The testcase comes from PR 29256 (and originally, the stream benchmark). */ -/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || powerpc_hard_double } } } } */ +/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || { powerpc_hard_double && { ! powerpc_fprs } } } } } } */ /* { dg-require-effective-target nonpic } */ /* { dg-options "-O3 -fno-tree-loop-distribute-patterns -fno-prefetch-loop-arrays -fdump-tree-optimized -fno-common" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c new file mode 100644 index 000000000..cd34b144e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/tree-ssa/pr61144.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ +static int dummy = 0; +extern int foo __attribute__((__weak__, __alias__("dummy"))); +int bar() { if (foo) return 1; return 0; } +/* { dg-final { scan-tree-dump-not "return 0" "optimized"} } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c index b9bef5f5b..db642812d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr25413a.c @@ -102,6 +102,7 @@ octfapg_alloc (const var_t n) return m; } +__attribute__((noinline)) oct_t* octfapg_universe (const var_t n) { diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c index 6c0b5880e..14a86ed2d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr59594.c @@ -3,7 +3,7 @@ #include "tree-vect.h" #define N 1024 -int b[N + 1]; +int b[N + 2]; int main () diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c new file mode 100644 index 000000000..10ed4afeb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-1.c @@ -0,0 +1,34 @@ +/* PR tree-optimization/63189 */ +/* { dg-additional-options "-fwrapv" } */ +/* { dg-do run } */ + +#include "tree-vect.h" + +__attribute__((noinline, noclone)) static int +bar (const short *a, int len) +{ + int x; + int x1 = 0; + + for (x = 0; x < len; x++) + x1 += x * a[x]; + return x1; +} + +__attribute__((noinline, noclone)) void +foo (void) +{ + short stuff[9] = {1, 1, 1, 1, 1, 1, 1, 1, 1 }; + if (bar (stuff, 9) != 36) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c new file mode 100644 index 000000000..b2059c20c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr60196-2.c @@ -0,0 +1,33 @@ +/* PR tree-optimization/63189 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +static const short a[8] = {1, 1, 1, 1, 1, 1, 1, 1 }; +static const unsigned char b[8] = {0, 0, 0, 0, 0, 0, 0, 0 }; + +__attribute__((noinline, noclone)) static int +bar (void) +{ + int sum = 0, i; + for (i = 0; i < 8; ++i) + sum += a[i] * b[i]; + return sum; +} + +__attribute__((noinline, noclone)) void +foo (void) +{ + if (bar () != 0) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c new file mode 100644 index 000000000..e0208e63b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62021.c @@ -0,0 +1,30 @@ +/* { dg-require-effective-target vect_simd_clones } */ +/* { dg-additional-options "-fopenmp-simd" } */ +/* { dg-additional-options "-mavx" { target avx_runtime } } */ + +#pragma omp declare simd linear(y) +__attribute__((noinline)) int * +foo (int *x, int y) +{ + return x + y; +} + +int a[1024]; +int *b[1024] = { &a[0] }; + +int +main () +{ + int i; + for (i = 0; i < 1024; i++) + b[i] = &a[1023 - i]; + #pragma omp simd + for (i = 0; i < 1024; i++) + b[i] = foo (b[i], i); + for (i = 0; i < 1024; i++) + if (b[i] != &a[1023]) + __builtin_abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c new file mode 100644 index 000000000..798490e87 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr62075.c @@ -0,0 +1,22 @@ +/* { dg-do compile } */ + +int a[16][2]; +struct A +{ + int b[16][2]; + int c[16][1]; +}; + +void +foo (struct A *x) +{ + int i; + for (i = 0; i < 16; ++i) + { + x->b[i][0] = a[i][0]; + x->c[i][0] = 0 != a[i][0]; + x->b[i][1] = a[i][1]; + } +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c new file mode 100644 index 000000000..da6fba4b1 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63189.c @@ -0,0 +1,26 @@ +/* PR tree-optimization/63189 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +short int d[16] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }; + +__attribute__((noinline, noclone)) void +foo (void) +{ + int j, s = 0; + for (j = 0; j < 8; j++) + s += d[j] * j; + if (s != 7) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c new file mode 100644 index 000000000..f6e8fc6a4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63379.c @@ -0,0 +1,43 @@ +/* PR tree-optimization/63379 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +extern void abort (void); + +typedef struct { + int x; + int y; +} Point; + +Point pt_array[25]; + +void __attribute__((noinline,noclone)) +generate_array(void) +{ + unsigned int i; + for (i = 0; i<25; i++) + { + pt_array[i].x = i; + pt_array[i].y = 1000+i; + } +} + +int main() +{ + check_vect (); + generate_array (); + Point min_pt = pt_array[0]; + Point *ptr, *ptr_end; + for (ptr = pt_array+1, ptr_end = pt_array+25; ptr != ptr_end; ++ptr) + { + min_pt.x = (min_pt.x < ptr->x) ? min_pt.x : ptr->x; + min_pt.y = (min_pt.y < ptr->y) ? min_pt.y : ptr->y; + } + + if (min_pt.x != 0 || min_pt.y != 1000) + abort (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c new file mode 100644 index 000000000..5096c7239 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63605.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ + +#include "tree-vect.h" + +extern void abort (void); + +int a, b[8] = { 2, 0, 0, 0, 0, 0, 0, 0 }, c[8]; + +int +main () +{ + int d; + check_vect (); + for (; a < 8; a++) + { + d = b[a] >> 1; + c[a] = d != 0; + } + if (c[0] != 1) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c index 854c9707a..6b5db9026 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/vect-109.c @@ -39,6 +39,7 @@ int main1 (int n) return 0; } +__attribute__ ((noinline)) int main2 (int n) { int i; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c index 2499ca665..56f3c8708 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/3c-01a.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ #include <altivec.h> typedef const volatile unsigned int _1; typedef const unsigned int _2; diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c index 547170679..bceb4fc8d 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops-long-1.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ /* Checks from the original ops.c that pass pointers to long or unsigned long for operations that support that in released versions diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c index b39ad1d65..21801ca23 100644 --- a/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vmx/ops.c @@ -1,4 +1,5 @@ /* { dg-do compile } */ +/* { dg-options "-maltivec -mabi=altivec -std=gnu99 -mno-vsx -Wno-deprecated" } */ #include <altivec.h> #include <stdlib.h> extern char * *var_char_ptr; diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c index 523941d47..321d8f002 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/madd_after_asm_1.c @@ -12,3 +12,17 @@ test (int a, double b, int c, int d, int e) ); return c * d + e; } +/* { dg-do assemble } */ +/* { dg-options "-O2 -mfix-cortex-a53-835769" } */ + +int +test (int a, double b, int c, int d, int e) +{ + double result; + __asm__ __volatile ("// %0, %1" + : "=w" (result) + : "0" (b) + : /* No clobbers */ + ); + return c * d + e; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62040.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62040.c index cfb4979f8..c6cae4d5b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62040.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62040.c @@ -19,3 +19,24 @@ foo () int32x4_t out = vtrn1q_s32 (xxx, xxx); bar (out); } +/* { dg-do compile } */ +/* { dg-options "-g -Os" } */ + +#include "arm_neon.h" + +extern void bar (int32x4_t); + +void +foo () +{ + int32x4x4_t rows; + uint64x2x2_t row01; + + row01.val[0] = vreinterpretq_u64_s32 (rows.val[0]); + row01.val[1] = vreinterpretq_u64_s32 (rows.val[1]); + uint64x1_t row3l = vget_low_u64 (row01.val[0]); + row01.val[0] = vcombine_u64 (vget_low_u64 (row01.val[1]), row3l); + int32x4_t xxx = vreinterpretq_s32_u64 (row01.val[0]); + int32x4_t out = vtrn1q_s32 (xxx, xxx); + bar (out); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62262.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62262.c index 5bf90bf7f..20763b499 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62262.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr62262.c @@ -18,3 +18,23 @@ int foo(int value) int packed = (unsigned)(value << 9) >> 9; return packed; } +/* { dg-do compile } */ +/* { dg-options "-O2 -fprofile-use" } */ + +static inline int CLZ(int mask) { + return mask ? __builtin_clz(mask) : 32; +} + +int foo(int value) +{ + if (value == 0) + return 0; + + int bias = CLZ(value); + value >>= bias; + int zeros = CLZ(value << 1); + value <<= zeros; + + int packed = (unsigned)(value << 9) >> 9; + return packed; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr63424.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr63424.c new file mode 100644 index 000000000..c6bd7626f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/pr63424.c @@ -0,0 +1,39 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +#include <stdint.h> + +uint32_t +truncate_int (const unsigned long long value) +{ + if ( value < 0 ) + { + return 0; + } + else if ( value > UINT32_MAX ) + { + return UINT32_MAX; + } + else + return (uint32_t)value; +} + +uint32_t +mul (const unsigned long long x, const unsigned long long y) +{ + uint32_t value = truncate_int (x * y); + return value; +} + +uint32_t * +test(unsigned size, uint32_t *a, uint32_t s) +{ + unsigned i; + + for (i = 0; i < size; i++) + { + a[i] = mul (a[i], s); + } + + return a; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c index 782f6d194..d1980bc19 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/scalar_intrinsics.c @@ -195,20 +195,20 @@ test_vcltzd_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "aarch64_get_lanev16qi" 2 } } */ -int8x1_t +int8_t test_vdupb_lane_s8 (int8x16_t a) { - int8x1_t res; + int8_t res; force_simd (a); res = vdupb_laneq_s8 (a, 2); force_simd (res); return res; } -uint8x1_t +uint8_t test_vdupb_lane_u8 (uint8x16_t a) { - uint8x1_t res; + uint8_t res; force_simd (a); res = vdupb_laneq_u8 (a, 2); force_simd (res); @@ -217,20 +217,20 @@ test_vdupb_lane_u8 (uint8x16_t a) /* { dg-final { scan-assembler-times "aarch64_get_lanev8hi" 2 } } */ -int16x1_t +int16_t test_vduph_lane_s16 (int16x8_t a) { - int16x1_t res; + int16_t res; force_simd (a); res = vduph_laneq_s16 (a, 2); force_simd (res); return res; } -uint16x1_t +uint16_t test_vduph_lane_u16 (uint16x8_t a) { - uint16x1_t res; + uint16_t res; force_simd (a); res = vduph_laneq_u16 (a, 2); force_simd (res); @@ -239,20 +239,20 @@ test_vduph_lane_u16 (uint16x8_t a) /* { dg-final { scan-assembler-times "aarch64_get_lanev4si" 2 } } */ -int32x1_t +int32_t test_vdups_lane_s32 (int32x4_t a) { - int32x1_t res; + int32_t res; force_simd (a); res = vdups_laneq_s32 (a, 2); force_simd (res); return res; } -uint32x1_t +uint32_t test_vdups_lane_u32 (uint32x4_t a) { - uint32x1_t res; + uint32_t res; force_simd (a); res = vdups_laneq_u32 (a, 2); force_simd (res); @@ -322,24 +322,24 @@ test_vqaddd_u64 (uint64x1_t a, uint64x1_t b) /* { dg-final { scan-assembler-times "\\tuqadd\\ts\[0-9\]+" 1 } } */ -uint32x1_t -test_vqadds_u32 (uint32x1_t a, uint32x1_t b) +uint32_t +test_vqadds_u32 (uint32_t a, uint32_t b) { return vqadds_u32 (a, b); } /* { dg-final { scan-assembler-times "\\tuqadd\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqaddh_u16 (uint16x1_t a, uint16x1_t b) +uint16_t +test_vqaddh_u16 (uint16_t a, uint16_t b) { return vqaddh_u16 (a, b); } /* { dg-final { scan-assembler-times "\\tuqadd\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqaddb_u8 (uint8x1_t a, uint8x1_t b) +uint8_t +test_vqaddb_u8 (uint8_t a, uint8_t b) { return vqaddb_u8 (a, b); } @@ -354,40 +354,40 @@ test_vqaddd_s64 (int64x1_t a, int64x1_t b) /* { dg-final { scan-assembler-times "\\tsqadd\\ts\[0-9\]+, s\[0-9\]+" 1 } } */ -int32x1_t -test_vqadds_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqadds_s32 (int32_t a, int32_t b) { return vqadds_s32 (a, b); } /* { dg-final { scan-assembler-times "\\tsqadd\\th\[0-9\]+, h\[0-9\]+" 1 } } */ -int16x1_t -test_vqaddh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqaddh_s16 (int16_t a, int16_t b) { return vqaddh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqadd\\tb\[0-9\]+, b\[0-9\]+" 1 } } */ -int8x1_t -test_vqaddb_s8 (int8x1_t a, int8x1_t b) +int8_t +test_vqaddb_s8 (int8_t a, int8_t b) { return vqaddb_s8 (a, b); } /* { dg-final { scan-assembler-times "\\tsqdmlal\\ts\[0-9\]+, h\[0-9\]+, h\[0-9\]+" 1 } } */ -int32x1_t -test_vqdmlalh_s16 (int32x1_t a, int16x1_t b, int16x1_t c) +int32_t +test_vqdmlalh_s16 (int32_t a, int16_t b, int16_t c) { return vqdmlalh_s16 (a, b, c); } /* { dg-final { scan-assembler-times "\\tsqdmlal\\ts\[0-9\]+, h\[0-9\]+, v" 1 } } */ -int32x1_t -test_vqdmlalh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) +int32_t +test_vqdmlalh_lane_s16 (int32_t a, int16_t b, int16x4_t c) { return vqdmlalh_lane_s16 (a, b, c, 3); } @@ -395,7 +395,7 @@ test_vqdmlalh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) /* { dg-final { scan-assembler-times "\\tsqdmlal\\td\[0-9\]+, s\[0-9\]+, s\[0-9\]+" 1 } } */ int64x1_t -test_vqdmlals_s32 (int64x1_t a, int32x1_t b, int32x1_t c) +test_vqdmlals_s32 (int64x1_t a, int32_t b, int32_t c) { return vqdmlals_s32 (a, b, c); } @@ -403,23 +403,23 @@ test_vqdmlals_s32 (int64x1_t a, int32x1_t b, int32x1_t c) /* { dg-final { scan-assembler-times "\\tsqdmlal\\td\[0-9\]+, s\[0-9\]+, v" 1 } } */ int64x1_t -test_vqdmlals_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +test_vqdmlals_lane_s32 (int64x1_t a, int32_t b, int32x2_t c) { return vqdmlals_lane_s32 (a, b, c, 1); } /* { dg-final { scan-assembler-times "\\tsqdmlsl\\ts\[0-9\]+, h\[0-9\]+, h\[0-9\]+" 1 } } */ -int32x1_t -test_vqdmlslh_s16 (int32x1_t a, int16x1_t b, int16x1_t c) +int32_t +test_vqdmlslh_s16 (int32_t a, int16_t b, int16_t c) { return vqdmlslh_s16 (a, b, c); } /* { dg-final { scan-assembler-times "\\tsqdmlsl\\ts\[0-9\]+, h\[0-9\]+, v" 1 } } */ -int32x1_t -test_vqdmlslh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) +int32_t +test_vqdmlslh_lane_s16 (int32_t a, int16_t b, int16x4_t c) { return vqdmlslh_lane_s16 (a, b, c, 3); } @@ -427,7 +427,7 @@ test_vqdmlslh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) /* { dg-final { scan-assembler-times "\\tsqdmlsl\\td\[0-9\]+, s\[0-9\]+, s\[0-9\]+" 1 } } */ int64x1_t -test_vqdmlsls_s32 (int64x1_t a, int32x1_t b, int32x1_t c) +test_vqdmlsls_s32 (int64x1_t a, int32_t b, int32_t c) { return vqdmlsls_s32 (a, b, c); } @@ -435,55 +435,55 @@ test_vqdmlsls_s32 (int64x1_t a, int32x1_t b, int32x1_t c) /* { dg-final { scan-assembler-times "\\tsqdmlsl\\td\[0-9\]+, s\[0-9\]+, v" 1 } } */ int64x1_t -test_vqdmlsls_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +test_vqdmlsls_lane_s32 (int64x1_t a, int32_t b, int32x2_t c) { return vqdmlsls_lane_s32 (a, b, c, 1); } /* { dg-final { scan-assembler-times "\\tsqdmulh\\th\[0-9\]+, h\[0-9\]+, h\[0-9\]+" 1 } } */ -int16x1_t -test_vqdmulhh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqdmulhh_s16 (int16_t a, int16_t b) { return vqdmulhh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqdmulh\\th\[0-9\]+, h\[0-9\]+, v" 1 } } */ -int16x1_t -test_vqdmulhh_lane_s16 (int16x1_t a, int16x4_t b) +int16_t +test_vqdmulhh_lane_s16 (int16_t a, int16x4_t b) { return vqdmulhh_lane_s16 (a, b, 3); } /* { dg-final { scan-assembler-times "\\tsqdmulh\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" 1 } } */ -int32x1_t -test_vqdmulhs_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqdmulhs_s32 (int32_t a, int32_t b) { return vqdmulhs_s32 (a, b); } /* { dg-final { scan-assembler-times "\\tsqdmulh\\ts\[0-9\]+, s\[0-9\]+, v" 1 } } */ -int32x1_t -test_vqdmulhs_lane_s32 (int32x1_t a, int32x2_t b) +int32_t +test_vqdmulhs_lane_s32 (int32_t a, int32x2_t b) { return vqdmulhs_lane_s32 (a, b, 1); } /* { dg-final { scan-assembler-times "\\tsqdmull\\ts\[0-9\]+, h\[0-9\]+, h\[0-9\]+" 1 } } */ -int32x1_t -test_vqdmullh_s16 (int16x1_t a, int16x1_t b) +int32_t +test_vqdmullh_s16 (int16_t a, int16_t b) { return vqdmullh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqdmull\\ts\[0-9\]+, h\[0-9\]+, v" 1 } } */ -int32x1_t -test_vqdmullh_lane_s16 (int16x1_t a, int16x4_t b) +int32_t +test_vqdmullh_lane_s16 (int16_t a, int16x4_t b) { return vqdmullh_lane_s16 (a, b, 3); } @@ -491,7 +491,7 @@ test_vqdmullh_lane_s16 (int16x1_t a, int16x4_t b) /* { dg-final { scan-assembler-times "\\tsqdmull\\td\[0-9\]+, s\[0-9\]+, s\[0-9\]+" 1 } } */ int64x1_t -test_vqdmulls_s32 (int32x1_t a, int32x1_t b) +test_vqdmulls_s32 (int32_t a, int32_t b) { return vqdmulls_s32 (a, b); } @@ -499,63 +499,63 @@ test_vqdmulls_s32 (int32x1_t a, int32x1_t b) /* { dg-final { scan-assembler-times "\\tsqdmull\\td\[0-9\]+, s\[0-9\]+, v" 1 } } */ int64x1_t -test_vqdmulls_lane_s32 (int32x1_t a, int32x2_t b) +test_vqdmulls_lane_s32 (int32_t a, int32x2_t b) { return vqdmulls_lane_s32 (a, b, 1); } /* { dg-final { scan-assembler-times "\\tsqrdmulh\\th\[0-9\]+, h\[0-9\]+, h\[0-9\]+" 1 } } */ -int16x1_t -test_vqrdmulhh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqrdmulhh_s16 (int16_t a, int16_t b) { return vqrdmulhh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqrdmulh\\th\[0-9\]+, h\[0-9\]+, v" 1 } } */ -int16x1_t -test_vqrdmulhh_lane_s16 (int16x1_t a, int16x4_t b) +int16_t +test_vqrdmulhh_lane_s16 (int16_t a, int16x4_t b) { return vqrdmulhh_lane_s16 (a, b, 3); } /* { dg-final { scan-assembler-times "\\tsqrdmulh\\ts\[0-9\]+, s\[0-9\]+, s\[0-9\]+" 1 } } */ -int32x1_t -test_vqrdmulhs_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqrdmulhs_s32 (int32_t a, int32_t b) { return vqrdmulhs_s32 (a, b); } /* { dg-final { scan-assembler-times "\\tsqrdmulh\\ts\[0-9\]+, s\[0-9\]+, v" 1 } } */ -int32x1_t -test_vqrdmulhs_lane_s32 (int32x1_t a, int32x2_t b) +int32_t +test_vqrdmulhs_lane_s32 (int32_t a, int32x2_t b) { return vqrdmulhs_lane_s32 (a, b, 1); } /* { dg-final { scan-assembler-times "\\tsuqadd\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vuqaddb_s8 (int8x1_t a, int8x1_t b) +int8_t +test_vuqaddb_s8 (int8_t a, int8_t b) { return vuqaddb_s8 (a, b); } /* { dg-final { scan-assembler-times "\\tsuqadd\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vuqaddh_s16 (int16x1_t a, int8x1_t b) +int16_t +test_vuqaddh_s16 (int16_t a, int8_t b) { return vuqaddh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsuqadd\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vuqadds_s32 (int32x1_t a, int8x1_t b) +int32_t +test_vuqadds_s32 (int32_t a, int8_t b) { return vuqadds_s32 (a, b); } @@ -563,31 +563,31 @@ test_vuqadds_s32 (int32x1_t a, int8x1_t b) /* { dg-final { scan-assembler-times "\\tsuqadd\\td\[0-9\]+" 1 } } */ int64x1_t -test_vuqaddd_s64 (int64x1_t a, int8x1_t b) +test_vuqaddd_s64 (int64x1_t a, int8_t b) { return vuqaddd_s64 (a, b); } /* { dg-final { scan-assembler-times "\\tusqadd\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vsqaddb_u8 (uint8x1_t a, int8x1_t b) +uint8_t +test_vsqaddb_u8 (uint8_t a, int8_t b) { return vsqaddb_u8 (a, b); } /* { dg-final { scan-assembler-times "\\tusqadd\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vsqaddh_u16 (uint16x1_t a, int8x1_t b) +uint16_t +test_vsqaddh_u16 (uint16_t a, int8_t b) { return vsqaddh_u16 (a, b); } /* { dg-final { scan-assembler-times "\\tusqadd\\ts\[0-9\]+" 1 } } */ -uint32x1_t -test_vsqadds_u32 (uint32x1_t a, int8x1_t b) +uint32_t +test_vsqadds_u32 (uint32_t a, int8_t b) { return vsqadds_u32 (a, b); } @@ -595,78 +595,78 @@ test_vsqadds_u32 (uint32x1_t a, int8x1_t b) /* { dg-final { scan-assembler-times "\\tusqadd\\td\[0-9\]+" 1 } } */ uint64x1_t -test_vsqaddd_u64 (uint64x1_t a, int8x1_t b) +test_vsqaddd_u64 (uint64x1_t a, int8_t b) { return vsqaddd_u64 (a, b); } /* { dg-final { scan-assembler-times "\\tsqabs\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqabsb_s8 (int8x1_t a) +int8_t +test_vqabsb_s8 (int8_t a) { return vqabsb_s8 (a); } /* { dg-final { scan-assembler-times "\\tsqabs\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqabsh_s16 (int16x1_t a) +int16_t +test_vqabsh_s16 (int16_t a) { return vqabsh_s16 (a); } /* { dg-final { scan-assembler-times "\\tsqabs\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vqabss_s32 (int32x1_t a) +int32_t +test_vqabss_s32 (int32_t a) { return vqabss_s32 (a); } /* { dg-final { scan-assembler-times "\\tsqneg\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqnegb_s8 (int8x1_t a) +int8_t +test_vqnegb_s8 (int8_t a) { return vqnegb_s8 (a); } /* { dg-final { scan-assembler-times "\\tsqneg\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqnegh_s16 (int16x1_t a) +int16_t +test_vqnegh_s16 (int16_t a) { return vqnegh_s16 (a); } /* { dg-final { scan-assembler-times "\\tsqneg\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vqnegs_s32 (int32x1_t a) +int32_t +test_vqnegs_s32 (int32_t a) { return vqnegs_s32 (a); } /* { dg-final { scan-assembler-times "\\tsqxtun\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqmovunh_s16 (int16x1_t a) +int8_t +test_vqmovunh_s16 (int16_t a) { return vqmovunh_s16 (a); } /* { dg-final { scan-assembler-times "\\tsqxtun\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqmovuns_s32 (int32x1_t a) +int16_t +test_vqmovuns_s32 (int32_t a) { return vqmovuns_s32 (a); } /* { dg-final { scan-assembler-times "\\tsqxtun\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqmovund_s64 (int64x1_t a) { return vqmovund_s64 (a); @@ -674,23 +674,23 @@ test_vqmovund_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tsqxtn\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqmovnh_s16 (int16x1_t a) +int8_t +test_vqmovnh_s16 (int16_t a) { return vqmovnh_s16 (a); } /* { dg-final { scan-assembler-times "\\tsqxtn\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqmovns_s32 (int32x1_t a) +int16_t +test_vqmovns_s32 (int32_t a) { return vqmovns_s32 (a); } /* { dg-final { scan-assembler-times "\\tsqxtn\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqmovnd_s64 (int64x1_t a) { return vqmovnd_s64 (a); @@ -698,23 +698,23 @@ test_vqmovnd_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tuqxtn\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqmovnh_u16 (uint16x1_t a) +uint8_t +test_vqmovnh_u16 (uint16_t a) { return vqmovnh_u16 (a); } /* { dg-final { scan-assembler-times "\\tuqxtn\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqmovns_u32 (uint32x1_t a) +uint16_t +test_vqmovns_u32 (uint32_t a) { return vqmovns_u32 (a); } /* { dg-final { scan-assembler-times "\\tuqxtn\\ts\[0-9\]+" 1 } } */ -uint32x1_t +uint32_t test_vqmovnd_u64 (uint64x1_t a) { return vqmovnd_u64 (a); @@ -753,24 +753,24 @@ test_vqsubd_u64 (uint64x1_t a, uint64x1_t b) /* { dg-final { scan-assembler-times "\\tuqsub\\ts\[0-9\]+" 1 } } */ -uint32x1_t -test_vqsubs_u32 (uint32x1_t a, uint32x1_t b) +uint32_t +test_vqsubs_u32 (uint32_t a, uint32_t b) { return vqsubs_u32 (a, b); } /* { dg-final { scan-assembler-times "\\tuqsub\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqsubh_u16 (uint16x1_t a, uint16x1_t b) +uint16_t +test_vqsubh_u16 (uint16_t a, uint16_t b) { return vqsubh_u16 (a, b); } /* { dg-final { scan-assembler-times "\\tuqsub\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqsubb_u8 (uint8x1_t a, uint8x1_t b) +uint8_t +test_vqsubb_u8 (uint8_t a, uint8_t b) { return vqsubb_u8 (a, b); } @@ -785,24 +785,24 @@ test_vqsubd_s64 (int64x1_t a, int64x1_t b) /* { dg-final { scan-assembler-times "\\tsqsub\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vqsubs_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqsubs_s32 (int32_t a, int32_t b) { return vqsubs_s32 (a, b); } /* { dg-final { scan-assembler-times "\\tsqsub\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqsubh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqsubh_s16 (int16_t a, int16_t b) { return vqsubh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqsub\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqsubb_s8 (int8x1_t a, int8x1_t b) +int8_t +test_vqsubb_s8 (int8_t a, int8_t b) { return vqsubb_s8 (a, b); } @@ -908,24 +908,24 @@ test_vrsrad_n_u64 (uint64x1_t a, uint64x1_t b) /* { dg-final { scan-assembler-times "\\tsqrshl\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqrshlb_s8 (int8x1_t a, int8x1_t b) +int8_t +test_vqrshlb_s8 (int8_t a, int8_t b) { return vqrshlb_s8 (a, b); } /* { dg-final { scan-assembler-times "\\tsqrshl\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqrshlh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqrshlh_s16 (int16_t a, int16_t b) { return vqrshlh_s16 (a, b); } /* { dg-final { scan-assembler-times "\\tsqrshl\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vqrshls_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqrshls_s32 (int32_t a, int32_t b) { return vqrshls_s32 (a, b); } @@ -940,24 +940,24 @@ test_vqrshld_s64 (int64x1_t a, int64x1_t b) /* { dg-final { scan-assembler-times "\\tuqrshl\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqrshlb_u8 (uint8x1_t a, uint8x1_t b) +uint8_t +test_vqrshlb_u8 (uint8_t a, uint8_t b) { return vqrshlb_u8 (a, b); } /* { dg-final { scan-assembler-times "\\tuqrshl\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqrshlh_u16 (uint16x1_t a, uint16x1_t b) +uint16_t +test_vqrshlh_u16 (uint16_t a, uint16_t b) { return vqrshlh_u16 (a, b); } /* { dg-final { scan-assembler-times "\\tuqrshl\\ts\[0-9\]+" 1 } } */ -uint32x1_t -test_vqrshls_u32 (uint32x1_t a, uint32x1_t b) +uint32_t +test_vqrshls_u32 (uint32_t a, uint32_t b) { return vqrshls_u32 (a, b); } @@ -972,24 +972,24 @@ test_vqrshld_u64 (uint64x1_t a, uint64x1_t b) /* { dg-final { scan-assembler-times "\\tsqshlu\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqshlub_n_s8 (int8x1_t a) +int8_t +test_vqshlub_n_s8 (int8_t a) { return vqshlub_n_s8 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqshlu\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqshluh_n_s16 (int16x1_t a) +int16_t +test_vqshluh_n_s16 (int16_t a) { return vqshluh_n_s16 (a, 4); } /* { dg-final { scan-assembler-times "\\tsqshlu\\ts\[0-9\]+" 1 } } */ -int32x1_t -test_vqshlus_n_s32 (int32x1_t a) +int32_t +test_vqshlus_n_s32 (int32_t a) { return vqshlus_n_s32 (a, 5); } @@ -1004,42 +1004,42 @@ test_vqshlud_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tsqshl\\tb\[0-9\]+" 2 } } */ -int8x1_t -test_vqshlb_s8 (int8x1_t a, int8x1_t b) +int8_t +test_vqshlb_s8 (int8_t a, int8_t b) { return vqshlb_s8 (a, b); } -int8x1_t -test_vqshlb_n_s8 (int8x1_t a) +int8_t +test_vqshlb_n_s8 (int8_t a) { return vqshlb_n_s8 (a, 2); } /* { dg-final { scan-assembler-times "\\tsqshl\\th\[0-9\]+" 2 } } */ -int16x1_t -test_vqshlh_s16 (int16x1_t a, int16x1_t b) +int16_t +test_vqshlh_s16 (int16_t a, int16_t b) { return vqshlh_s16 (a, b); } -int16x1_t -test_vqshlh_n_s16 (int16x1_t a) +int16_t +test_vqshlh_n_s16 (int16_t a) { return vqshlh_n_s16 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqshl\\ts\[0-9\]+" 2 } } */ -int32x1_t -test_vqshls_s32 (int32x1_t a, int32x1_t b) +int32_t +test_vqshls_s32 (int32_t a, int32_t b) { return vqshls_s32 (a, b); } -int32x1_t -test_vqshls_n_s32 (int32x1_t a) +int32_t +test_vqshls_n_s32 (int32_t a) { return vqshls_n_s32 (a, 4); } @@ -1060,42 +1060,42 @@ test_vqshld_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tuqshl\\tb\[0-9\]+" 2 } } */ -uint8x1_t -test_vqshlb_u8 (uint8x1_t a, uint8x1_t b) +uint8_t +test_vqshlb_u8 (uint8_t a, uint8_t b) { return vqshlb_u8 (a, b); } -uint8x1_t -test_vqshlb_n_u8 (uint8x1_t a) +uint8_t +test_vqshlb_n_u8 (uint8_t a) { return vqshlb_n_u8 (a, 2); } /* { dg-final { scan-assembler-times "\\tuqshl\\th\[0-9\]+" 2 } } */ -uint16x1_t -test_vqshlh_u16 (uint16x1_t a, uint16x1_t b) +uint16_t +test_vqshlh_u16 (uint16_t a, uint16_t b) { return vqshlh_u16 (a, b); } -uint16x1_t -test_vqshlh_n_u16 (uint16x1_t a) +uint16_t +test_vqshlh_n_u16 (uint16_t a) { return vqshlh_n_u16 (a, 3); } /* { dg-final { scan-assembler-times "\\tuqshl\\ts\[0-9\]+" 2 } } */ -uint32x1_t -test_vqshls_u32 (uint32x1_t a, uint32x1_t b) +uint32_t +test_vqshls_u32 (uint32_t a, uint32_t b) { return vqshls_u32 (a, b); } -uint32x1_t -test_vqshls_n_u32 (uint32x1_t a) +uint32_t +test_vqshls_n_u32 (uint32_t a) { return vqshls_n_u32 (a, 4); } @@ -1116,23 +1116,23 @@ test_vqshld_n_u64 (uint64x1_t a) /* { dg-final { scan-assembler-times "\\tsqshrun\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqshrunh_n_s16 (int16x1_t a) +int8_t +test_vqshrunh_n_s16 (int16_t a) { return vqshrunh_n_s16 (a, 2); } /* { dg-final { scan-assembler-times "\\tsqshrun\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqshruns_n_s32 (int32x1_t a) +int16_t +test_vqshruns_n_s32 (int32_t a) { return vqshruns_n_s32 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqshrun\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqshrund_n_s64 (int64x1_t a) { return vqshrund_n_s64 (a, 4); @@ -1140,23 +1140,23 @@ test_vqshrund_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tsqrshrun\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqrshrunh_n_s16 (int16x1_t a) +int8_t +test_vqrshrunh_n_s16 (int16_t a) { return vqrshrunh_n_s16 (a, 2); } /* { dg-final { scan-assembler-times "\\tsqrshrun\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqrshruns_n_s32 (int32x1_t a) +int16_t +test_vqrshruns_n_s32 (int32_t a) { return vqrshruns_n_s32 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqrshrun\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqrshrund_n_s64 (int64x1_t a) { return vqrshrund_n_s64 (a, 4); @@ -1164,23 +1164,23 @@ test_vqrshrund_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tsqshrn\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqshrnh_n_s16 (int16x1_t a) +int8_t +test_vqshrnh_n_s16 (int16_t a) { return vqshrnh_n_s16 (a, 2); } /* { dg-final { scan-assembler-times "\\tsqshrn\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqshrns_n_s32 (int32x1_t a) +int16_t +test_vqshrns_n_s32 (int32_t a) { return vqshrns_n_s32 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqshrn\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqshrnd_n_s64 (int64x1_t a) { return vqshrnd_n_s64 (a, 4); @@ -1188,23 +1188,23 @@ test_vqshrnd_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tuqshrn\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqshrnh_n_u16 (uint16x1_t a) +uint8_t +test_vqshrnh_n_u16 (uint16_t a) { return vqshrnh_n_u16 (a, 2); } /* { dg-final { scan-assembler-times "\\tuqshrn\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqshrns_n_u32 (uint32x1_t a) +uint16_t +test_vqshrns_n_u32 (uint32_t a) { return vqshrns_n_u32 (a, 3); } /* { dg-final { scan-assembler-times "\\tuqshrn\\ts\[0-9\]+" 1 } } */ -uint32x1_t +uint32_t test_vqshrnd_n_u64 (uint64x1_t a) { return vqshrnd_n_u64 (a, 4); @@ -1212,23 +1212,23 @@ test_vqshrnd_n_u64 (uint64x1_t a) /* { dg-final { scan-assembler-times "\\tsqrshrn\\tb\[0-9\]+" 1 } } */ -int8x1_t -test_vqrshrnh_n_s16 (int16x1_t a) +int8_t +test_vqrshrnh_n_s16 (int16_t a) { return vqrshrnh_n_s16 (a, 2); } /* { dg-final { scan-assembler-times "\\tsqrshrn\\th\[0-9\]+" 1 } } */ -int16x1_t -test_vqrshrns_n_s32 (int32x1_t a) +int16_t +test_vqrshrns_n_s32 (int32_t a) { return vqrshrns_n_s32 (a, 3); } /* { dg-final { scan-assembler-times "\\tsqrshrn\\ts\[0-9\]+" 1 } } */ -int32x1_t +int32_t test_vqrshrnd_n_s64 (int64x1_t a) { return vqrshrnd_n_s64 (a, 4); @@ -1236,23 +1236,23 @@ test_vqrshrnd_n_s64 (int64x1_t a) /* { dg-final { scan-assembler-times "\\tuqrshrn\\tb\[0-9\]+" 1 } } */ -uint8x1_t -test_vqrshrnh_n_u16 (uint16x1_t a) +uint8_t +test_vqrshrnh_n_u16 (uint16_t a) { return vqrshrnh_n_u16 (a, 2); } /* { dg-final { scan-assembler-times "\\tuqrshrn\\th\[0-9\]+" 1 } } */ -uint16x1_t -test_vqrshrns_n_u32 (uint32x1_t a) +uint16_t +test_vqrshrns_n_u32 (uint32_t a) { return vqrshrns_n_u32 (a, 3); } /* { dg-final { scan-assembler-times "\\tuqrshrn\\ts\[0-9\]+" 1 } } */ -uint32x1_t +uint32_t test_vqrshrnd_n_u64 (uint64x1_t a) { return vqrshrnd_n_u64 (a, 4); diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/sisd-shft-neg_1.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/sisd-shft-neg_1.c new file mode 100644 index 000000000..c091657cb --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/sisd-shft-neg_1.c @@ -0,0 +1,38 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fno-inline" } */ + +extern void abort (void); + +#define force_simd_si(v) asm volatile ("mov %s0, %1.s[0]" :"=w" (v) :"w" (v) :) + +unsigned int +shft_add (unsigned int a, unsigned int b) +{ + unsigned int c; + + force_simd_si (a); + force_simd_si (b); + c = a >> b; + force_simd_si (c); + + return c + b; +} + +int +main (void) +{ + unsigned int i = 0; + unsigned int a = 0xdeadbeef; + + for (i = 0; i < 32; i++) + { + unsigned int exp = (a / (1 << i) + i); + unsigned int got = shft_add (a, i); + + if (exp != got) + abort (); + } + + return 0; +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlalh_lane_s16.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlalh_lane_s16.c index 83f5af596..9ca041cb8 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlalh_lane_s16.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlalh_lane_s16.c @@ -5,8 +5,8 @@ #include "arm_neon.h" -int32x1_t -t_vqdmlalh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) +int32_t +t_vqdmlalh_lane_s16 (int32_t a, int16_t b, int16x4_t c) { return vqdmlalh_lane_s16 (a, b, c, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlals_lane_s32.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlals_lane_s32.c index ef94e95d9..40e4c9ff4 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlals_lane_s32.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlals_lane_s32.c @@ -6,7 +6,7 @@ #include "arm_neon.h" int64x1_t -t_vqdmlals_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +t_vqdmlals_lane_s32 (int64x1_t a, int32_t b, int32x2_t c) { return vqdmlals_lane_s32 (a, b, c, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlslh_lane_s16.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlslh_lane_s16.c index 056dfbb11..b3bbc951c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlslh_lane_s16.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlslh_lane_s16.c @@ -5,8 +5,8 @@ #include "arm_neon.h" -int32x1_t -t_vqdmlslh_lane_s16 (int32x1_t a, int16x1_t b, int16x4_t c) +int32_t +t_vqdmlslh_lane_s16 (int32_t a, int16_t b, int16x4_t c) { return vqdmlslh_lane_s16 (a, b, c, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlsls_lane_s32.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlsls_lane_s32.c index 9e351bc36..5bd643a24 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlsls_lane_s32.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmlsls_lane_s32.c @@ -6,7 +6,7 @@ #include "arm_neon.h" int64x1_t -t_vqdmlsls_lane_s32 (int64x1_t a, int32x1_t b, int32x2_t c) +t_vqdmlsls_lane_s32 (int64x1_t a, int32_t b, int32x2_t c) { return vqdmlsls_lane_s32 (a, b, c, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmullh_lane_s16.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmullh_lane_s16.c index fd271e0b3..c3761dfd0 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmullh_lane_s16.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmullh_lane_s16.c @@ -5,8 +5,8 @@ #include "arm_neon.h" -int32x1_t -t_vqdmullh_lane_s16 (int16x1_t a, int16x4_t b) +int32_t +t_vqdmullh_lane_s16 (int16_t a, int16x4_t b) { return vqdmullh_lane_s16 (a, b, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmulls_lane_s32.c b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmulls_lane_s32.c index 110333375..6ed8e3a0b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmulls_lane_s32.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/aarch64/vqdmulls_lane_s32.c @@ -6,7 +6,7 @@ #include "arm_neon.h" int64x1_t -t_vqdmulls_lane_s32 (int32x1_t a, int32x2_t b) +t_vqdmulls_lane_s32 (int32_t a, int32x2_t b) { return vqdmulls_lane_s32 (a, b, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c b/gcc-4.9/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c new file mode 100644 index 000000000..a523424c3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/avr/torture/pr63633-ice-mult.c @@ -0,0 +1,37 @@ +/* { dg-do compile } */ + +void ice_mult32 (int x) +{ + register long reg __asm ("22"); + __asm volatile (" " :: "r" (reg = 0x12345 * x)); +} + +void ice_mult24 (int x) +{ + register __int24 reg __asm ("20"); + __asm volatile (" " :: "r" (reg = 0x12345 * x)); +} + +void ice_sh24 (__int24 x) +{ + register __int24 reg __asm ("20"); + __asm volatile (" " :: "r" (reg = x << 3)); +} + +void ice_sh24b (__int24 x) +{ + register __int24 reg __asm ("20"); + __asm volatile (" " :: "r" (reg = x << 22)); +} + +void ice_s16s16 (int x) +{ + register long reg __asm ("20"); + __asm volatile (" " :: "r" (reg = (long) x*x)); +} + +void ice_u16s16 (int x) +{ + register long reg __asm ("20"); + __asm volatile (" " :: "r" (reg = (long) x*0x1234u)); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/h8300/h8300.exp b/gcc-4.9/gcc/testsuite/gcc.target/h8300/h8300.exp index 8523a1285..63579f603 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/h8300/h8300.exp +++ b/gcc-4.9/gcc/testsuite/gcc.target/h8300/h8300.exp @@ -39,44 +39,3 @@ dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ # All done. dg-finish -# Copyright (C) 2013-2014 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/>. - -# GCC testsuite that uses the `dg.exp' driver. - -# Exit immediately if this isn't a h8300 target. -if ![istarget h8300*-*-*] then { - return -} - -# Load support procs. -load_lib gcc-dg.exp - -# If a testcase doesn't have special options, use these. -global DEFAULT_CFLAGS -if ![info exists DEFAULT_CFLAGS] then { - set DEFAULT_CFLAGS " -ansi -pedantic-errors" -} - -# Initialize `dg'. -dg-init - -# Main loop. -dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \ - "" $DEFAULT_CFLAGS - -# All done. -dg-finish diff --git a/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr.c b/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr.c index 24fba30d8..41bd78ea6 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr.c @@ -18,23 +18,3 @@ isr2 (void) { foo (); } -/* Check whether rte is generated for two ISRs. */ -/* { dg-do compile { target h8300-*-* } } */ -/* { dg-options "-O3" } */ -/* { dg-final { scan-assembler-times "rte" 2} } */ - -extern void foo (void); - -#pragma interrupt -void -isr1 (void) -{ - foo (); -} - -#pragma interrupt -void -isr2 (void) -{ - foo (); -} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr2.c b/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr2.c index 7c242ec31..3d0a126b9 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr2.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/h8300/pragma-isr2.c @@ -19,24 +19,3 @@ main (void) { return 0; } -/* Check whether rte is generated only for an ISR. */ -/* { dg-do compile { target h8300-*-* } } */ -/* { dg-options "-O" } */ -/* { dg-final { scan-assembler-times "rte" 1 } } */ - -#pragma interrupt -void -isr (void) -{ -} - -void -delay (int a) -{ -} - -int -main (void) -{ - return 0; -} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-pr64286.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-pr64286.c new file mode 100644 index 000000000..2edb3210c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx2-pr64286.c @@ -0,0 +1,37 @@ +/* PR rtl-optimization/64286 */ +/* { dg-do run } */ +/* { dg-options "-O2 -mavx2" } */ +/* { dg-require-effective-target avx2 } */ + +#include <string.h> +#include <stdlib.h> +#include <x86intrin.h> +#include "avx2-check.h" + +__m128i v; +__m256i w; + +__attribute__((noinline, noclone)) void +foo (__m128i *p, __m128i *q) +{ + __m128i a = _mm_loadu_si128 (p); + __m128i b = _mm_xor_si128 (a, v); + w = _mm256_cvtepu8_epi16 (a); + *q = b; +} + +static void +avx2_test (void) +{ + v = _mm_set1_epi8 (0x40); + __m128i c = _mm_set_epi8 (16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1); + __m128i d; + foo (&c, &d); + __m128i e = _mm_set_epi8 (0x50, 0x4f, 0x4e, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, + 0x48, 0x47, 0x46, 0x45, 0x44, 0x43, 0x42, 0x41); + __m256i f = _mm256_set_epi16 (16, 15, 14, 13, 12, 11, 10, 9, + 8, 7, 6, 5, 4, 3, 2, 1); + if (memcmp (&w, &f, sizeof (w)) != 0 + || memcmp (&d, &e, sizeof (d)) != 0) + abort (); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c index ad16a5329..d8730dc09 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-load-7.c @@ -33,7 +33,7 @@ avx_test (void) cp = mp; dp = lp; - for (i = N; i >= 0; i--) + for (i = N; i > 0; i--) { *cp++ = str; *dp++ = str; @@ -44,13 +44,13 @@ avx_test (void) cp = mp; dp = lp; - for (i = N; i >= 0; i--) + for (i = N; i > 0; i--) { *ap++ = *cp++; *bp++ = *dp++; } - for (i = N; i >= 0; i--) + for (i = N; i > 0; i--) { if (strcmp (*--ap, "STR") != 0) abort (); diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c index 4272dc3cd..5ec14947f 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/avx256-unaligned-store-7.c @@ -29,13 +29,13 @@ avx_test (void) ap = ep; bp = fp; - for (i = N; i >= 0; i--) + for (i = N; i > 0; i--) { *ap++ = str; *bp++ = str; } - for (i = N; i >= 0; i--) + for (i = N; i > 0; i--) { if (strcmp (*--ap, "STR") != 0) abort (); diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/bmi2-bzhi-2.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/bmi2-bzhi-2.c new file mode 100644 index 000000000..34579d526 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/bmi2-bzhi-2.c @@ -0,0 +1,67 @@ +/* PR target/65368 */ +/* { dg-do assemble { target bmi2 } } */ +/* { dg-options "-O2 -mbmi2" } */ + +#include <x86intrin.h> +#include "bmi2-check.h" + +unsigned int a; +unsigned long long b; + +#define A __attribute__((noinline, noclone)) + +A unsigned int f1 (void) { return _bzhi_u32 (a, 0); } +A unsigned int f2 (unsigned int x) { return _bzhi_u32 (x, 0); } +A unsigned int f3 (void) { return _bzhi_u32 (a, 5); } +A unsigned int f4 (unsigned int x) { return _bzhi_u32 (x, 5); } +A unsigned int f5 (void) { return _bzhi_u32 (a, 31); } +A unsigned int f6 (unsigned int x) { return _bzhi_u32 (x, 31); } +A unsigned int f7 (void) { return _bzhi_u32 (a, 32); } +A unsigned int f8 (unsigned int x) { return _bzhi_u32 (x, 32); } +A unsigned int f9 (void) { return _bzhi_u32 (a, 37); } +A unsigned int f10 (unsigned int x) { return _bzhi_u32 (x, 37); } +A unsigned int f11 (void) { return _bzhi_u32 (a, 257); } +A unsigned int f12 (unsigned int x) { return _bzhi_u32 (x, 257); } +A unsigned int f13 (void) { return _bzhi_u32 (a, 289); } +A unsigned int f14 (unsigned int x) { return _bzhi_u32 (x, 289); } +#ifdef __x86_64__ +A unsigned long long f21 (void) { return _bzhi_u64 (b, 0); } +A unsigned long long f22 (unsigned long long x) { return _bzhi_u64 (x, 0); } +A unsigned long long f23 (void) { return _bzhi_u64 (b, 5); } +A unsigned long long f24 (unsigned long long x) { return _bzhi_u64 (x, 5); } +A unsigned long long f25 (void) { return _bzhi_u64 (b, 63); } +A unsigned long long f26 (unsigned long long x) { return _bzhi_u64 (x, 63); } +A unsigned long long f27 (void) { return _bzhi_u64 (b, 64); } +A unsigned long long f28 (unsigned long long x) { return _bzhi_u64 (x, 64); } +A unsigned long long f29 (void) { return _bzhi_u64 (b, 69); } +A unsigned long long f30 (unsigned long long x) { return _bzhi_u64 (x, 69); } +A unsigned long long f31 (void) { return _bzhi_u64 (b, 257); } +A unsigned long long f32 (unsigned long long x) { return _bzhi_u64 (x, 257); } +A unsigned long long f33 (void) { return _bzhi_u64 (b, 321); } +A unsigned long long f34 (unsigned long long x) { return _bzhi_u64 (x, 321); } +#endif + +static void +bmi2_test () +{ + a = -1U; + b = -1ULL; + if (f1 () != 0 || f2 (-1U) != 0 + || f3 () != 0x1f || f4 (-1U) != 0x1f + || f5 () != 0x7fffffffU || f6 (-1U) != 0x7fffffffU + || f7 () != -1U || f8 (-1U) != -1U + || f9 () != -1U || f10 (-1U) != -1U + || f11 () != 1 || f12 (-1U) != 1 + || f13 () != -1U || f14 (-1U) != -1U) + abort (); +#ifdef __x86_64__ + if (f21 () != 0 || f22 (-1ULL) != 0 + || f23 () != 0x1f || f24 (-1ULL) != 0x1f + || f25 () != 0x7fffffffffffffffULL || f26 (-1ULL) != 0x7fffffffffffffffULL + || f27 () != -1ULL || f28 (-1ULL) != -1ULL + || f29 () != -1ULL || f30 (-1ULL) != -1ULL + || f31 () != 1 || f32 (-1ULL) != 1 + || f33 () != -1ULL || f34 (-1ULL) != -1ULL) + abort (); +#endif +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c new file mode 100644 index 000000000..5c51248b5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/memcpy-strategy-4.c @@ -0,0 +1,21 @@ +/* PR target/64200 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=atom -mmemcpy-strategy=libcall:-1:align -minline-stringops-dynamically" } */ + +#include <stdarg.h> + +extern void bar(char *x); + +void foo (int size, ...) +{ + struct + { + char x[size]; + } d; + + va_list ap; + va_start(ap, size); + d = va_arg(ap, typeof (d)); + va_end(ap); + bar(d.x); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/memset-strategy-2.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/memset-strategy-2.c new file mode 100644 index 000000000..aafa54d00 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/memset-strategy-2.c @@ -0,0 +1,10 @@ +/* PR target/64108 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -march=atom -mmemset-strategy=libcall:-1:align -minline-all-stringops" } */ + +char a[2048]; +void t (void) +{ + __builtin_memset (a, 1, 2048); +} + diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-1.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-1.c new file mode 100644 index 000000000..d9e5d6ea7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-1.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target x86_64-*-linux* } } */ +/* { dg-options "-fno-pic" } */ + +__attribute__ ((noplt)) +void foo(); + +int main() +{ + foo(); + return 0; +} + +/* { dg-final { scan-assembler "call\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\)" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-2.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-2.c new file mode 100644 index 000000000..4df0618b6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-2.c @@ -0,0 +1,13 @@ +/* { dg-do compile { target x86_64-*-linux* } } */ +/* { dg-options "-O2 -fno-pic" } */ + + +__attribute__ ((noplt)) +int foo(); + +int main() +{ + return foo(); +} + +/* { dg-final { scan-assembler "jmp\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\)" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-3.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-3.c new file mode 100644 index 000000000..e2a6f9386 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-3.c @@ -0,0 +1,12 @@ +/* { dg-do compile { target x86_64-*-linux* } } */ +/* { dg-options "-fno-pic -fno-plt" } */ + +void foo(); + +int main() +{ + foo(); + return 0; +} + +/* { dg-final { scan-assembler "call\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\)" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-4.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-4.c new file mode 100644 index 000000000..d9039dd77 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/noplt-4.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target x86_64-*-linux* } } */ +/* { dg-options "-O2 -fno-pic -fno-plt" } */ + +int foo(); + +int main() +{ + return foo(); +} + +/* { dg-final { scan-assembler "jmp\[ \t\]\\*.*foo.*@GOTPCREL\\(%rip\\)" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-1.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-1.c index ae339bd9e..7af851bde 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-1.c @@ -1,6 +1,7 @@ -/* Test if -mcopyrelocs does the right thing. */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fpie -mcopyrelocs" } */ +/* Check that GOTPCREL isn't used to access glob_a. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-require-effective-target pie_copyreloc } */ +/* { dg-options "-O2 -fpie" } */ extern int glob_a; @@ -9,5 +10,5 @@ int foo () return glob_a; } -/* glob_a should never be accessed with a GOTPCREL */ -/* { dg-final { scan-assembler-not "glob_a\\@GOTPCREL" { target { x86_64-*-* } } } } */ +/* glob_a should never be accessed with a GOTPCREL. */ +/* { dg-final { scan-assembler-not "glob_a@GOTPCREL" { target { ! ia32 } } } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-2.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-2.c index ed60d0329..19cb97e88 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-2.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-2.c @@ -1,13 +1,14 @@ -/* Test if -mno-copyrelocs does the right thing. */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fpie -mno-copyrelocs" } */ +/* Check that GOTPCREL isn't used to access glob_a. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-require-effective-target pie_copyreloc } */ +/* { dg-options "-O2 -fpie" } */ -extern int glob_a; +int glob_a; int foo () { return glob_a; } -/* glob_a should always be accessed via GOT */ -/* { dg-final { scan-assembler "glob_a\\@GOT" { target { x86_64-*-* } } } } */ +/* glob_a should never be accessed with a GOTPCREL. */ +/* { dg-final { scan-assembler-not "glob_a@GOTPCREL" { target { ! ia32 } } } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-3.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-3.c new file mode 100644 index 000000000..c2fa8968e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-3.c @@ -0,0 +1,14 @@ +/* Check that PLT is used to access glob_a. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-require-effective-target pie_copyreloc } */ +/* { dg-options "-O2 -fpie" } */ + +extern int glob_a (void); + +int foo () +{ + return glob_a (); +} + +/* glob_a should be accessed with a PLT. */ +/* { dg-final { scan-assembler "glob_a@PLT" { target { ! ia32 } } } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c new file mode 100644 index 000000000..413cdf381 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pie-copyrelocs-4.c @@ -0,0 +1,17 @@ +/* Check that GOTPCREL is used to access glob_a. */ +/* { dg-do compile { target *-*-linux* } } */ +/* { dg-require-effective-target pie_copyreloc } */ +/* { dg-options "-O2 -fpie" } */ + +extern int glob_a __attribute__((weak)); + +int foo () +{ + if (&glob_a != 0) + return glob_a; + else + return 0; +} + +/* weak glob_a should be accessed with a GOTPCREL. */ +/* { dg-final { scan-assembler "glob_a@GOTPCREL" { target { ! ia32 } } } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr57003.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr57003.c index dfa6b8b50..08a743dda 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr57003.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr57003.c @@ -1,5 +1,5 @@ /* PR rtl-optimization/57003 */ -/* { dg-do run } */ +/* { dg-do run { target { ! x32 } } } */ /* { dg-options "-O2" } */ #define N 2001 diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59927.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59927.c index 693c76595..afb53069b 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59927.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr59927.c @@ -1,5 +1,5 @@ /* PR target/59927 */ -/* { dg-do compile } */ +/* { dg-do compile { target { ! x32 } } } */ /* { dg-options "-O2 -g" } */ extern void baz (int) __attribute__ ((__ms_abi__)); diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr60516.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr60516.c index 575c8b61d..d7e11161c 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr60516.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr60516.c @@ -1,5 +1,5 @@ /* PR target/60516 */ -/* { dg-do compile } */ +/* { dg-do compile { target { ! x32 } } } */ /* { dg-options "-O2" } */ struct S { char c[65536]; }; diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63285.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63285.c new file mode 100644 index 000000000..e4df8fb92 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63285.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +struct S { int a; }; +struct T { int b, c; } a; +long b; +int c, d; +void bar (int, int); +void baz (void *, int); + +void +foo (struct S *x, int y, int z, void *f, int *p, struct T *e) +{ + while (x) + { + baz (f, &d > p); + if (z & 1) + bar (f > (void *) &f, z); + } + if (c) + { + asm ("" : "+m" (a) : "i" (0)); + y--; + } + if (e->b == e->c) + c = y; + y--; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63448.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63448.c new file mode 100644 index 000000000..3f8262e87 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63448.c @@ -0,0 +1,120 @@ +/* PR rtl-optimization/63448 */ +/* { dg-do compile } */ +/* { dg-options "-O -std=c99" } */ + +int a, d, e, g, h, j; +float b, c, k, l, m, n; +int *__restrict i; +void +foo (void) +{ + int o = e; + int *p; + float *q, *r = (float *) 0x1234000; + float s, t, u, v, w, x; + do + { + for (a = o; a; a--) + { + s += m; + t += n; + u += m; + v += n; + w += d; + x += d; + n = l; + s += r[1]; + t += n; + v += r[1]; + m = k * r[4]; + n = q[0] * r[4]; + s += m; + m = q[1] * r[4]; + t += n; + q += g; + k = *q; + n = q[1] * r[4]; + s += m; + t += n; + u += r[4]; + m = q[8] * r[4]; + q += 1; + n = q[1] * r[4]; + s += m; + m = q[4]; + t += n; + q += g; + w += m; + m = k * r[4]; + s += m; + t += q[0]; + m = q[1] * r[4]; + v += q[0]; + n = q[10] * r[4]; + s += m; + t += n; + u += b; + m = q[8] * r[4]; + n = q[2] * r[4]; + s += m; + m = q[4] * r[4]; + t += n; + q++; + n = q[2] * r[16]; + s += m; + m = q[4]; + t += n; + s += m; + t += r[6]; + q += g; + k = *q; + w += m; + m = k * r[20]; + x += r[16]; + n = q[1] * r[20]; + s += m; + t += n; + q += g; + k = *q; + w += m; + m = k * r[2]; + n = q[1] * r[22]; + s += m; + m = q[4]; + t += n; + q += g; + s += m; + t += q[0]; + s += m; + u += m; + n = q[1] * r[22]; + s += m; + m = q[4] * r[22]; + t += n; + q += g; + k = 1; + w += m; + c = q[10]; + x += r[22]; + s += m; + t += r[22]; + u += m; + v += r[22]; + n = q[10] * r[30]; + d = r[32]; + l = q[1]; + b = 0; + w += m; + m = r[32]; + x += n; + r = 0; + } + *i = s; + p[0] = t; + p[1] = u; + p[6] = v; + p[8] = w; + p[10] = x; + } + while (j); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63495.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63495.c new file mode 100644 index 000000000..7f02f37d8 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63495.c @@ -0,0 +1,6 @@ +/* PR c/63495 */ +/* { dg-do compile { target { i?86-*-linux* x86_64-*-linux* } } } */ +/* { dg-options "-std=gnu11" } */ + +struct __attribute__ ((aligned (8))) S { char c; }; +_Static_assert (_Alignof (struct S) >= 8, "wrong alignment"); diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63538.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63538.c new file mode 100644 index 000000000..7b979c35d --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63538.c @@ -0,0 +1,13 @@ +/* PR target/63538 */ +/* { dg-do compile } */ +/* { dg-require-effective-target lp64 } */ +/* { dg-options "-O2 -mcmodel=medium -mlarge-data-threshold=0" } */ + +static char *str = "Hello World"; + +char *foo () +{ + return str; +} + +/* { dg-final { scan-assembler "movabs" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63661.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63661.c new file mode 100644 index 000000000..a5ffd2f4f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63661.c @@ -0,0 +1,80 @@ +/* PR target/63661 */ +/* { dg-do run } */ +/* { dg-require-effective-target fpic } */ +/* { dg-options "-mtune=nehalem -fPIC -O2" } */ + +static void __attribute__((noinline,noclone,hot)) +foo (double a, double q, double *ff, double *gx, int e, int ni) +{ + union + { + double n; + unsigned long long o; + } punner; + double d; + + punner.n = q; + __builtin_printf("B: 0x%016llx ---- %g\n", punner.o, q); + + d = q - 5; + if(d < 0) + d = -d; + if (d > 0.1) + __builtin_abort(); +} + +static int __attribute__((noinline,noclone,hot)) +bar (int order, double q, double c[]) +{ + int ni, nn, i, e; + double g2, x2, de, s, ratio, ff; + + nn = 0; + e = order & 1; + s = 0; + ratio = 0; + x2 = 0; + g2 = 0; + + if(q == 0.0) + return 0; + + if (order < 5) + { + ratio = 1.0 / q; + nn = order; + } + + ni = -nn; + + while(1) + { + de = ratio - g2 - x2; + + foo (0, q, &ff, &g2, e, ni); + + if((int)de == 0) + break; + } + + s += 2 * nn * c[nn]; + + for (i = 0; i < 1; i++) + { + c[0] = nn; + for (; i < 10; i++) + c[i] = 0.0; + c[0] /= s; + } + + return 0; +} + +int +main () +{ + double c[1000]; + + bar (1, 5.0, c); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63947.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63947.c new file mode 100644 index 000000000..3c0a67a73 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63947.c @@ -0,0 +1,9 @@ +/* PR target/63947 */ +/* { dg-do assemble } */ +/* { dg-options "-Os" } */ +/* { dg-additional-options "-march=i686" { target ia32 } } */ + +long double foo (unsigned a, unsigned b) +{ + return a + b < a; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64409.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64409.c new file mode 100644 index 000000000..6a64b5961 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64409.c @@ -0,0 +1,6 @@ +/* { dg-do compile { target { ! { ia32 } } } } */ +/* { dg-require-effective-target maybe_x32 } */ +/* { dg-options "-O0 -mx32" } */ + +int a; +int* __attribute__ ((ms_abi)) fn1 () { return &a; } /* { dg-error "X32 does not support ms_abi attribute" } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64513.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64513.c new file mode 100644 index 000000000..023649609 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr64513.c @@ -0,0 +1,17 @@ +/* PR target/64513 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mstack-arg-probe" } */ + +struct A {}; +struct B { struct A y; }; +int foo (struct A); + +int +bar (int x) +{ + struct B b; + int c; + while (x--) + c = foo (b.y); + return c; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-20.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-20.c index b2c29a979..1af8ed7dc 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-20.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-20.c @@ -1,5 +1,5 @@ /* { dg-do compile { target powerpc_altivec_ok } } */ -/* { dg-options "-maltivec -mcpu=G5 -O2" } */ +/* { dg-options "-maltivec -mcpu=G5 -O2 -Wno-deprecated" } */ #include <altivec.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-6.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-6.c index 51d411688..29856fd07 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-6.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-6.c @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -O0 -Wall" } */ +/* { dg-options "-maltivec -O0 -Wall -Wno-deprecated" } */ #include <altivec.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c index 3689f9749..b1ed8b864 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/altivec-vec-merge.c @@ -1,7 +1,7 @@ /* { dg-do run { target { powerpc*-*-* && vmx_hw } } } */ /* { dg-do compile { target { powerpc*-*-* && { ! vmx_hw } } } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -O2" } */ +/* { dg-options "-maltivec -O2 -Wno-deprecated" } */ #include <altivec.h> diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-1.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-1.c new file mode 100644 index 000000000..3da714698 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-1.c @@ -0,0 +1,166 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-options "-mcpu=power8 -O0" } */ + +/* Test that a number of newly added builtin overloads are accepted + by the compiler. */ + +#include <altivec.h> + +vector double y = { 2.0, 4.0 }; +vector double z; + +int main () +{ + vector float fa = {1.0, 2.0, 3.0, -4.0}; + vector float fb = {-2.0, -3.0, -4.0, -5.0}; + vector float fc = vec_cpsgn (fa, fb); + + vector long long la = {5L, 14L}; + vector long long lb = {3L, 86L}; + vector long long lc = vec_and (la, lb); + vector bool long long ld = {0, -1}; + vector long long le = vec_and (la, ld); + vector long long lf = vec_and (ld, lb); + + vector unsigned long long ua = {5L, 14L}; + vector unsigned long long ub = {3L, 86L}; + vector unsigned long long uc = vec_and (ua, ub); + vector bool long long ud = {0, -1}; + vector unsigned long long ue = vec_and (ua, ud); + vector unsigned long long uf = vec_and (ud, ub); + + vector long long lg = vec_andc (la, lb); + vector long long lh = vec_andc (la, ld); + vector long long li = vec_andc (ld, lb); + + vector unsigned long long ug = vec_andc (ua, ub); + vector unsigned long long uh = vec_andc (ua, ud); + vector unsigned long long ui = vec_andc (ud, ub); + + vector double da = {1.0, -4.0}; + vector double db = {-2.0, 5.0}; + vector double dc = vec_cpsgn (da, db); + + vector long long lj = vec_mergeh (la, lb); + vector long long lk = vec_mergeh (la, ld); + vector long long ll = vec_mergeh (ld, la); + + vector unsigned long long uj = vec_mergeh (ua, ub); + vector unsigned long long uk = vec_mergeh (ua, ud); + vector unsigned long long ul = vec_mergeh (ud, ua); + + vector long long lm = vec_mergel (la, lb); + vector long long ln = vec_mergel (la, ld); + vector long long lo = vec_mergel (ld, la); + + vector unsigned long long um = vec_mergel (ua, ub); + vector unsigned long long un = vec_mergel (ua, ud); + vector unsigned long long uo = vec_mergel (ud, ua); + + vector long long lp = vec_nor (la, lb); + vector long long lq = vec_nor (la, ld); + vector long long lr = vec_nor (ld, la); + + vector unsigned long long up = vec_nor (ua, ub); + vector unsigned long long uq = vec_nor (ua, ud); + vector unsigned long long ur = vec_nor (ud, ua); + + vector long long ls = vec_or (la, lb); + vector long long lt = vec_or (la, ld); + vector long long lu = vec_or (ld, la); + + vector unsigned long long us = vec_or (ua, ub); + vector unsigned long long ut = vec_or (ua, ud); + vector unsigned long long uu = vec_or (ud, ua); + + vector unsigned char ca = {0,4,8,1,5,9,2,6,10,3,7,11,15,12,14,13}; + vector long long lv = vec_perm (la, lb, ca); + vector unsigned long long uv = vec_perm (ua, ub, ca); + + vector long long lw = vec_sel (la, lb, lc); + vector long long lx = vec_sel (la, lb, uc); + vector long long ly = vec_sel (la, lb, ld); + + vector unsigned long long uw = vec_sel (ua, ub, lc); + vector unsigned long long ux = vec_sel (ua, ub, uc); + vector unsigned long long uy = vec_sel (ua, ub, ld); + + vector long long lz = vec_xor (la, lb); + vector long long l0 = vec_xor (la, ld); + vector long long l1 = vec_xor (ld, la); + + vector unsigned long long uz = vec_xor (ua, ub); + vector unsigned long long u0 = vec_xor (ua, ud); + vector unsigned long long u1 = vec_xor (ud, ua); + + int ia = vec_all_eq (ua, ub); + int ib = vec_all_ge (ua, ub); + int ic = vec_all_gt (ua, ub); + int id = vec_all_le (ua, ub); + int ie = vec_all_lt (ua, ub); + int ig = vec_all_ne (ua, ub); + + int ih = vec_any_eq (ua, ub); + int ii = vec_any_ge (ua, ub); + int ij = vec_any_gt (ua, ub); + int ik = vec_any_le (ua, ub); + int il = vec_any_lt (ua, ub); + int im = vec_any_ne (ua, ub); + + vector int sia = {9, 16, 25, 36}; + vector int sib = {-8, -27, -64, -125}; + vector int sic = vec_mergee (sia, sib); + vector int sid = vec_mergeo (sia, sib); + + vector unsigned int uia = {9, 16, 25, 36}; + vector unsigned int uib = {8, 27, 64, 125}; + vector unsigned int uic = vec_mergee (uia, uib); + vector unsigned int uid = vec_mergeo (uia, uib); + + vector bool int bia = {0, -1, -1, 0}; + vector bool int bib = {-1, -1, 0, -1}; + vector bool int bic = vec_mergee (bia, bib); + vector bool int bid = vec_mergeo (bia, bib); + + vector unsigned int uie = vec_packsu (ua, ub); + + vector long long l2 = vec_cntlz (la); + vector unsigned long long u2 = vec_cntlz (ua); + vector int sie = vec_cntlz (sia); + vector unsigned int uif = vec_cntlz (uia); + vector short ssa = {20, -40, -60, 80, 100, -120, -140, 160}; + vector short ssb = vec_cntlz (ssa); + vector unsigned short usa = {81, 72, 63, 54, 45, 36, 27, 18}; + vector unsigned short usb = vec_cntlz (usa); + vector signed char sca = {-4, 3, -9, 15, -31, 31, 0, 0, + 1, 117, -36, 99, 98, 97, 96, 95}; + vector signed char scb = vec_cntlz (sca); + vector unsigned char cb = vec_cntlz (ca); + + vector double dd = vec_xl (0, &y); + vec_xst (dd, 0, &z); + + vector double de = vec_round (dd); + + vector double df = vec_splat (de, 0); + vector double dg = vec_splat (de, 1); + vector long long l3 = vec_splat (l2, 0); + vector long long l4 = vec_splat (l2, 1); + vector unsigned long long u3 = vec_splat (u2, 0); + vector unsigned long long u4 = vec_splat (u2, 1); + vector bool long long l5 = vec_splat (ld, 0); + vector bool long long l6 = vec_splat (ld, 1); + + vector long long l7 = vec_div (l3, l4); + vector unsigned long long u5 = vec_div (u3, u4); + + vector long long l8 = vec_mul (l3, l4); + vector unsigned long long u6 = vec_mul (u3, u4); + + vector double dh = vec_ctf (la, -2); + vector double di = vec_ctf (ua, 2); + vector long long l9 = vec_cts (dh, -2); + vector unsigned long long u7 = vec_ctu (di, 2); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-2.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-2.c new file mode 100644 index 000000000..7f4a3924e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/builtins-2.c @@ -0,0 +1,47 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-options "-mcpu=power8 " } */ + +#include <altivec.h> + +void abort (void); + +int main () +{ + vector long long sa = {27L, -14L}; + vector long long sb = {-9L, -2L}; + + vector unsigned long long ua = {27L, 14L}; + vector unsigned long long ub = {9L, 2L}; + + vector long long sc = vec_div (sa, sb); + vector unsigned long long uc = vec_div (ua, ub); + + if (sc[0] != -3L || sc[1] != 7L || uc[0] != 3L || uc[1] != 7L) + abort (); + + vector long long sd = vec_mul (sa, sb); + vector unsigned long long ud = vec_mul (ua, ub); + + if (sd[0] != -243L || sd[1] != 28L || ud[0] != 243L || ud[1] != 28L) + abort (); + + vector long long se = vec_splat (sa, 0); + vector long long sf = vec_splat (sa, 1); + vector unsigned long long ue = vec_splat (ua, 0); + vector unsigned long long uf = vec_splat (ua, 1); + + if (se[0] != 27L || se[1] != 27L || sf[0] != -14L || sf[1] != -14L + || ue[0] != 27L || ue[1] != 27L || uf[0] != 14L || uf[1] != 14L) + abort (); + + vector double da = vec_ctf (sa, -2); + vector double db = vec_ctf (ua, 2); + vector long long sg = vec_cts (da, -2); + vector unsigned long long ug = vec_ctu (db, 2); + + if (da[0] != 108.0 || da[1] != -56.0 || db[0] != 6.75 || db[1] != 3.5 + || sg[0] != 27L || sg[1] != -14L || ug[0] != 27L || ug[1] != 14L) + abort (); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c new file mode 100644 index 000000000..71dd0a24a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/lvsl-lvsr.c @@ -0,0 +1,21 @@ +/* Test expected code generation for lvsl and lvsr on little endian. + Note that lvsl and lvsr are each produced once, but the filename + causes them to appear twice in the file. */ + +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-options "-O0 -Wno-deprecated" } */ +/* { dg-final { scan-assembler-times "lvsl" 2 } } */ +/* { dg-final { scan-assembler-times "lvsr" 2 } } */ +/* { dg-final { scan-assembler-times "lxvd2x" 2 } } */ +/* { dg-final { scan-assembler-times "vperm" 2 } } */ + + +#include <altivec.h> + +float f[20]; + +void foo () +{ + vector unsigned char a = vec_lvsl (4, f); + vector unsigned char b = vec_lvsr (8, f); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr63335.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr63335.c new file mode 100644 index 000000000..931a8b6e9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr63335.c @@ -0,0 +1,30 @@ +/* { dg-do run { target { powerpc64*-*-* } } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-mvsx" } */ + +#include <altivec.h> + +void abort (void); + +vector double vec = (vector double) {99.0, 99.0}; + +int main() { + + int actual = vec_all_nge(vec, vec); + if ( actual != 0) + abort(); + + actual = vec_all_nle(vec, vec); + if ( actual != 0) + abort(); + + actual = vec_any_nge(vec, vec); + if ( actual != 0) + abort(); + + actual = vec_any_nle(vec, vec); + if ( actual != 0) + abort(); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr64505.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr64505.c new file mode 100644 index 000000000..99916216a --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/pr64505.c @@ -0,0 +1,231 @@ +/* { dg-do compile { target { powerpc*-*-* && ilp32 } } } */ +/* { dg-options "-O2 -mpowerpc64" } */ + +/* + * (below is inlined and simplified from previously included headers) + */ + +struct fltcom_st { + short fltbuf[950]; +} fltcom_ __attribute__((common)) ; +#define CM_PLIBOR (*(((double *)&fltcom_ + 1))) +#define CM_QMRG (*(((double *)&fltcom_ + 2))) + +struct fltcom2_st { + short fltbuf2[56]; +} fltcom2_ __attribute__((common)) ; +#define CM_FLPRV ((short *)&fltcom2_ + 17) +#define CM_FLNXT ((short *)&fltcom2_ + 20) +#define CM_FLCPN (*(((double *)&fltcom2_))) +#define CM_FLCNT (*(((short *)&fltcom2_ + 12))) + +struct aidatcm_st { + double cm_aid, cm_ext, cm_basis; + short cm_aiday, cm_exday, cm_dperd, cm_aiexf, cm_aidex, cm_aiok, + cm_aigdo, cm_aildo, cm_prev[3], cm_next[3], cm_aid_pad[2]; + double cm_rvgfact, cm_ai1st, cm_ai2nd; + int cm_aieurok; +} aidatcm_ __attribute__((common)) ; +#define CM_EXDAY aidatcm_.cm_exday +#define CM_BASIS aidatcm_.cm_basis +#define CM_PREV aidatcm_.cm_prev + +struct cshfcm_st { + short bufff[10862]; +} cshfcm_ __attribute__((common)) ; +#define CM_FNUM (*(((short *)&cshfcm_ + 9038))) +#define CM_FIFLX ((double *)&cshfcm_ + 1) +#define CM_FEXTX ((double *)&cshfcm_ + 1201) +#define CM_FSHDT ((short *)&cshfcm_ + 7230) + +struct calctsdb_st { + short calctsdbbuff[115]; +} calctsdb_ __attribute__((common)) ; +#define CM_CTUP_GOOD_TO_GO (*(((short *)&calctsdb_ + 16))) +#define CM_PAYMENT_FREQUENCY (*(((short *)&calctsdb_ + 61))) +#define CM_DISCOUNTING_DAYTYP (*(((short *)&calctsdb_ + 59))) + +struct cf600cm_st { + short bufcf[14404]; +} cf600cm_ __attribute__((common)) ; +#define CM_FLT_RFIXRATES ((double *)&cf600cm_ + 600) + +typedef struct { int id; int type; const char *name; } bregdb_bitinfo_t; + +int +bregdb_eval_bbitcxt_bool_rv(const bregdb_bitinfo_t * const bbit, + const int bbit_default, + const void * const bregucxt); + +static const bregdb_bitinfo_t bbit_calc_dr_d33 = + { 160667, 5, "bbit_calc_dr_d33" }; +#define bbit_calc_dr_d33__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d33, 0, 0) +static const bregdb_bitinfo_t bbit_calc_sx_b24 = + { 158854, 5, "bbit_calc_sx_b24" }; +#define bbit_calc_sx_b24__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_sx_b24, 0, 0) +static const bregdb_bitinfo_t bbit_calc_dr_d36 = + { 161244, 5, "bbit_calc_dr_d36" }; +#define bbit_calc_dr_d36__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d36, 0, 0) +static const bregdb_bitinfo_t bbit_calc_dr_d37 = + { 161315, 5, "bbit_calc_dr_d37" }; +#define bbit_calc_dr_d37__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d37, 0, 0) +static const bregdb_bitinfo_t bbit_calc_dr_d47 = + { 163259, 5, "bbit_calc_dr_d47" }; +#define bbit_calc_dr_d47__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d47, 0, 0) +static const bregdb_bitinfo_t bbit_calc_dr_d46 = + { 163239, 5, "bbit_calc_dr_d46" }; +#define bbit_calc_dr_d46__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d46, 0, 0) +static const bregdb_bitinfo_t bbit_calc_dr_d62 = + { 166603, 5, "bbit_calc_dr_d62" }; +#define bbit_calc_dr_d62__value() \ + bregdb_eval_bbitcxt_bool_rv(&bbit_calc_dr_d62, 0, 0) + + + +int dtyp_is_actact_(short *daytyp); +double rnd_trunc_numb(double in, short num_digits, short rnd_or_trunc); +void datetrn_(const short* dt, short* dt2); +short difday_(short* daytyp_in, short* srtdti, short* enddti, short* ercode); + + +double pow(double x, double y); + + +/* + * (above is inlined and simplified from previously included headers) + */ + + +void calc_1566( + short sCalcType, + short sDayType, + short sFreq, + short asSettleDt[3], + short asMtyDt[3], + short asIssueDt[3], + short asFCpnDt[3], + double dCpn, + short *psNoPer, + double *pdExt, + double *pdAI, + double *pdAI2, + double *pdFCpn, + short *psRcode) +{ + + short ercode = 0; + int isactact; + short days_to_next_cpn = 0; + const short discDaytype = CM_DISCOUNTING_DAYTYP; + int j; + + if(bbit_calc_sx_b24__value()) + isactact = (dtyp_is_actact_(&sDayType) != 0); + else + isactact = (sDayType == 1 || sDayType == 10); + + short days_in_current_period = difday_(&sDayType,CM_FLPRV,CM_FLNXT,&ercode); + const short sfreq1 = (CM_CTUP_GOOD_TO_GO == 1 && CM_PAYMENT_FREQUENCY == 1); + + for (j = 0; j < CM_FNUM; j++) { + + if(j == 0) { + days_to_next_cpn = difday_(&sDayType,asSettleDt,CM_FLNXT,&ercode); + + if(isactact) { + CM_FIFLX[j] = CM_FLCPN / sFreq; + CM_FEXTX[j] = (double)days_to_next_cpn / (double)days_in_current_period; + } + else { + CM_FIFLX[j] = CM_FLCPN * days_in_current_period; + CM_FEXTX[j] = (double)days_to_next_cpn / (double)(1/sfreq1); + } + + if(CM_FNUM == 1) { + CM_FEXTX[j] = (double)days_to_next_cpn / ((double)1/sfreq1); + } + } + else { + + short days_from_settle, days_in_period; + + if(bbit_calc_dr_d46__value()){ + days_from_settle = difday_(&sDayType,asSettleDt, + &CM_FSHDT[j*3],&ercode); + days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3], + &CM_FSHDT[j*3],&ercode); + } + + double cpn_rate = CM_PLIBOR; + + if(bbit_calc_dr_d62__value()) { + if(j < CM_FLCNT && CM_FLT_RFIXRATES[j] != 0) cpn_rate = CM_FLT_RFIXRATES[j]; + } + else { + if(j < CM_FLCNT ) cpn_rate = CM_FLT_RFIXRATES[j]; + } + + if(bbit_calc_dr_d37__value()&& j >= CM_FLCNT && sCalcType == 1570) { + cpn_rate = CM_PLIBOR + CM_QMRG; + + if(bbit_calc_dr_d36__value()){ + double projected_rate = pow((1 + CM_PLIBOR/100.0), + (days_in_period)) - 1; + + projected_rate = projected_rate + CM_QMRG/100.0 * days_in_period; + cpn_rate = 100 * projected_rate * (1/days_in_period); + } + } + + + if(isactact) { + CM_FIFLX[j] = cpn_rate / sFreq; + CM_FEXTX[j] = CM_FEXTX[j-1] + 1; + + if(bbit_calc_dr_d46__value() && discDaytype != 0) { + CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1); + } + } + else { + if(!bbit_calc_dr_d46__value()){ + days_from_settle = difday_(&sDayType,asSettleDt, + &CM_FSHDT[j*3],&ercode); + days_in_period = difday_(&sDayType,&CM_FSHDT[(j-1)*3], + &CM_FSHDT[j*3],&ercode); + + } + + CM_FIFLX[j] = cpn_rate * days_in_period; + CM_FEXTX[j] = (double)days_from_settle / (double)(1/sfreq1); + } + + } + + if(bbit_calc_dr_d33__value() && CM_CTUP_GOOD_TO_GO != 0) { + CM_FIFLX[j] = rnd_trunc_numb (CM_FIFLX[j], 0, 0); + } + + } + + + short accrued_days = difday_(&sDayType,CM_FLPRV,asSettleDt,&ercode); + + if(!bbit_calc_dr_d47__value()) { + if(isactact) { + *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)days_in_current_period); + } + else{ + *pdAI = (CM_FLCPN / sFreq)* accrued_days / ((double)1/sFreq); + } + } + + CM_EXDAY = days_to_next_cpn; + CM_BASIS = days_in_current_period; + datetrn_(CM_FLPRV,CM_PREV); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c new file mode 100644 index 000000000..ab85e9160 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-1.c @@ -0,0 +1,35 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +void abort(); + +#define N 16 + +signed char ca[N] __attribute__((aligned(16))); +signed char cb[] __attribute__((aligned(16))) + = {8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7}; +signed char cc[] __attribute__((aligned(16))) + = {1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2}; + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +int main () +{ + signed char cd[] = {7, 6, 4, 3, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -5}; + int i; + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != cd[i]) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c new file mode 100644 index 000000000..170649df6 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-10.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = ((cb[i] + cc[i]) * cd[i]) >> 3; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i % 2 ? 1 : -1; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (i % 2 == 1 && ca[i] != (-2 * i - 1955) >> 3) + abort (); + else if (i % 2 == 0 && ca[i] != (1955 + 2 * i) >> 3) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c new file mode 100644 index 000000000..699b5baf4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-11.c @@ -0,0 +1,53 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +#include <altivec.h> +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); +int hey; + +__attribute__((noinline)) void foo () +{ + int i; + vector int va, vb, vc, vd, tmp; + vector unsigned int threes = vec_splat_u32(3); + for (i = 0; i < N; i+=4) { + vb = vec_vsx_ld (0, &cb[i]); + vc = vec_vsx_ld (0, &cc[i]); + vd = vec_vsx_ld (0, &cd[i]); + tmp = vec_add (vb, vc); + tmp = vec_sub (tmp, vd); + tmp = vec_sra (tmp, threes); + hey = tmp[3]; + vec_vsx_st (tmp, 0, &ca[i]); + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i + 14; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != (-3 * i - 1969) >> 3) + abort (); + if (hey != ca[N-1]) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c new file mode 100644 index 000000000..529d03e64 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-12.c @@ -0,0 +1,56 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +#include "altivec.h" +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); +int hey; + +__attribute__((noinline)) void foo () +{ + int i; + vector int va, vb, vc, vd, tmp; + vector unsigned int threes = vec_splat_u32(3); + for (i = 0; i < N; i+=4) { + vb = vec_vsx_ld (0, &cb[i]); + vc = vec_vsx_ld (0, &cc[i]); + vd = vec_vsx_ld (0, &cd[i]); + tmp = vec_add (vb, vc); + tmp = vec_sub (tmp, vd); + tmp = vec_sra (tmp, threes); + hey = tmp[3]; + vec_vsx_st (tmp, 0, &ca[i]); + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i + 14; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != (-3 * i - 1969) >> 3) + abort (); + if (hey != ca[N-1]) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c new file mode 100644 index 000000000..787b02e64 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-13.c @@ -0,0 +1,54 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +#include <altivec.h> +void abort (); + +#define N 4096 +long long ca[N] __attribute__((aligned(16))); +long long cb[N] __attribute__((aligned(16))); +long long cc[N] __attribute__((aligned(16))); +long long cd[N] __attribute__((aligned(16))); +long long x; + +__attribute__((noinline)) void foo () +{ + int i; + vector long long va, vb, vc, vd, tmp; + volatile unsigned long long three = 3; + vector unsigned long long threes = vec_splats (three); + for (i = 0; i < N; i+=2) { + vb = vec_vsx_ld (0, (vector long long *)&cb[i]); + vc = vec_vsx_ld (0, (vector long long *)&cc[i]); + vd = vec_vsx_ld (0, (vector long long *)&cd[i]); + tmp = vec_add (vb, vc); + tmp = vec_sub (tmp, vd); + tmp = vec_sra (tmp, threes); + x = vec_extract (tmp, 0); + vec_vsx_st (tmp, 0, (vector long long *)&ca[i]); + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i + 14; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != (-3 * i - 1969) >> 3) + abort (); + if (x != ca[N-1]) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c new file mode 100644 index 000000000..7ca6ad5cc --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-14.c @@ -0,0 +1,43 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler "stxsdx" } } */ +/* { dg-final { scan-assembler-times "xxpermdi" 1 } } */ + +/* The only xxpermdi expected is for the vec_splats. */ + +#include <altivec.h> +void abort (); + +#define N 4096 +long long ca[N] __attribute__((aligned(16))); +long long cb[N] __attribute__((aligned(16))); +long long cc[N] __attribute__((aligned(16))); +long long cd[N] __attribute__((aligned(16))); +long long x; + +__attribute__((noinline)) void foo () +{ + int i; + vector long long va, vb, vc, vd, tmp; + volatile unsigned long long three = 3; + vector unsigned long long threes = vec_splats (three); + for (i = 0; i < N; i+=2) { + vb = vec_vsx_ld (0, (vector long long *)&cb[i]); + vc = vec_vsx_ld (0, (vector long long *)&cc[i]); + vd = vec_vsx_ld (0, (vector long long *)&cd[i]); + tmp = vec_add (vb, vc); + tmp = vec_sub (tmp, vd); + tmp = vec_sra (tmp, threes); + x = vec_extract (tmp, 0); + vec_vsx_st (tmp, 0, (vector long long *)&ca[i]); + } +} + +int main () +{ + foo (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c new file mode 100644 index 000000000..172e4bd4c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-15.c @@ -0,0 +1,51 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler "xxspltw" } } */ + +/* Currently the analyze_swaps phase cannot optimize this loop because + of the presence of an UNSPEC_VSX_CVDPSPN. At such time as this is + handled, we need to add a 'scan-assembler-not "xxpermdi"' directive to + this test. */ +#include <altivec.h> +void abort(); + +#define N 4096 +#define M 10000000 +vector float ca[N][4] = {0}; +vector float cb[N][4] = {0}; +vector float cc[N][4] = {0}; + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + cc[i][0] = vec_mul(vec_splats(cb[i][0][0]), ca[i][0]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(cb[i][0][1]), ca[i][1]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(cb[i][0][2]), ca[i][2]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(cb[i][0][3]), ca[i][3]); + + cc[i][1] = vec_mul(vec_splats(cb[i][1][0]), ca[i][0]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(cb[i][1][1]), ca[i][1]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(cb[i][1][2]), ca[i][2]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(cb[i][1][3]), ca[i][3]); + + cc[i][2] = vec_mul(vec_splats(cb[i][2][0]), ca[i][0]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(cb[i][2][1]), ca[i][1]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(cb[i][2][2]), ca[i][2]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(cb[i][2][3]), ca[i][3]); + + cc[i][3] = vec_mul(vec_splats(cb[i][3][0]), ca[i][0]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(cb[i][3][1]), ca[i][1]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(cb[i][3][2]), ca[i][2]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(cb[i][3][3]), ca[i][3]); + } +} + +int main () +{ + foo (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c new file mode 100644 index 000000000..2b7f73c37 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-16.c @@ -0,0 +1,57 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler "vspltw" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +#include <altivec.h> +void abort(); + +typedef struct xx {vector double l; vector double h;} xx; + +#define N 4096 +#define M 10000000 +vector float ca[N][4] = {0}; +vector float cb[N][4] = {0}; +vector float cc[N][4] = {0}; + +__attribute__((noinline)) void foo () +{ + int i; + vector float brow; + + for (i = 0; i < N; i++) { + + brow = cb[i][0]; + cc[i][0] = vec_mul(vec_splats(brow[0]), ca[i][0]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]); + cc[i][0] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]); + + brow = cb[i][1]; + cc[i][1] = vec_mul(vec_splats(brow[0]), ca[i][0]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]); + cc[i][1] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]); + + brow = cb[i][2]; + cc[i][2] = vec_mul(vec_splats(brow[0]), ca[i][0]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]); + cc[i][2] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]); + + brow = cb[i][3]; + cc[i][3] = vec_mul(vec_splats(brow[0]), ca[i][0]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[1]), ca[i][1]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[2]), ca[i][2]); + cc[i][3] = vec_madd(cc[i][0],vec_splats(brow[3]), ca[i][3]); + } +} + +int main () +{ + foo (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c new file mode 100644 index 000000000..7a9cfbf95 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-17.c @@ -0,0 +1,15 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O1" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "xxpermdi" } } */ + +/* Verify that we don't try to do permute removal in the presence of + vec_ste. This used to ICE. */ +#include <altivec.h> + +void f (void *p) +{ + vector unsigned int u32 = vec_vsx_ld (1, (const unsigned int *)p); + vec_ste (u32, 1, (unsigned int *)p); +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c new file mode 100644 index 000000000..6ce041ab5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-2.c @@ -0,0 +1,41 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +void abort (); + +#define N 256 +signed char ca[N] __attribute__((aligned(16))); +signed char cb[N] __attribute__((aligned(16))); +signed char cc[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = i - 128; + cc[i] = i/2 - 64; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != i - i/2 - 64) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c new file mode 100644 index 000000000..35dacd4b5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-3.c @@ -0,0 +1,43 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +void abort (); + +#define N 4096 +signed char ca[N] __attribute__((aligned(16))); +signed char cb[N] __attribute__((aligned(16))); +signed char cc[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i, ii; + for (i = 0, ii = 0; i < N; ++i, ii = (ii + 1) % 128) { + cb[i] = ii - 128; + cc[i] = ii/2 - 64; + } +} + +int main () +{ + int i, ii; + init (); + foo (); + for (i = 0; i < N; ++i) { + ii = i % 128; + if (ca[i] != ii - ii/2 - 64) + abort (); + } + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c new file mode 100644 index 000000000..61fe99b35 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-4.c @@ -0,0 +1,45 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = (cb[i] + cc[i]) * cd[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i % 2 ? 1 : -1; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (i % 2 == 1 && ca[i] != -2 * i - 1955) + abort (); + else if (i % 2 == 0 && ca[i] != 1955 + 2 * i) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c new file mode 100644 index 000000000..b367fb6b5 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-5.c @@ -0,0 +1,45 @@ +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ +/* { dg-final { scan-assembler "lxvd2x" } } */ +/* { dg-final { scan-assembler "stxvd2x" } } */ +/* { dg-final { scan-assembler-not "xxpermdi" } } */ + +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = ((cb[i] + cc[i]) * cd[i]) >> 3; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i % 2 ? 1 : -1; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (i % 2 == 1 && ca[i] != (-2 * i - 1955) >> 3) + abort (); + else if (i % 2 == 0 && ca[i] != (1955 + 2 * i) >> 3) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c new file mode 100644 index 000000000..f7084529c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-6.c @@ -0,0 +1,32 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +void abort(); + +#define N 16 + +signed char ca[N] __attribute__((aligned(16))); +signed char cb[] __attribute__((aligned(16))) + = {8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2, -3, -4, -5, -6, -7}; +signed char cc[] __attribute__((aligned(16))) + = {1, 1, 2, 2, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2}; + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +int main () +{ + signed char cd[] = {7, 6, 4, 3, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -5}; + int i; + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != cd[i]) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c new file mode 100644 index 000000000..27a31b711 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-7.c @@ -0,0 +1,38 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +void abort (); + +#define N 256 +signed char ca[N] __attribute__((aligned(16))); +signed char cb[N] __attribute__((aligned(16))); +signed char cc[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = i - 128; + cc[i] = i/2 - 64; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (ca[i] != i - i/2 - 64) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c new file mode 100644 index 000000000..7264d2586 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-8.c @@ -0,0 +1,40 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +void abort (); + +#define N 4096 +signed char ca[N] __attribute__((aligned(16))); +signed char cb[N] __attribute__((aligned(16))); +signed char cc[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = cb[i] - cc[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i, ii; + for (i = 0, ii = 0; i < N; ++i, ii = (ii + 1) % 128) { + cb[i] = ii - 128; + cc[i] = ii/2 - 64; + } +} + +int main () +{ + int i, ii; + init (); + foo (); + for (i = 0; i < N; ++i) { + ii = i % 128; + if (ca[i] != ii - ii/2 - 64) + abort (); + } + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c new file mode 100644 index 000000000..cdca070e3 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/swaps-p8-9.c @@ -0,0 +1,42 @@ +/* { dg-do run { target { powerpc64le-*-* } } } */ +/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" } { "-mcpu=power8" } } */ +/* { dg-options "-mcpu=power8 -O3" } */ + +void abort (); + +#define N 4096 +int ca[N] __attribute__((aligned(16))); +int cb[N] __attribute__((aligned(16))); +int cc[N] __attribute__((aligned(16))); +int cd[N] __attribute__((aligned(16))); + +__attribute__((noinline)) void foo () +{ + int i; + for (i = 0; i < N; i++) { + ca[i] = (cb[i] + cc[i]) * cd[i]; + } +} + +__attribute__((noinline)) void init () +{ + int i; + for (i = 0; i < N; ++i) { + cb[i] = 3 * i - 2048; + cc[i] = -5 * i + 93; + cd[i] = i % 2 ? 1 : -1; + } +} + +int main () +{ + int i; + init (); + foo (); + for (i = 0; i < N; ++i) + if (i % 2 == 1 && ca[i] != -2 * i - 1955) + abort (); + else if (i % 2 == 0 && ca[i] != 1955 + 2 * i) + abort (); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c index 836b3851c..934cdad25 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-builtin-8.c @@ -1,7 +1,7 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-options "-O3 -mcpu=power7" } */ +/* { dg-options "-O3 -mcpu=power7 -Wno-deprecated" } */ /* Test the various load/store varients. */ diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-extract-1.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-extract-1.c index e1f0ca8e8..c4e76e6ac 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-extract-1.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/vsx-extract-1.c @@ -7,10 +7,4 @@ #include <altivec.h> -#if __LITTLE_ENDIAN__ -#define OFFSET 1 -#else -#define OFFSET 0 -#endif - -double get_value (vector double *p) { return vec_extract (*p, OFFSET); } +double get_value (vector double *p) { return vec_extract (*p, 0); } diff --git a/gcc-4.9/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c new file mode 100644 index 000000000..bf889aaa2 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/powerpc/warn-lvsl-lvsr.c @@ -0,0 +1,14 @@ +/* Test for deprecation messages on use of lvsl and lvsr for little endian. */ + +/* { dg-do compile { target { powerpc64le-*-* } } } */ +/* { dg-options "-O0 -Wdeprecated" } */ + +#include <altivec.h> + +float f[20]; + +void foo () +{ + vector unsigned char a = vec_lvsl (4, f); /* { dg-warning "vec_lvsl is deprecated for little endian; use assignment for unaligned loads and stores" } */ + vector unsigned char b = vec_lvsr (8, f); /* { dg-warning "vec_lvsr is deprecated for little endian; use assignment for unaligned loads and stores" } */ +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c index f2cd2de04..3208f932a 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20-sh2a.c @@ -3,12 +3,12 @@ /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-skip-if "" { "sh*-*-*" } { "*" } { "-m2a*" } } */ -/* { dg-final { scan-assembler-times "tst" 5 } } */ -/* { dg-final { scan-assembler-times "movt" 0 } } */ +/* { dg-final { scan-assembler-times "tst" 6 } } */ +/* { dg-final { scan-assembler-times "movt" 1 } } */ /* { dg-final { scan-assembler-times "nott" 1 } } */ /* { dg-final { scan-assembler-times "cmp/eq" 2 } } */ /* { dg-final { scan-assembler-times "cmp/hi" 4 } } */ /* { dg-final { scan-assembler-times "cmp/gt" 3 } } */ -/* { dg-final { scan-assembler-times "not\t" 1 } } */ +/* { dg-final { scan-assembler-not "not\t" } } */ #include "pr51244-20.c" diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c index a9ded4635..aad6a2fd3 100644 --- a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c +++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr51244-20.c @@ -1,15 +1,15 @@ /* Check that the SH specific sh_treg_combine RTL optimization pass works as expected. On SH2A the expected insns are slightly different, see - pr51244-21.c. */ + pr51244-20-sh2a.c. */ /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" "-m2a*" } { "" } } */ -/* { dg-final { scan-assembler-times "tst" 6 } } */ -/* { dg-final { scan-assembler-times "movt" 1 } } */ +/* { dg-final { scan-assembler-times "tst" 7 } } */ +/* { dg-final { scan-assembler-times "movt" 2 } } */ /* { dg-final { scan-assembler-times "cmp/eq" 2 } } */ /* { dg-final { scan-assembler-times "cmp/hi" 4 } } */ /* { dg-final { scan-assembler-times "cmp/gt" 2 } } */ -/* { dg-final { scan-assembler-times "not\t" 1 } } */ +/* { dg-final { scan-assembler-not "not\t" } } */ /* non-SH2A: 2x tst, 1x movt, 2x cmp/eq, 1x cmp/hi @@ -81,7 +81,7 @@ get_request_2 (int* q, int rw) } -/* 2x tst, 1x cmp/hi, 1x not */ +/* 3x tst, 1x movt, 1x cmp/hi, 1x not */ static inline int blk_oversized_queue_5 (int* q) { diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c new file mode 100644 index 000000000..d3d93849b --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/pr64507.c @@ -0,0 +1,25 @@ +/* Check that the __builtin_strnlen returns 0 with with + non-constant 0 length. */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +extern int snprintf(char *, int, const char *, ...); +extern void abort (void); + +int main() + { + int i; + int cmp = 0; + char buffer[1024]; + const char* s = "the string"; + + snprintf(buffer, 4, "%s", s); + + for (i = 1; i < 4; i++) + cmp += __builtin_strncmp(buffer, s, i - 1); + + if (cmp) + abort(); + + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c new file mode 100644 index 000000000..f18beadd9 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-1.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-additional-options "-std=c99" } */ + +#include <assert.h> + +int decision_result; +int val; +int truecount = 0; + +static void __attribute__((noinline)) +buggy (int flag) +{ + int condition; + if(flag == 0) + condition = val != 0; + else + condition = !decision_result; + if (condition) + truecount++; +} + +int +main (void) +{ + decision_result = 1; + buggy(1); + assert (truecount == 0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c new file mode 100644 index 000000000..c0bc9116c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/sh/torture/pr63783-2.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-additional-options "-std=c99" } */ + +#include <assert.h> + +long long decision_result; +long long val; +int truecount = 0; + +static void __attribute__((noinline)) +buggy (int flag) +{ + int condition; + if(flag == 0) + condition = val != 0; + else + condition = !decision_result; + if (condition) + truecount++; +} + +int +main (void) +{ + decision_result = 1; + buggy(1); + assert (truecount == 0); + return 0; +} diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/dependency_45.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/dependency_45.f90 new file mode 100644 index 000000000..8b43f7507 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/dependency_45.f90 @@ -0,0 +1,12 @@ +! { dg-do run } +! { dg-options "-Warray-temporaries" } +! PR 56867 - substrings were not checked for dependency. +program main + character(len=4) :: a + character(len=4) :: c(3) + c(1) = 'abcd' + c(2) = '1234' + c(3) = 'wxyz' + c(:)(1:2) = c(2)(2:3) ! { dg-warning "array temporary" } + if (c(3) .ne. '23yz') call abort +end program main diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 new file mode 100644 index 000000000..9db17dd27 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-1.f90 @@ -0,0 +1,13 @@ +! PR fortran/59488 +! { dg-do compile } +! { dg-options "-fopenmp" } + + implicit none + integer, parameter :: p(2) = (/ 11, 12 /) + integer :: r + + !$omp parallel do default(none) + do r = 1, 2 + print *, p(r) + end do +end diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 new file mode 100644 index 000000000..38f157b81 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/gomp/pr59488-2.f90 @@ -0,0 +1,16 @@ +! PR fortran/59488 +! { dg-do compile } +! { dg-options "-fopenmp" } + + implicit none + type t + integer :: s1, s2, s3 + end type + integer :: r + type(t), parameter :: u = t(1, 2, 3) + + !$omp parallel do default(none) + do r = 1, 2 + print *, u + end do +end diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/pointer_intent_7.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/pointer_intent_7.f90 index c09eb2b5f..5387ace8c 100644 --- a/gcc-4.9/gcc/testsuite/gfortran.dg/pointer_intent_7.f90 +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/pointer_intent_7.f90 @@ -23,7 +23,7 @@ contains call bar2 (c) call bar3 (c) call bar2p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } - call bar3p (b) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } + call bar3p (b) ! { dg-error "Actual argument to .n. at \\(1\\) must be polymorphic" } call bar2p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } call bar3p (c) ! { dg-error "INTENT\\(IN\\) in pointer association context \\(actual argument to INTENT = OUT/INOUT" } end subroutine diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/pr64528.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/pr64528.f90 new file mode 100644 index 000000000..f6cca4f73 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/pr64528.f90 @@ -0,0 +1,20 @@ +! PR fortran/64528 +! { dg-do compile } +! { dg-options "-O -fno-tree-dce -fno-tree-ccp" } + +program pr64528 + interface + subroutine foo(x) + integer, value :: x + end subroutine foo + end interface + integer :: x + x = 10 + call foo(x) + if(x .ne. 10) then + endif +end program pr64528 +subroutine foo(x) + integer, value :: x + x = 11 +end subroutine foo diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_26.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_26.f90 new file mode 100644 index 000000000..dffbf93e7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_call_26.f90 @@ -0,0 +1,30 @@ +! { dg-do compile } +! +! PR 64244: [4.8/4.9/5 Regression] ICE at class.c:236 when using non_overridable +! +! Contributed by Ondřej Čertík <ondrej.certik@gmail.com> + +module m + implicit none + + type :: A + contains + generic :: f => g + procedure, non_overridable :: g + end type + +contains + + subroutine g(this) + class(A), intent(in) :: this + end subroutine + +end module + + +program test_non_overridable + use m, only: A + implicit none + class(A), allocatable :: h + call h%f() +end diff --git a/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 new file mode 100644 index 000000000..26c49a188 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gfortran.dg/typebound_operator_20.f90 @@ -0,0 +1,53 @@ +! { dg-do run } +! +! PR 63733: [4.8/4.9/5 Regression] [OOP] wrong resolution for OPERATOR generics +! +! Original test case from Alberto F. Martín Huertas <amartin@cimne.upc.edu> +! Slightly modified by Salvatore Filippone <sfilippone@uniroma2.it> +! Further modified by Janus Weil <janus@gcc.gnu.org> + +module overwrite + type parent + contains + procedure :: sum => sum_parent + generic :: operator(+) => sum + end type + + type, extends(parent) :: child + contains + procedure :: sum => sum_child + end type + +contains + + integer function sum_parent(op1,op2) + implicit none + class(parent), intent(in) :: op1, op2 + sum_parent = 0 + end function + + integer function sum_child(op1,op2) + implicit none + class(child) , intent(in) :: op1 + class(parent), intent(in) :: op2 + sum_child = 1 + end function + +end module + +program drive + use overwrite + implicit none + + type(parent) :: m1, m2 + class(parent), pointer :: mres + type(child) :: h1, h2 + class(parent), pointer :: hres + + if (m1 + m2 /= 0) call abort() + if (h1 + m2 /= 1) call abort() + if (h1%sum(h2) /= 1) call abort() + +end + +! { dg-final { cleanup-modules "overwrite" } } diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/entry_queues2.adb b/gcc-4.9/gcc/testsuite/gnat.dg/entry_queues2.adb new file mode 100644 index 000000000..a1445cebd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/entry_queues2.adb @@ -0,0 +1,45 @@ +-- { dg-do compile } + +procedure Entry_Queues2 is + + F1 : Integer := 17; + + generic + type T is limited private; + procedure Check; + + procedure Check is + begin + declare + type Poe is new T; + begin + declare + type Arr is array (1 .. 2) of Poe; + X : Arr; + pragma Unreferenced (X); + begin + null; + end; + end; + end; + +begin + + declare + protected type Poe (D3 : Integer := F1) is + entry E (D3 .. F1); -- F1 evaluated + end Poe; + protected body Poe is + entry E (for I in D3 .. F1) when True is + begin + null; + end E; + end Poe; + + procedure Chk is new Check (Poe); + + begin + Chk; + end; + +end; diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/opt41.adb b/gcc-4.9/gcc/testsuite/gnat.dg/opt41.adb new file mode 100644 index 000000000..21660431c --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/opt41.adb @@ -0,0 +1,15 @@ +-- { dg-do run } +-- { dg-options "-Os" } + +with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; +with Opt41_Pkg; use Opt41_Pkg; + +procedure Opt41 is + R : Rec := (Five, To_Unbounded_String ("CONFIG")); + SP : String_Access := new String'(To_String (Rec_Write (R))); + RP : Rec_Ptr := new Rec'(Rec_Read (SP)); +begin + if RP.D /= R.D then + raise Program_Error; + end if; +end; diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.adb b/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.adb new file mode 100644 index 000000000..c43c1bfdf --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.adb @@ -0,0 +1,53 @@ +with Ada.Streams; use Ada.Streams;
+
+package body Opt41_Pkg is
+
+ type Wstream is new Root_Stream_Type with record
+ S : Unbounded_String;
+ end record;
+
+ procedure Read (Stream : in out Wstream;
+ Item : out Stream_Element_Array;
+ Last : out Stream_Element_Offset) is null;
+
+ procedure Write (Stream : in out Wstream; Item : Stream_Element_Array) is
+ begin
+ for J in Item'Range loop
+ Append (Stream.S, Character'Val (Item (J)));
+ end loop;
+ end Write;
+
+ function Rec_Write (R : Rec) return Unbounded_String is
+ S : aliased Wstream;
+ begin
+ Rec'Output (S'Access, R);
+ return S.S;
+ end Rec_Write;
+
+ type Rstream is new Root_Stream_Type with record
+ S : String_Access;
+ Idx : Integer := 1;
+ end record;
+
+ procedure Write (Stream : in out Rstream; Item : Stream_Element_Array) is null;
+
+ procedure Read (Stream : in out Rstream;
+ Item : out Stream_Element_Array;
+ Last : out Stream_Element_Offset) is
+ begin
+ Last := Stream_Element_Offset'Min
+ (Item'Last, Item'First + Stream_Element_Offset (Stream.S'Last - Stream.Idx));
+ for I in Item'First .. Last loop
+ Item (I) := Stream_Element (Character'Pos (Stream.S (Stream.Idx)));
+ Stream.Idx := Stream.Idx + 1;
+ end loop;
+ end Read;
+
+ function Rec_Read (Str : String_Access) return Rec is
+ S : aliased Rstream;
+ begin
+ S.S := Str;
+ return Rec'Input (S'Access);
+ end Rec_Read;
+
+end Opt41_Pkg;
diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.ads b/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.ads new file mode 100644 index 000000000..e73bc9319 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/opt41_pkg.ads @@ -0,0 +1,28 @@ +with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
+
+package Opt41_Pkg is
+
+ type Enum is (One, Two, Three, Four, Five, Six);
+
+ type Rec (D : Enum) is record
+ case D is
+ when One =>
+ I : Integer;
+ when Two | Five | Six =>
+ S : Unbounded_String;
+ case D is
+ when Two => B : Boolean;
+ when others => null;
+ end case;
+ when others =>
+ null;
+ end case;
+ end record;
+
+ type Rec_Ptr is access all Rec;
+
+ function Rec_Write (R : Rec) return Unbounded_String;
+
+ function Rec_Read (Str : String_Access) return Rec;
+
+end Opt41_Pkg;
diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/opt45.adb b/gcc-4.9/gcc/testsuite/gnat.dg/opt45.adb new file mode 100644 index 000000000..f75e46ed4 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/opt45.adb @@ -0,0 +1,38 @@ +-- { dg-do compile }
+-- { dg-options "-O3" }
+
+procedure Opt45 is
+
+ type Index_T is mod 2 ** 32;
+ for Index_T'Size use 32;
+ for Index_T'Alignment use 1;
+
+ type Array_T is array (Index_T range <>) of Natural;
+ type Array_Ptr_T is access all Array_T;
+
+ My_Array_1 : aliased Array_T := (1, 2);
+ My_Array_2 : aliased Array_T := (3, 4);
+
+ Array_Ptr : Array_Ptr_T := null;
+ Index : Index_T := Index_T'First;
+
+ My_Value : Natural := Natural'First;
+
+ procedure Proc (Selection : Positive) is
+ begin
+ if Selection = 1 then
+ Array_Ptr := My_Array_1'Access;
+ Index := My_Array_1'First;
+ else
+ Array_Ptr := My_Array_2'Access;
+ Index := My_Array_2'First;
+ end if;
+
+ if My_Value = Natural'First then
+ My_Value := Array_Ptr.all (Index);
+ end if;
+ end;
+
+begin
+ Proc (2);
+end;
diff --git a/gcc-4.9/gcc/testsuite/gnat.dg/opt47.adb b/gcc-4.9/gcc/testsuite/gnat.dg/opt47.adb new file mode 100644 index 000000000..cfe44eb1e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gnat.dg/opt47.adb @@ -0,0 +1,31 @@ +-- { dg-do run { target i?86-*-* x86_64-*-* alpha*-*-* ia64-*-* } } +-- { dg-options "-O2" } + +with Ada.Characters.Handling; use Ada.Characters.Handling; +with Interfaces; use Interfaces; +with Ada.Unchecked_Conversion; + +procedure Opt47 is + + subtype String4 is String (1 .. 4); + function To_String4 is new Ada.Unchecked_Conversion (Unsigned_32, String4); + type Arr is array (Integer range <>) of Unsigned_32; + Leaf : Arr (1 .. 4) := (1349478766, 1948272498, 1702436946, 1702061409); + Value : Unsigned_32; + Result : String (1 .. 32); + Last : Integer := 0; + +begin + for I in 1 .. 4 loop + Value := Leaf (I); + for J in reverse String4'Range loop + if Is_Graphic (To_String4 (Value)(J)) then + Last := Last + 1; + Result (Last) := To_String4 (Value)(J); + end if; + end loop; + end loop; + if Result (1) /= 'P' then + raise Program_Error; + end if; +end; diff --git a/gcc-4.9/gcc/testsuite/go.test/go-test.exp b/gcc-4.9/gcc/testsuite/go.test/go-test.exp index 1bbbd8742..25e38f08c 100644 --- a/gcc-4.9/gcc/testsuite/go.test/go-test.exp +++ b/gcc-4.9/gcc/testsuite/go.test/go-test.exp @@ -241,7 +241,11 @@ proc go-set-goarch { } { if [check_effective_target_ilp32] { set goarch "ppc" } else { - set goarch "ppc64" + if [istarget "powerpc64le-*-*"] { + set goarch "ppc64le" + } else { + set goarch "ppc64" + } } } "sparc*-*-*" { diff --git a/gcc-4.9/gcc/testsuite/lib/asan-dg.exp b/gcc-4.9/gcc/testsuite/lib/asan-dg.exp index f4ec44577..04bf3bf23 100644 --- a/gcc-4.9/gcc/testsuite/lib/asan-dg.exp +++ b/gcc-4.9/gcc/testsuite/lib/asan-dg.exp @@ -23,6 +23,21 @@ proc check_effective_target_faddress_sanitizer {} { } "-fsanitize=address"] } +proc asan_include_flags {} { + global srcdir + global TESTING_IN_BUILD_TREE + + set flags "" + + if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } { + return "${flags}" + } + + set flags "-I$srcdir/../../libsanitizer/include" + + return "$flags" +} + # # asan_link_flags -- compute library path and flags to find libasan. # (originally from g++.exp) @@ -80,17 +95,19 @@ proc asan_init { args } { } } + set include_flags "[asan_include_flags]" + if [info exists TEST_ALWAYS_FLAGS] { set asan_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS } if [info exists ALWAYS_CXXFLAGS] { set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS] - set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -static-libasan -g}" $ALWAYS_CXXFLAGS] + set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -static-libasan -g $include_flags}" $ALWAYS_CXXFLAGS] } else { if [info exists TEST_ALWAYS_FLAGS] { - set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $TEST_ALWAYS_FLAGS" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $include_flags $TEST_ALWAYS_FLAGS" } else { - set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g" + set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $include_flags" } } if { $link_flags != "" } { diff --git a/gcc-4.9/gcc/testsuite/lib/profopt.exp b/gcc-4.9/gcc/testsuite/lib/profopt.exp index a6e4d8903..6210aedc6 100644 --- a/gcc-4.9/gcc/testsuite/lib/profopt.exp +++ b/gcc-4.9/gcc/testsuite/lib/profopt.exp @@ -169,6 +169,8 @@ proc profopt-final-code { which final_code name } { # SRC is the full pathname of the testcase. # proc profopt-get-options { src } { + global srcdir + # dg-options sets a variable called dg-extra-tool-flags. set dg-extra-tool-flags "" diff --git a/gcc-4.9/gcc/testsuite/lib/target-supports.exp b/gcc-4.9/gcc/testsuite/lib/target-supports.exp index 36a0b6c1b..8995fb0b3 100644 --- a/gcc-4.9/gcc/testsuite/lib/target-supports.exp +++ b/gcc-4.9/gcc/testsuite/lib/target-supports.exp @@ -869,6 +869,19 @@ proc check_effective_target_fpic { } { return 0 } +# Return 1 if -shared is supported, as in no warnings or errors +# emitted, 0 otherwise. + +proc check_effective_target_shared { } { + # Note that M68K has a multilib that supports -fpic but not + # -fPIC, so we need to check both. We test with a program that + # requires GOT references. + return [check_no_compiler_messages shared executable { + extern int foo (void); extern int bar; + int baz (void) { return foo () + bar; } + } "-shared -fpic"] +} + # Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise. proc check_effective_target_pie { } { @@ -5993,3 +6006,54 @@ proc force_conventional_output_for { test } { } } +# Return 1 if the x86-64 target supports PIE with copy reloc, 0 +# otherwise. Cache the result. + +proc check_effective_target_pie_copyreloc { } { + global pie_copyreloc_available_saved + global tool + global GCC_UNDER_TEST + + if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + return 0 + } + + # Need auto-host.h to check linker support. + if { ![file exists ../../auto-host.h ] } { + return 0 + } + + if [info exists pie_copyreloc_available_saved] { + verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2 + } else { + # Set up and compile to see if linker supports PIE with copy + # reloc. Include the current process ID in the file names to + # prevent conflicts with invocations for multiple testsuites. + + set src pie[pid].c + set obj pie[pid].o + + set f [open $src "w"] + puts $f "#include \"../../auto-host.h\"" + puts $f "#if HAVE_LD_PIE_COPYRELOC == 0" + puts $f "# error Linker does not support PIE with copy reloc." + puts $f "#endif" + close $f + + verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2 + set lines [${tool}_target_compile $src $obj object ""] + + file delete $src + file delete $obj + + if [string match "" $lines] then { + verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2 + set pie_copyreloc_available_saved 1 + } else { + verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2 + set pie_copyreloc_available_saved 0 + } + } + + return $pie_copyreloc_available_saved +} |