diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-03 10:57:46 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-01-03 10:57:46 +0000 |
commit | 159b58ddeefa62da79bd458d8d606509b37a7d7b (patch) | |
tree | 30c34b02b14ff9991fdc56cb67585061e9dff779 /gcc/testsuite | |
parent | 578512b16c7b69545b35e7547f28d7deeaf798f5 (diff) | |
download | gcc-159b58ddeefa62da79bd458d8d606509b37a7d7b.tar.gz |
2012-01-03 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 182833 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@182834 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
131 files changed, 2530 insertions, 248 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 629c263a1f4..6ac425a63d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,361 @@ +2012-01-03 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/15867 + * g++.dg/warn/Wredundant-decls-spec.C: New. + +2012-01-03 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/51719 + * g++.dg/tree-prof/pr51719.C: New test. + +2012-01-03 Richard Guenther <rguenther@suse.de> + + PR middle-end/51730 + * gcc.dg/fold-compare-6.c: New testcase. + +2012-01-03 Jakub Jelinek <jakub@redhat.com> + + PR c++/51669 + * g++.dg/gomp/pr51669.C: New test. + +2012-01-02 Jason Merrill <jason@redhat.com> + + PR c++/51675 + * g++.dg/cpp0x/constexpr-union2.C: New. + + PR c++/51666 + * g++.dg/cpp0x/nsdmi-defer5.C: New. + +2012-01-02 Dodji Seketeli <dodji@redhat.com> + + PR c++/51462 + * g++.dg/cpp0x/constexpr-99.C: New test. + +2012-01-02 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/20140 + * g++.dg/template/init9.C: New. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * gcc.dg/memcpy-4.c: Add nomips16 attribute for MIPS targets. + Increase copy to 5 bytes. Look for at least two "mem/s/u"s, + rather than a specific number. + +2012-01-02 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/46262 + PR fortran/46328 + PR fortran/51052 + * gfortran.dg/typebound_operator_7.f03: New. + * gfortran.dg/typebound_operator_8.f03: New. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + PR target/51729 + * gcc.target/mips/dspr2-MULT.c: Remove -ffixed-hi -ffixed-lo. + XFAIL. + * gcc.target/mips/dspr2-MULTU.c: Likewise. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * gcc.dg/pr46309.c: Add -mtune=octeon2 for MIPS. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * g++.dg/cpp0x/constexpr-rom.C: Look for .rdata rather than rodata + for MIPS. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * gfortran.dg/io_real_boz_3.f90: Require fortran_real_16. + * gfortran.dg/io_real_boz_4.f90: Likewise. + * gfortran.dg/io_real_boz_5.f90: Likewise. + +2012-01-02 Richard Sandiford <rdsandiford@googlemail.com> + + * g++.dg/opt/devirt2.C: Add -mno-abicalls for MIPS. + +2012-01-02 Revital Eres <revital.eres@linaro.org> + + * gcc.dg/sms-11.c: New file. + +2012-01-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/51682 + * gfortran.dg/coarray/image_index_3.f90: New. + +2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/16603 + * g++.dg/parse/enum8.C: New. + +2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51379 + * g++.dg/conversion/reinterpret4.C: New. + * g++.dg/conversion/reinterpret1.C: Adjust. + +2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> + + * g++.dg/cpp0x/constexpr-delegating2.C: Add missing piece. + +2012-01-01 Fabien Chêne <fabien@gcc.gnu.org> + + * g++.old-deja/g++.brendan/crash25.C: Adjust. + * g++.old-deja/g++.brendan/crash56.C: Likewise. + * g++.old-deja/g++.jason/access14.C: Likewise. + * g++.old-deja/g++.jason/access8.C: Likewise. + * g++.old-deja/g++.jason/access1.C: Likewise. + * g++.old-deja/g++.other/access3.C: Likewise. + * g++.old-deja/g++.other/access5.C: Likewise. + * g++.old-deja/g++.law/unsorted1.C: Likewise. + * g++.old-deja/g++.law/visibility22.C: Likewise. + * g++.old-deja/g++.law/visibility26.C: Likewise. + * g++.old-deja/g++.mike/p2746.C: Likewise. + * g++.dg/debug/using1.C: Likewise. + * g++.dg/lookup/using51.C: Likewise. + * g++.dg/inherit/using5.C: Likewise. + * g++.dg/inherit/pr30297.C: Likewise. + * g++.dg/inherit/access8.C: Likewise. + * g++.dg/torture/pr39362.C: Likewise. + * g++.dg/template/crash13.C: Likewise. + * g++.dg/template/using10.C: Likewise. + +2012-01-01 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/51502 + * lib/gcc-dg.exp (scan-module-absence): Really commit last + change. + +2012-01-01 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/51704 + * gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90: New. + * gfortran.dg/vect/vect.exp: Run no-fre-no-copy-prop-O3-* with + corresponding flags. + +2012-01-01 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51723 + * g++.dg/cpp0x/constexpr-delegating2.C: New. + +2012-01-01 Jan Hubicka <jh@suse.cz> + + PR rtl-optimization/51069 + * gcc.c-torture/compile/pr51069.c: New testcase. + +2012-01-01 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/51683 + * gcc.dg/pr51683.c: New test. + +2011-12-31 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51397 + * g++.dg/cpp0x/static_assert6.C: New. + +2011-12-31 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/tree-ssa/vrp47: Pass -march=i586 for ia32 target. + +2011-12-31 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/51502 + * lib/gcc-dg.exp (scan-module-absence): New function. + * gfortran.dg/implicit_pure_2.f90: New test. + +2011-12-30 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51316 + * g++.dg/cpp0x/alignof4.C: New. + +2011-12-29 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR testsuite/51702 + * gcc.dg/scal-to-vec1.c: If 32-bit powerpc-linux, add the + -mabi=altivec option, which suppresses a warning message about + passing vectors by reference. The extra warning causes some tests + to fail. + * gcc.dg/scal-to-vec2.c: Likewise. + * gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c: Likewise. + * gcc.dg/pr35442.c: Likewise. + * gcc.dg/vector-compare-1.c: Likewise. + * gcc.dg/vector-compare-2.c: Likewise. + * gcc.dg/torture/pr36891.c: Likewise. + +2012-12-29 Kai Tietz <ktietz@redhat.com> + + * g++.dg/abi/bitfield3.C: Make sure test runs + for windows targets without activated ms-bitfields option. + + * g++.old-deja/g++.brendan/new3.C: Adjust test for mingw + targets to use static-version. + * g++.old-deja/g++.abi/cxa_vec.C: Likewise. + * g++.old-deja/g++.abi/arraynew.C: Likewise. + * g++.old-deja/g++.eh/new1.C: Likewise. + * g++.old-deja/g++.eh/new2.C: Likewise. + +2011-12-29 Thomas Koenig <tkoenig@gcc.gnu.org> + + * gfortran.dg/function_optimize_9.f90: New test. + +2011-12-27 Fabien Chêne <fabien@gcc.gnu.org> + + PR c++/23211 + * g++.dg/template/using18.C: New. + * g++.dg/template/using19.C: New. + * g++.dg/template/nested3.C: Remove dg-message at instantiation. + * g++.dg/template/crash13.C: Likewise. + +2011-12-28 Michael Meissner <meissner@linux.vnet.ibm.com> + + PR target/51623 + * gcc.target/powerpc/pr51623.c: New file. + +2011-12-28 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/torture/pr50396.c: Use dg-add-options ieee. + +2011-12-27 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51547 + * g++.dg/cpp0x/pr51547.C: New. + +2011-12-27 Eric Botcazou <ebotcazou@adacore.com> + + * gcc.c-torture/execute/20111227-1.c: New test. + +2011-12-25 Jan Hubicka <jh@suse.cz> + + PR middle-end/48641 + * gcc.dg/compile/pr48641.c: New file. + +2011-12-26 Joey Ye <joey.ye@arm.com> + + PR middle-end/51200 + * gcc.dg/volatile-bitfields-2.c: New test. + +2011-12-23 Jason Merrill <jason@redhat.com> + + PR c++/51507 + * g++.dg/cpp0x/variadic121.C: New. + +2011-12-23 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/vect/fast-math-pr35982.c: Fix parenthesis in target selectors. + +2011-12-23 Dmitry Plotnikov <dplotnikov@ispras.ru> + + * gcc.target/arm/vect-vcvt.c: New test. + * gcc.target/arm/vect-vcvtq.c: New test. + + * gcc.dg/vect/fast-math-pr35982.c: Added vect_strided2 alternative + in final check. + + * lib/target-supports.exp (check_effective_target_vect_intfloat_cvt): + True for ARM NEON. + (check_effective_target_vect_uintfloat_cvt): Likewise. + (check_effective_target_vect_floatuint_cvt): Likewise. + (check_effective_target_vect_floatint_cvt): Likewise. + +2011-12-23 Richard Guenther <rguenther@suse.de> + + PR rtl-optimization/50396 + * gcc.dg/torture/pr50396.c: New testcase. + +2011-12-22 Bin Cheng <bin.cheng@arm.com> + + PR tree-optimization/43491 + * gcc.dg/tree-ssa/pr43491.c: New test. + +2011-12-22 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR testsuite/50722 + * gcc.dg/pr49994-3.c: Skip on ia64-*-*-*, hppa*-*-* and *-*-hpux*. + +2011-12-22 Richard Guenther <rguenther@suse.de> + + PR lto/51650 + * g++.dg/lto/pr51650-1_0.C: New testcase. + * g++.dg/lto/pr51650-2_0.C: Likewise. + +2011-12-21 Richard Earnshaw <rearnsha@arm.com> + + PR target/51643 + * gcc.target/arm/sibcall-2.c: New test. + +2011-12-22 Uros Bizjak <ubizjak@gmail.com> + + PR testsuite/51645 + * g++.dg/cpp0x/alias-decl-debug-0.C: Add dg-skip-if. + +2011-12-21 Uros Bizjak <ubizjak@gmail.com> + + * gcc.dg/pr50038.c: Move to ... + * gcc.target/i386/pr50038.c: ... here. Test on all targets. + +2011-12-21 Jason Merrill <jason@redhat.com> + + PR c++/51611 + * g++.dg/cpp0x/nsdmi-virtual1.C: New. + +2011-12-21 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/51305 + * g++.dg/cpp0x/constexpr-noexcept6.C: New. + +2011-12-21 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/51644 + PR middle-end/51647 + * gcc.dg/pr51644.c: New test. + * g++.dg/warn/Wreturn-4.C: New test. + +2011-12-21 Michael Zolotukhin <michael.v.zolotukhin@intel.com> + + * gcc.dg/vect/no-section-anchors-vect-31.c: Adjust array size and test + diag-scans to fix fail on AVX. + * gcc.dg/vect/no-section-anchors-vect-36.c: Ditto. + * gcc.dg/vect/no-section-anchors-vect-64.c: Ditto. + * gcc.dg/vect/no-section-anchors-vect-66.c: Ditto. + * gcc.dg/vect/no-section-anchors-vect-68.c: Ditto. + * gcc.dg/vect/no-section-anchors-vect-69.c: Ditto. + * gcc.dg/vect/no-vfa-vect-dv-2.c: Adjust dg-scans. + * gcc.dg/vect/pr45752.c: Ditto. + * gcc.dg/vect/slp-perm-4.c: Ditto. + * gcc.dg/vect/slp-perm-9.c: Ditto. + * gcc.dg/vect/vect-33.c: Ditto. + * gcc.dg/vect/vect-35.c: Ditto. + * gcc.dg/vect/vect-6-big-array.c: Ditto. + * gcc.dg/vect/vect-6.c: Ditto. + * gcc.dg/vect/vect-91.c: Ditto. + * gcc.dg/vect/vect-all-big-array.c: Ditto. + * gcc.dg/vect/vect-all.c: Ditto. + * gcc.dg/vect/vect-multitypes-1.c: Ditto. + * gcc.dg/vect/vect-outer-4c.c: Ditto. + * gcc.dg/vect/vect-outer-5.c: Ditto. + * gcc.dg/vect/vect-over-widen-1.c: Ditto. + * gcc.dg/vect/vect-over-widen-3.c: Ditto. + * gcc.dg/vect/vect-over-widen-4.c: Ditto. + * gcc.dg/vect/vect-peel-1.c: Ditto. + * gcc.dg/vect/vect-peel-2.c: Ditto. + * gcc.dg/vect/vect-peel-3.c: Ditto. + * gcc.dg/vect/vect-reduc-pattern-1b.c: Ditto. + * gcc.dg/vect/vect-reduc-pattern-1c.c: Ditto. + * gcc.dg/vect/vect-reduc-pattern-2b.c: Ditto. + * gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c: Ditto. + * lib/target-supports.exp (check_avx_available): New function. + (check_effective_target_vect_sizes_32B_16B): Ditto. + (check_prefer_avx128): Ditto. + (check_effective_target_vect_aligned_arrays): Add handling of AVX. + (check_effective_target_vect_multiple_sizes): Ditto. + +2011-12-21 Enkovich Ilya <ilya.enkovich@intel.com> + + PR target/50038 + * gcc.dg/pr50038.c: New test. + 2011-12-20 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51621 diff --git a/gcc/testsuite/g++.dg/abi/bitfield3.C b/gcc/testsuite/g++.dg/abi/bitfield3.C index 632bc5ca2f9..6908ab6e7be 100644 --- a/gcc/testsuite/g++.dg/abi/bitfield3.C +++ b/gcc/testsuite/g++.dg/abi/bitfield3.C @@ -1,9 +1,12 @@ // Test for oversized bitfield alignment in structs on IA-32 // { dg-do run { target { { i?86-*-* x86_64-*-* } && ia32 } } } // { dg-options "-O2" } -// Cygwin and mingw32 default to MASK_ALIGN_DOUBLE. Override to ensure +// Cygwin and mingw default to MASK_ALIGN_DOUBLE. Override to ensure // 4-byte alignment. -// { dg-options "-mno-align-double" { target i?86-*-cygwin* i?86-*-mingw* } } +// { dg-additional-options "-mno-align-double" { target i?86-*-cygwin* i?86-*-mingw* } } +// As for mingw target the ms-bitfield switch is activated by default, +// make sure for this test that it is disabled. +// { dg-additional-options "-mno-ms-bitfields" { target i?86-*-mingw* } } struct A { diff --git a/gcc/testsuite/g++.dg/conversion/reinterpret1.C b/gcc/testsuite/g++.dg/conversion/reinterpret1.C index d4567822e2a..aa55f6f4cf5 100644 --- a/gcc/testsuite/g++.dg/conversion/reinterpret1.C +++ b/gcc/testsuite/g++.dg/conversion/reinterpret1.C @@ -3,4 +3,4 @@ struct Y { Y(int &); }; int v; -Y y1(reinterpret_cast<int>(v)); // { dg-error "" } +Y y1(reinterpret_cast<int>(v)); diff --git a/gcc/testsuite/g++.dg/conversion/reinterpret4.C b/gcc/testsuite/g++.dg/conversion/reinterpret4.C new file mode 100644 index 00000000000..71575a1abe5 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/reinterpret4.C @@ -0,0 +1,4 @@ +// PR c++/51379 + +unsigned long t1 = 1; +unsigned long t2 = reinterpret_cast<unsigned long>(t1); diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C index 4c00bdd4046..63655286b03 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-debug-0.C @@ -1,4 +1,5 @@ // Origin: PR c++/51032 +// { dg-skip-if "No stabs" { mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* *-*-vxworks* } { "*" } { "" } } // { dg-options "-std=c++0x -gstabs+" } template <class C> diff --git a/gcc/testsuite/g++.dg/cpp0x/alignof4.C b/gcc/testsuite/g++.dg/cpp0x/alignof4.C new file mode 100644 index 00000000000..92d636faf09 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alignof4.C @@ -0,0 +1,7 @@ +// PR c++/51316 +// { dg-options "-std=c++0x" } + +int main() +{ + alignof(int []); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-99.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-99.C new file mode 100644 index 00000000000..13a5ea3e6c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-99.C @@ -0,0 +1,13 @@ +// Origin PR c++/51462 +// { dg-options "-std=c++11" } + +struct A +{ + int i = 0; +}; + +struct B +{ + A a; + constexpr B() : a(0) {} // { dg-error "no matching function" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating2.C new file mode 100644 index 00000000000..c85ed2e8191 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-delegating2.C @@ -0,0 +1,28 @@ +// PR c++/51723 +// { dg-options -std=c++0x } + +template <int... V> +struct A +{ + static constexpr int a[sizeof...(V)] = { V... }; +}; + +template <int... V> constexpr int A<V...>::a[]; + +struct B +{ + const int* const b; + + template <unsigned int N> + constexpr B(const int(&b)[N]) + : b(b) + { } + + template <int... V> + constexpr B(A<V...>) + : B(A<V...>::a) + { } +}; + +constexpr B b1 = A<10, 20, 30>::a; +constexpr B b2 = A<10, 20, 30>(); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept6.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept6.C new file mode 100644 index 00000000000..91e93fd91bc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept6.C @@ -0,0 +1,10 @@ +// PR c++/51305 +// { dg-options -std=c++0x } + +constexpr bool ok() noexcept +{ + typedef int type; + return true; +} + +constexpr auto x = ok(); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C index 144be2d9f1b..aa9ff5d7c42 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C @@ -1,6 +1,7 @@ // PR c++/49673: check that test_data goes into .rodata // { dg-options -std=c++0x } -// { dg-final { scan-assembler "rodata" { target { *-*-linux-gnu || *-*-elf } } } } +// { dg-final { scan-assembler "\\.rdata" { target mips*-*-* } } } +// { dg-final { scan-assembler "rodata" { target { { *-*-linux-gnu || *-*-elf } && { ! mips*-*-* } } } } } struct Data { diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-union2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-union2.C new file mode 100644 index 00000000000..0bf2aa7e2bc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-union2.C @@ -0,0 +1,18 @@ +// PR c++/51675 +// { dg-options -std=c++0x } + +union foo +{ + int x = 0; + short y; + + constexpr foo() = default; +}; + +union bar +{ + int x; + short y; + + constexpr bar() = default; // { dg-error "constexpr" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-defer5.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-defer5.C new file mode 100644 index 00000000000..85abfbf8618 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-defer5.C @@ -0,0 +1,20 @@ +// PR c++/51666 (DR 325) +// { dg-options -std=c++0x } + +template<typename T, typename U> +struct tuple +{ + tuple(T, U) { } +}; + +struct Y +{ + tuple<int, int> tt = tuple<int, int>{1, 2}; +}; + +struct A +{ + int i = 0; + int j = i < 42, k; // OK, declares j and k + int l = i < 42, 24; // { dg-error "" } +}; diff --git a/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1.C b/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1.C new file mode 100644 index 00000000000..4aa8d482da8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/nsdmi-virtual1.C @@ -0,0 +1,26 @@ +// PR c++/51611 +// { dg-options -std=c++0x } +// { dg-do run } + +struct A +{ + A(): i(42) { } + int i; + int f() { return i; } +}; + +struct B : virtual A +{ + int j = i + f(); + int k = A::i + A::f(); +}; + +struct C: B { int pad; }; + +int main() +{ + C c; + if (c.j != 84 || c.k != 84) + __builtin_abort(); +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51547.C b/gcc/testsuite/g++.dg/cpp0x/pr51547.C new file mode 100644 index 00000000000..80215f6a341 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr51547.C @@ -0,0 +1,50 @@ +// PR c++/51547 +// { dg-options "-std=c++0x" } + +template <class T> +struct vector +{ + T* + begin() + { return &member; } + + const T* + begin() const + { return &member; } + + T member; +}; + +struct Bar { + int x; +}; + +struct Foo { + const vector<Bar>& bar() const { + return bar_; + } + + vector<Bar> bar_; +}; + +template <class X> +struct Y { + void foo() { + Foo a; + auto b = a.bar().begin(); + auto&& c = b->x; + } +}; + +template <class X> +void foo() { + Foo a; + auto b = a.bar().begin(); + auto&& c = b->x; +} + +int main() { + Y<int> p; + p.foo(); + foo<int>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert6.C b/gcc/testsuite/g++.dg/cpp0x/static_assert6.C new file mode 100644 index 00000000000..d1ab0dded9d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert6.C @@ -0,0 +1,4 @@ +// PR c++/51397 +// { dg-options "-std=c++0x" } + +static_assert('X' != '\130', "'X' has the wrong value"); // { dg-error "'X' has the wrong value" } diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic121.C b/gcc/testsuite/g++.dg/cpp0x/variadic121.C new file mode 100644 index 00000000000..805c0065fe9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic121.C @@ -0,0 +1,12 @@ +// PR c++/51507 +// { dg-options -std=c++0x } + +template<typename ...> +struct foo { typedef void type; }; +template<typename ...Ts> +auto g(Ts ...ts)-> + typename foo<decltype(ts)...>::type +{} +int main() { + g(42); +} diff --git a/gcc/testsuite/g++.dg/debug/using1.C b/gcc/testsuite/g++.dg/debug/using1.C index d3168fc6c1c..7b13e53bb09 100644 --- a/gcc/testsuite/g++.dg/debug/using1.C +++ b/gcc/testsuite/g++.dg/debug/using1.C @@ -9,7 +9,7 @@ struct A struct B : public A { - A::d; + A::d; // { dg-warning "deprecated" } }; B b; diff --git a/gcc/testsuite/g++.dg/gomp/pr51669.C b/gcc/testsuite/g++.dg/gomp/pr51669.C new file mode 100644 index 00000000000..d5294dded03 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr51669.C @@ -0,0 +1,32 @@ +// PR c++/51669 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template <typename T> const T & min (const T &, const T &); + +void +f1 () +{ +#pragma omp parallel num_threads (min (4, 5)) + ; +} + +struct A { A (); ~A (); }; +int foo (const A &); + +void +f2 () +{ + int i; +#pragma omp parallel if (foo (A ())) num_threads (foo (A ())) + ; +#pragma omp task if (foo (A ())) final (foo (A ())) + ; +#pragma omp for schedule (static, foo (A ())) + for (i = 0; i < 10; i++) + ; +#pragma omp parallel for schedule (static, foo (A ())) \ + if (foo (A ())) num_threads (foo (A ())) + for (i = 0; i < 10; i++) + ; +} diff --git a/gcc/testsuite/g++.dg/inherit/access8.C b/gcc/testsuite/g++.dg/inherit/access8.C index a11ea8e0494..310b7a01a39 100644 --- a/gcc/testsuite/g++.dg/inherit/access8.C +++ b/gcc/testsuite/g++.dg/inherit/access8.C @@ -13,8 +13,8 @@ public: class B : private A { public: - A::i; - A::A1; + A::i; // { dg-warning "deprecated" } + A::A1; // { dg-warning "deprecated" } }; void diff --git a/gcc/testsuite/g++.dg/inherit/pr30297.C b/gcc/testsuite/g++.dg/inherit/pr30297.C index 222d9ab8059..a8edf84852b 100644 --- a/gcc/testsuite/g++.dg/inherit/pr30297.C +++ b/gcc/testsuite/g++.dg/inherit/pr30297.C @@ -7,5 +7,5 @@ struct A extern "C" struct B : A { - A::i; + A::i; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.dg/lookup/using51.C b/gcc/testsuite/g++.dg/lookup/using51.C index 8438f7f2cc8..8e3e56b056f 100644 --- a/gcc/testsuite/g++.dg/lookup/using51.C +++ b/gcc/testsuite/g++.dg/lookup/using51.C @@ -1,5 +1,6 @@ // PR c++/51382 // { dg-do compile } +// { dg-options "-Wno-deprecated" } template< int Value > struct Base diff --git a/gcc/testsuite/g++.dg/lto/pr51650-1_0.C b/gcc/testsuite/g++.dg/lto/pr51650-1_0.C new file mode 100644 index 00000000000..4c9ef3c8c48 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51650-1_0.C @@ -0,0 +1,19 @@ +// { dg-lto-do link } +// { dg-lto-options { { -flto -g } } } + +struct T; +struct C +{ + typedef ::T T; + static T *m () + { + static T *d; + return d; + } +}; +int +fn () +{ + C::m (); +} +int main() {} diff --git a/gcc/testsuite/g++.dg/lto/pr51650-2_0.C b/gcc/testsuite/g++.dg/lto/pr51650-2_0.C new file mode 100644 index 00000000000..0979674af35 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr51650-2_0.C @@ -0,0 +1,9 @@ +// { dg-lto-do link } +// { dg-lto-options { { -flto -g } } } + +typedef struct { } X; +int main () +{ + typedef X **P; + P g = 0; +} diff --git a/gcc/testsuite/g++.dg/opt/devirt2.C b/gcc/testsuite/g++.dg/opt/devirt2.C index 1198abdd776..092fd686a67 100644 --- a/gcc/testsuite/g++.dg/opt/devirt2.C +++ b/gcc/testsuite/g++.dg/opt/devirt2.C @@ -3,6 +3,8 @@ /* Using -mshort-calls avoids loading the function addresses in registers and thus getting the counts wrong. */ // { dg-additional-options "-mshort-calls" {target epiphany-*-*} } +// Using -mno-abicalls avoids a R_MIPS_JALR .reloc. +// { dg-additional-options "-mno-abicalls" { target mips*-*-* } } // { dg-final { scan-assembler-times "xyzzy" 2 { target { ! { alpha*-*-* hppa*-*-* ia64*-*-hpux* sparc*-*-* } } } } } // The IA64 and HPPA compilers generate external declarations in addition // to the call so those scans need to be more specific. diff --git a/gcc/testsuite/g++.dg/parse/enum8.C b/gcc/testsuite/g++.dg/parse/enum8.C new file mode 100644 index 00000000000..83dd6e0e18f --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/enum8.C @@ -0,0 +1,11 @@ +// PR c++/16603 + +char const c = 'q'; + +enum + { + x = c, + y = sizeof(x) + }; + +int test[y == sizeof(char) ? 1 : -1]; diff --git a/gcc/testsuite/g++.dg/template/crash13.C b/gcc/testsuite/g++.dg/template/crash13.C index 917ddf09f10..14bec68e9b3 100644 --- a/gcc/testsuite/g++.dg/template/crash13.C +++ b/gcc/testsuite/g++.dg/template/crash13.C @@ -13,6 +13,7 @@ template <typename T> struct C { typedef typename A<T>::B X; X::Y; // { dg-error "not a base type" } +// { dg-warning "deprecated" "" { target *-*-* } 15 } }; -C<void> c; // { dg-message "required" } +C<void> c; diff --git a/gcc/testsuite/g++.dg/template/init9.C b/gcc/testsuite/g++.dg/template/init9.C new file mode 100644 index 00000000000..d33c7da17b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/init9.C @@ -0,0 +1,12 @@ +// PR c++/20140 + +template<typename T> void foo() +{ + unsigned char s[] = ""; +} + +int main() +{ + foo<char>(); + foo<int>(); +} diff --git a/gcc/testsuite/g++.dg/template/nested3.C b/gcc/testsuite/g++.dg/template/nested3.C index 4544cc903b4..5dcbf1961fa 100644 --- a/gcc/testsuite/g++.dg/template/nested3.C +++ b/gcc/testsuite/g++.dg/template/nested3.C @@ -24,7 +24,7 @@ class B { int main() { - B<char> objB; // { dg-message "required" } + B<char> objB; return 0; } diff --git a/gcc/testsuite/g++.dg/template/using10.C b/gcc/testsuite/g++.dg/template/using10.C index 8f0cbda2a88..902773cd51d 100644 --- a/gcc/testsuite/g++.dg/template/using10.C +++ b/gcc/testsuite/g++.dg/template/using10.C @@ -7,5 +7,5 @@ struct B { template <typename T> class I : public B {}; template <typename T> class D : private I<T> { - I<T>::B::foo; + I<T>::B::foo; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.dg/template/using18.C b/gcc/testsuite/g++.dg/template/using18.C new file mode 100644 index 00000000000..b4ef6df478c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/using18.C @@ -0,0 +1,31 @@ +// PR c++/23211 +// { dg-do compile } + +template<class T> +struct foo +{ + typedef int jtype; + struct bar + { + using typename foo<T>::jtype; // { dg-error "not a base type" } + using foo<T>::jtype; // { dg-error "not a base type" } + }; +}; + +template <class T> +struct A : T +{ + using T::i; + using typename T::type; +}; + +struct B1 {}; +template <class T> struct B2 {}; + +template <class T> +struct C : B1, B2<T> +{ + using B1::x; // { dg-error "no member" } + using B2<T>::y; + using typename B2<T>::type; +}; diff --git a/gcc/testsuite/g++.dg/template/using19.C b/gcc/testsuite/g++.dg/template/using19.C new file mode 100644 index 00000000000..dc89f92ef0e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/using19.C @@ -0,0 +1,12 @@ +// PR c++/23211 +// { dg-do compile } + +struct A { int x; }; + +template <class T> +struct B: A +{ + using T::x; +}; + +B<A> b; diff --git a/gcc/testsuite/g++.dg/tm/pr51212.C b/gcc/testsuite/g++.dg/tm/pr51212.C new file mode 100644 index 00000000000..9d2971bbbe0 --- /dev/null +++ b/gcc/testsuite/g++.dg/tm/pr51212.C @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-fgnu-tm -fnon-call-exceptions" } + +struct S +{ + S () + { + } +}; + +__attribute__ ((transaction_callable)) +void foo (int *p) +{ + S s; + if (*p) + ; +} + +// { dg-message "sorry, unimplemented: transactional memory is not supported with non-call exceptions" "-fnon-call-exceptions and -fgnu-tm together" { target *-*-* } 0 } diff --git a/gcc/testsuite/g++.dg/torture/pr39362.C b/gcc/testsuite/g++.dg/torture/pr39362.C index e7b0774d96f..554f9d06bac 100644 --- a/gcc/testsuite/g++.dg/torture/pr39362.C +++ b/gcc/testsuite/g++.dg/torture/pr39362.C @@ -57,7 +57,7 @@ template <typename T> struct I <T, 0> : H <T> I (int capacity) { allocateBuffer (capacity); } ~I () { this->deallocateBuffer (buffer ()); } using H <T>::allocateBuffer; - H <T>::buffer; + H <T>::buffer; // { dg-warning "deprecated" } }; template <typename T, int cap = 0> struct J { diff --git a/gcc/testsuite/g++.dg/tree-prof/pr51719.C b/gcc/testsuite/g++.dg/tree-prof/pr51719.C new file mode 100644 index 00000000000..01e81ff66ed --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-prof/pr51719.C @@ -0,0 +1,27 @@ +// PR tree-optimization/51719 +// { dg-options "-O -fpartial-inlining" } + +int +bar (void) +{ + throw 1; +} + +int __attribute__ ((noinline, noclone)) +foo (int (*f) (void)) +{ + try + { + return (*f) (); + } + catch (...) + { + } + return 0; +} + +int +main () +{ + return foo (bar); +} diff --git a/gcc/testsuite/g++.dg/warn/Wredundant-decls-spec.C b/gcc/testsuite/g++.dg/warn/Wredundant-decls-spec.C new file mode 100644 index 00000000000..b5c790f474b --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wredundant-decls-spec.C @@ -0,0 +1,12 @@ +// PR c++/15867 +// { dg-options -Wredundant-decls } + +template <typename T> struct S +{ + void foo() {} +}; + +template<> void S<int>::foo(); + +template<> void S<double>::foo(); // { dg-warning "previous declaration" } +template<> void S<double>::foo(); // { dg-warning "redundant redeclaration" } diff --git a/gcc/testsuite/g++.dg/warn/Wreturn-4.C b/gcc/testsuite/g++.dg/warn/Wreturn-4.C new file mode 100644 index 00000000000..7d751f2ded0 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wreturn-4.C @@ -0,0 +1,48 @@ +// PR middle-end/51647 +// { dg-do compile } +// { dg-options "-Wall" } + +enum PropertyAttributes { NONE = 1 }; +enum PropertyType { NORMAL = 0, FIELD = 1 }; +class LookupResult; + +template <typename T> +struct Handle +{ + inline explicit Handle (T *obj) __attribute__ ((always_inline)) {} + inline T *operator-> () const __attribute__ ((always_inline)) { return 0; } +}; + +struct JSObject +{ + bool IsGlobalObject () { return false; } +}; + +struct Isolate +{ + LookupResult *top_lookup_result () { return 0; } +}; + +struct LookupResult +{ + explicit LookupResult (Isolate *isolate) {} + JSObject *holder () { return 0; } + PropertyType type () { return NORMAL; } +}; + +int +test (LookupResult *lookup) +{ + Handle <JSObject> holder (lookup->holder ()); + switch (lookup->type ()) + { + case NORMAL: + if (holder->IsGlobalObject ()) + return 2; + else + return 3; + break; + default: + return 4; + } +} // { dg-bogus "control reaches end of non-void function" } diff --git a/gcc/testsuite/g++.old-deja/g++.abi/arraynew.C b/gcc/testsuite/g++.old-deja/g++.abi/arraynew.C index 7efea818be0..2e11caecff6 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/arraynew.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/arraynew.C @@ -1,5 +1,7 @@ // { dg-do run } // Origin: Mark Mitchell <mark@codesourcery.com> +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #if defined (__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 diff --git a/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C b/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C index 8d098bffca8..f3d602ffd32 100644 --- a/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C +++ b/gcc/testsuite/g++.old-deja/g++.abi/cxa_vec.C @@ -5,6 +5,8 @@ // are resolved when the kernel is linked. // { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } // Test __cxa_vec routines // Copyright (C) 2000, 2005 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 7 Apr 2000 <nathan@nathan@codesourcery.com> diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash25.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash25.C index dece6f7dcb7..0c9b963ef25 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash25.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash25.C @@ -14,5 +14,5 @@ public: class buff_head : private port_head { public: static int rep; - port_head::cap; + port_head::cap; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C index e3bff80e610..776041519eb 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/crash56.C @@ -1,5 +1,5 @@ // { dg-do assemble } -// { dg-options "" } +// { dg-options "-Wno-deprecated" } // GROUPS passed old-abort const bool FALSE = 0; diff --git a/gcc/testsuite/g++.old-deja/g++.brendan/new3.C b/gcc/testsuite/g++.old-deja/g++.brendan/new3.C index 55c7dbbb37f..cc716d5c38f 100644 --- a/gcc/testsuite/g++.old-deja/g++.brendan/new3.C +++ b/gcc/testsuite/g++.old-deja/g++.brendan/new3.C @@ -5,6 +5,8 @@ // are resolved when the kernel is linked. // { dg-do run { xfail { powerpc-ibm-aix* || vxworks_kernel } } } // { dg-options "-flat_namespace" { target *-*-darwin[67]* } } +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } // GROUPS passed operator-new #include <stdio.h> #include <stdlib.h> diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new1.C b/gcc/testsuite/g++.old-deja/g++.eh/new1.C index e206f5bc853..929188f6dca 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/new1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/new1.C @@ -1,5 +1,7 @@ // { dg-do run } // Test that a throw in foo destroys the A, but does not free the memory. +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #include <cstddef> #include <cstdlib> diff --git a/gcc/testsuite/g++.old-deja/g++.eh/new2.C b/gcc/testsuite/g++.old-deja/g++.eh/new2.C index d5fd74bcf72..f3e8982a593 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/new2.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/new2.C @@ -1,5 +1,7 @@ // { dg-do run } // Test that a throw in B's constructor destroys the A and frees the memory. +// Avoid use of none-overridable new/delete operators in shared +// { dg-options "-static" { target *-*-mingw* } } #include <cstddef> #include <cstdlib> diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access1.C b/gcc/testsuite/g++.old-deja/g++.jason/access1.C index 9d7104105b4..e7065d9baa0 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access1.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access1.C @@ -8,10 +8,10 @@ public: class B: private A { public: - A::foo; + A::foo; // { dg-warning "deprecated" } }; void foo() { B b; - b.foo (); // { dg-bogus "" } + b.foo (); // { dg-bogus "" } } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access14.C b/gcc/testsuite/g++.old-deja/g++.jason/access14.C index baebfe4cfc0..7edc85764a0 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access14.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access14.C @@ -4,7 +4,7 @@ template <class T> struct A { T t; }; template <class T> class B: private T { public: - T::t; // { dg-bogus "" } doesn't recognize access decl + T::t; // { dg-warning "deprecated" } }; template class B<A<int> >; diff --git a/gcc/testsuite/g++.old-deja/g++.jason/access8.C b/gcc/testsuite/g++.old-deja/g++.jason/access8.C index 0297c106b9e..c488ef76765 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/access8.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/access8.C @@ -12,7 +12,7 @@ protected: class mel : private inh { protected: int t; - inh::myf; + inh::myf; // { dg-warning "deprecated" } }; class top_t : protected mel { diff --git a/gcc/testsuite/g++.old-deja/g++.law/unsorted1.C b/gcc/testsuite/g++.old-deja/g++.law/unsorted1.C index c220d9936b9..14f9ee033a7 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/unsorted1.C +++ b/gcc/testsuite/g++.old-deja/g++.law/unsorted1.C @@ -20,7 +20,7 @@ class B : public A { class C : private B { public: - B::func; + B::func; // { dg-warning "deprecated" } }; class D { diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility22.C b/gcc/testsuite/g++.old-deja/g++.law/visibility22.C index f97ef814763..e3d9d1f6d00 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility22.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility22.C @@ -19,7 +19,7 @@ public: class B : private A { protected: - A::f; + A::f; // { dg-warning "deprecated" } public: - A::g; + A::g; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.law/visibility26.C b/gcc/testsuite/g++.old-deja/g++.law/visibility26.C index cfef2df504f..a6e702180af 100644 --- a/gcc/testsuite/g++.old-deja/g++.law/visibility26.C +++ b/gcc/testsuite/g++.old-deja/g++.law/visibility26.C @@ -14,5 +14,7 @@ class X { class Y : private X { public: void f(int); - X::f; // used to be an error; now equivalent to 'using X::f' + + // 'X::f' used to be an error; now equivalent to 'using X::f' + X::f; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p2746.C b/gcc/testsuite/g++.old-deja/g++.mike/p2746.C index 1bc1ce3591e..3e68740e232 100644 --- a/gcc/testsuite/g++.old-deja/g++.mike/p2746.C +++ b/gcc/testsuite/g++.old-deja/g++.mike/p2746.C @@ -86,7 +86,7 @@ public: void remove(T *p) { IListBase::remove(p); } T *head() { return (T *)IListBase::head(); } T *get() { return (T *)IListBase::get(); } - IListBase::empty; + IListBase::empty; // { dg-warning "deprecated" } friend class IListIter<T>; }; @@ -136,8 +136,8 @@ class IListIter : private IListIterBase { public: IListIter(const IList<T> &list) : IListIterBase(list) { } T *cur() { return (T *)IListIterBase::cur(); } - IListIterBase::next; - IListIterBase::done; + IListIterBase::next; // { dg-warning "deprecated" } + IListIterBase::done; // { dg-warning "deprecated" } }; diff --git a/gcc/testsuite/g++.old-deja/g++.other/access3.C b/gcc/testsuite/g++.old-deja/g++.other/access3.C index 4752ac8a8da..41760899841 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/access3.C +++ b/gcc/testsuite/g++.old-deja/g++.other/access3.C @@ -10,7 +10,7 @@ struct A struct B: private virtual A { - A::f; + A::f; // { dg-warning "deprecated" } }; struct C: private virtual A, public B diff --git a/gcc/testsuite/g++.old-deja/g++.other/access5.C b/gcc/testsuite/g++.old-deja/g++.other/access5.C index 431ba416aac..a6364c567a6 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/access5.C +++ b/gcc/testsuite/g++.old-deja/g++.other/access5.C @@ -9,7 +9,7 @@ protected: class B : private A { protected: - A::i; + A::i; // { dg-warning "deprecated" } }; struct C : public B { diff --git a/gcc/testsuite/gcc.c-torture/compile/pr48641.c b/gcc/testsuite/gcc.c-torture/compile/pr48641.c new file mode 100644 index 00000000000..605d481e257 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr48641.c @@ -0,0 +1,249 @@ +/* { dg-options "-O -fno-tree-ccp -fno-tree-copy-prop" } */ +#define CSF __builtin_copysignf +#define CSD __builtin_copysign +#define CSL __builtin_copysignl +#define MODFF __builtin_modff +#define MODFD __builtin_modf +#define MODFL __builtin_modfl + +extern void link_error (void); + +void +foo (void) +{ + float iptrf; + double iptr; + long double iptrl; + long long iptrll; + if ((CSF (1.0F, MODFF (0x1p10F + 0.5f, &iptrf)) != CSF (1.0F, 0.5f)) + || (CSF (1.0F, iptrf) != 0x1p10f)) + link_error (); + if (MODFD (0x1p10F + 0.5, &iptr) != 0.5 + || (CSD (1.0, MODFD (0x1p10F + 0.5, &iptr)) != CSD (1.0, 0.5)) + || (CSD (1.0, iptr) != CSD (1.0, 0x1p10))) + link_error (); + if (MODFL (0x1p10F + 0.5l, &iptrl) != 0.5l + || (CSL (1.0L, MODFL (0x1p10F + 0.5l, &iptrl)) != CSL (1.0L, 0.5l)) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0x1p10l))) + link_error (); + if ((CSF (1.0F, (MODFF (0x1p10F + 0x1p-10f, &iptrf))) + != CSF (1.0F, 0x1p-10f)) + || (CSF (1.0F, iptrf) != CSF (1.0F, 0x1p10f))) + link_error (); + if (MODFD (0x1p10F + 0x1p-10, &iptr) != 0x1p-10 + || (CSD (1.0, (MODFD (0x1p10F + 0x1p-10, &iptr))) + != CSD (1.0, 0x1p-10)) || (CSD (1.0, iptr) != CSD (1.0, 0x1p10))) + link_error (); + if (MODFL (0x1p10F + 0x1p-10l, &iptrl) != 0x1p-10l + || (CSL (1.0L, (MODFL (0x1p10F + 0x1p-10l, &iptrl))) + != CSL (1.0L, 0x1p-10l)) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0x1p10l))) + link_error (); + if ((CSF (1.0F, (MODFF (12345678L / 17.0f, &iptrf))) + != CSF (1.0F, (-726216L + 12345678L / 17.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 726216.0f))) + link_error (); + if (MODFD (12345678L / 17.0, &iptr) != -726216L + 12345678L / 17.0 + || (CSD (1.0, (MODFD (12345678L / 17.0, &iptr))) + != CSD (1.0, (-726216L + 12345678L / 17.0))) + || (CSD (1.0, iptr) != CSD (1.0, 726216.0))) + link_error (); + if ((CSL (1.0L, (MODFL (12345678L / 17.0l, &iptrl))) + != CSL (1.0L, (-726216L + 12345678L / 17.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 726216.0l))) + link_error (); + if (MODFF (555.555f, &iptrf) != -555 + 555.555f + || (CSF (1.0F, iptrf) != CSF (1.0F, 555.0f))) + link_error (); + if (MODFD (555.555, &iptr) != -555 + 555.555 + || (CSD (1.0, (MODFD (555.555, &iptr))) != CSD (1.0, (-555 + 555.555))) + || (CSD (1.0, iptr) != CSD (1.0, 555.0))) + link_error (); + if (MODFL (555.555l, &iptrl) != -555 + 555.555l + || (CSL (1.0L, (MODFL (555.555l, &iptrl))) + != CSL (1.0L, (-555 + 555.555l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 555.0l))) + link_error (); + if (MODFF (5000 / 11.0f, &iptrf) != -454 + 5000 / 11.0f + || (CSF (1.0F, (MODFF (5000 / 11.0f, &iptrf))) + != CSF (1.0F, (-454 + 5000 / 11.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 454.0f))) + link_error (); + if (MODFD (5000 / 11.0, &iptr) != -454 + 5000 / 11.0 + || (CSD (1.0, (MODFD (5000 / 11.0, &iptr))) + != CSD (1.0, (-454 + 5000 / 11.0))) + || (CSD (1.0, iptr) != CSD (1.0, 454.0))) + link_error (); + if ((CSL (1.0L, (MODFL (5000 / 11.0l, &iptrl))) + != CSL (1.0L, (-454 + 5000 / 11.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 454.0l))) + link_error (); + if ((CSF (1.0F, (MODFF (1000 / 7.0f, &iptrf))) + != CSF (1.0F, (-142 + 1000 / 7.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 142.0f))) + link_error (); + if ((CSD (1.0, (MODFD (1000 / 7.0, &iptr))) + != CSD (1.0, (-142 + 1000 / 7.0))) + || (CSD (1.0, iptr) != CSD (1.0, 142.0))) + link_error (); + if ((CSL (1.0L, (MODFL (1000 / 7.0l, &iptrl))) + != CSL (1.0L, (-142 + 1000 / 7.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 142.0l))) + link_error (); + if (MODFF (123 / 7.0f, &iptrf) != -17 + 123 / 7.0f + || (CSF (1.0F, iptrf) != CSF (1.0F, 17.0f))) + link_error (); + if (MODFD (123 / 7.0, &iptr) != -17 + 123 / 7.0 + || (CSD (1.0, iptr) != CSD (1.0, 17.0))) + link_error (); + if ((CSL (1.0L, (MODFL (123 / 7.0l, &iptrl))) + != CSL (1.0L, (-17 + 123 / 7.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 17.0l))) + link_error (); + if ((CSF (1.0F, (MODFF (117 / 7.0f, &iptrf))) + != CSF (1.0F, (-16 + 117 / 7.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 16.0f))) + link_error (); + if ((CSD (1.0, (MODFD (117 / 7.0, &iptr))) != CSD (1.0, (-16 + 117 / 7.0))) + || (CSD (1.0, iptr) != CSD (1.0, 16.0))) + link_error (); + if (MODFL (117 / 7.0l, &iptrl) != -16 + 117 / 7.0l + || (CSL (1.0L, iptrl) != CSL (1.0L, 16.0l))) + link_error (); + if (MODFF (5.5f, &iptrf) != 0.5f || (CSF (1.0F, iptrf) != CSF (1.0F, 5.0f))) + link_error (); + if (MODFD (5.5, &iptr) != 0.5 || (CSD (1.0, iptr) != CSD (1.0, 5.0))) + link_error (); + if (MODFL (5.5l, &iptrl) != 0.5l || (CSL (1.0L, iptrl) != CSL (1.0L, 5.0l))) + link_error (); + if ((CSF (1.0F, (MODFF (1.5f, &iptrf))) != CSF (1.0F, 0.5f)) + || (CSF (1.0F, iptrf) != 1.0f)) + link_error (); + if ((CSD (1.0, (MODFD (1.5, &iptr))) != CSD (1.0, 0.5)) + || (CSD (1.0, iptr) != 1.0)) + link_error (); + if (MODFL (1.5l, &iptrl) != iptrl != 1.0l || (CSL (1.0L, iptrl) != 1.0l)) + link_error (); + if (MODFF (4 / 3.0f, &iptrf) != -1 + 4 / 3.0f + || (CSF (1.0F, (MODFF (4 / 3.0f, &iptrf))) + != CSF (1.0F, (-1 + 4 / 3.0f))) || (CSF (1.0F, iptrf) != (1.0F))) + link_error (); + if (MODFD (4 / 3.0, &iptr) != -1 + 4 / 3.0 || (CSD (1.0, iptr) != 1.0)) + link_error (); + if (MODFL (4 / 3.0l, &iptrl) != iptrl != 1.0l + || (CSL (1.0L, iptrl) != 1.0l)) + link_error (); + if ((((MODFF (1.0f, &iptrf)))) || (CSF (1.0F, iptrf) != 1.0f)) + link_error (); + if ((((MODFD (1.0, &iptr))) != 0.0) || (CSD (1.0, iptr) != 1.0)) + link_error (); + if ((((MODFL (1.0l, &iptrl))) != 0.0l) || (CSL (1.0L, iptrl) != 1.0l)) + link_error (); + if (MODFF (0.5f, &iptrf) != 0.5f || (CSF (1.0F, iptrf) != CSF (1.0F, 0.0f))) + link_error (); + if (MODFD (0.5, &iptr) != 0.5 || (CSD (1.0, iptr) != CSD (1.0, 0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (0.5l, &iptrl))) != CSL (1.0L, 0.5l)) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0.0l))) + link_error (); + if (MODFF (4 / 9.0f, &iptrf) != 4 / 9.0f + != (CSF (1.0F, (MODFF (4 / 9.0f, &iptrf))) != CSF (1.0F, (4 / 9.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 0.0f))) + link_error (); + if (MODFD (4 / 9.0, &iptr) != 4 / 9.0 + || (CSD (1.0, iptr) != CSD (1.0, 0.0))) + link_error (); + if (MODFL (4 / 9.0l, &iptrl) != 4 / 9.0l + || (CSL (1.0L, iptrl) != CSL (1.0L, 0.0l))) + link_error (); + if (MODFF (1 / 3.0f, &iptrf) != 1 / 3.0f + || (CSF (1.0F, iptrf) != CSF (1.0F, 0.0f))) + link_error (); + if (MODFD (1 / 3.0, &iptr) != 1 / 3.0 + || (CSD (1.0, iptr) != CSD (1.0, 0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (1 / 3.0l, &iptrl))) != CSL (1.0L, (1 / 3.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0.0l))) + link_error (); + if ((CSF (1.0F, (MODFF (1 / 9.0f, &iptrf))) != CSF (1.0F, (1 / 9.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, 0.0f))) + link_error (); + if (MODFD (1 / 9.0, &iptr) != 1 / 9.0 + || (CSD (1.0, iptr) != CSD (1.0, 0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (1 / 9.0l, &iptrl))) != CSL (1.0L, (1 / 9.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0.0l))) + link_error (); + if ((((MODFF (0.0f, &iptrf)))) || (CSF (1.0F, iptrf) != CSF (1.0F, 0.0f))) + link_error (); + if ((((MODFD (0.0, &iptr)))) || (CSD (1.0, iptr) != CSD (1.0, 0.0))) + link_error (); + if ((((MODFL (0.0l, &iptrl))) != 0.0l) + || (CSL (1.0L, iptrl) != CSL (1.0L, 0.0l))) + link_error (); + if ((((MODFF (-0.0f, &iptrf)))) || (CSF (1.0F, iptrf) != CSF (1.0F, -0.0f))) + link_error (); + if ((((MODFD (-0.0, &iptr)))) || (CSD (1.0, iptr) != CSD (1.0, -0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (-0.0l, &iptrl))) != CSL (1.0L, -0.0l)) + || (CSL (1.0L, iptrl) != CSL (1.0L, -0.0l))) + link_error (); + if (MODFF (-1 / 9.0f, &iptrf) != -1 / 9.0f + || (CSF (1.0F, (MODFF (-1 / 9.0f, &iptrf))) != CSF (1.0F, (-1 / 9.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, -0.0f))) + link_error (); + if (MODFD (-1 / 9.0, &iptr) != -1 / 9.0 + || (CSD (1.0, iptr) != CSD (1.0, -0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (-1 / 9.0l, &iptrl))) != CSL (1.0L, (-1 / 9.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, -0.0l))) + link_error (); + if ((CSF (1.0F, (MODFF (-1 / 3.0f, &iptrf))) != CSF (1.0F, (-1 / 3.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, -0.0f))) + link_error (); + if (MODFD (-1 / 3.0, &iptr) != -1 / 3.0 + || (CSD (1.0, iptr) != CSD (1.0, -0.0))) + link_error (); + if ((CSL (1.0L, (MODFL (-1 / 3.0l, &iptrl))) != CSL (1.0L, (-1 / 3.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, -0.0l))) + link_error (); + if (MODFF (-4 / 9.0f, &iptrf) != -4 / 9.0f + || (CSF (1.0F, (MODFF (-4 / 9.0f, &iptrf))) != CSF (1.0F, (-4 / 9.0f))) + || (CSF (1.0F, iptrf) != CSF (1.0F, -0.0f))) + link_error (); + if (MODFD (-4 / 9.0, &iptr) != -4 / 9.0 + || (CSD (1.0, iptr) != CSD (1.0, -0.0))) + link_error (); + if (MODFL (-4 / 9.0l, &iptrl) != -4 / 9.0l + || (CSL (1.0L, (MODFL (-4 / 9.0l, &iptrl))) != CSL (1.0L, (-4 / 9.0l))) + || (CSL (1.0L, iptrl) != CSL (1.0L, -0.0l))) + link_error (); + if (MODFF (-0.5f, &iptrf) != -0.5f + || (CSF (1.0F, iptrf) != CSF (1.0F, -0.0f))) + link_error (); + if (MODFD (-0.5, &iptr) != -0.5 + != (CSD (1.0, (MODFD (-0.5, &iptr))) != CSD (1.0, -0.5)) + || (CSD (1.0, iptr) != CSD (1.0, -0.0))) + (MODFL (-0.5l, (long double *) &iptrll)); + if ((((MODFF (-1.0f, &iptrf)))) || (CSF (1.0F, iptrf) != -1.0f)) + link_error (); + if ((((MODFD (-1.0, &iptr))) != -0.0) || (CSD (1.0, iptr) != -1.0)) + link_error (); + if ((((MODFL (-1.0l, &iptrl)))) || (CSL (1.0L, iptrl) != -1.0l)) + link_error (); + if ((CSF (1.0F, (MODFF (-4 / 3.0f, &iptrf))) != CSF (1.0F, (1 - 4 / 3.0f))) + || (CSF (1.0F, iptrf) != -1.0f)) + link_error (); + if (MODFD (-4 / 3.0, &iptr) != 1 - 4 / 3.0 || (CSD (1.0, iptr) != -1.0)) + link_error (); + if (MODFL (-4 / 3.0l, &iptrl) != 1 - 4 / 3.0l + || (CSL (1.0L, (MODFL (-4 / 3.0l, &iptrl))) + != CSL (1.0L, (1 - 4 / 3.0l))) || (CSL (1.0L, iptrl) != -1.0l)) + link_error (); + if ((CSF (1.0F, (MODFF (-1.5f, &iptrf))) != CSF (1.0F, -0.5f)) + || (CSF (1.0F, iptrf) != -1.0f)) + link_error (); + if ((CSD (1.0, (MODFD (-1.5, &iptr))) != CSD (1.0, -0.5)) + || (CSD (1.0, iptr) != -1.0)) + link_error (); +} diff --git a/gcc/testsuite/gcc.c-torture/compile/pr51069.c b/gcc/testsuite/gcc.c-torture/compile/pr51069.c new file mode 100644 index 00000000000..4fdc52f65fc --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr51069.c @@ -0,0 +1,35 @@ + +int a, b, c, d, e, f, bar (void); + +void +foo (int x) +{ + for (;;) + { + if (!x) + { + for (d = 6; d >= 0; d--) + { + while (!b) + ; + if (e) + return foo (x); + if (f) + { + a = 0; + continue; + } + for (; c; c--) + ; + } + } + if (bar ()) + break; + e = 0; + if (x) + for (;;) + ; + } +} + + diff --git a/gcc/testsuite/gcc.c-torture/execute/20111227-1.c b/gcc/testsuite/gcc.c-torture/execute/20111227-1.c new file mode 100644 index 00000000000..9fe330d6e99 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20111227-1.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/51667 */ +/* Testcase by Uros Bizjak <ubizjak@gmail.com> */ + +extern void abort (void); + +void __attribute__((noinline,noclone)) +bar (int a) +{ + if (a != -1) + abort (); +} + +void __attribute__((noinline,noclone)) +foo (short *a, int t) +{ + short r = *a; + + if (t) + bar ((unsigned short) r); + else + bar ((signed short) r); +} + +short v = -1; + +int main(void) +{ + foo (&v, 0); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c index 29b1e98ba8e..42b393580a3 100644 --- a/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c +++ b/gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-ref-all-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-O2 -Wall" } */ +/* { dg-options "-O2 -Wall -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); diff --git a/gcc/testsuite/gcc.dg/fold-compare-6.c b/gcc/testsuite/gcc.dg/fold-compare-6.c new file mode 100644 index 00000000000..7ddf6b44dab --- /dev/null +++ b/gcc/testsuite/gcc.dg/fold-compare-6.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-fdump-tree-original" } */ + +char digs[] = "0123456789"; +int foo (void) +{ + int xlcbug = 1 / (&(digs + 5)[-2 + (_Bool) 1] == &digs[4] ? 1 : -1); + return xlcbug; +} + +/* { dg-final { scan-tree-dump "xlcbug = 1;" "original" } } */ +/* { dg-final { cleanup-tree-dump "original" } } */ diff --git a/gcc/testsuite/gcc.dg/memcpy-4.c b/gcc/testsuite/gcc.dg/memcpy-4.c index 4fe72ec5b89..80a943bdb78 100644 --- a/gcc/testsuite/gcc.dg/memcpy-4.c +++ b/gcc/testsuite/gcc.dg/memcpy-4.c @@ -1,11 +1,14 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-rtl-expand" } */ +#ifdef __mips +__attribute__((nomips16)) +#endif void f1 (char *p) { - __builtin_memcpy (p, "123", 3); + __builtin_memcpy (p, "12345", 5); } -/* { dg-final { scan-rtl-dump-times "mem/s/u" 3 "expand" { target mips*-*-* } } } */ +/* { dg-final { scan-rtl-dump "mem/s/u.*mem/s/u" "expand" { target mips*-*-* } } } */ /* { dg-final { cleanup-rtl-dump "expand" } } */ diff --git a/gcc/testsuite/gcc.dg/pr35442.c b/gcc/testsuite/gcc.dg/pr35442.c index 206853b9ef0..6534ba40419 100644 --- a/gcc/testsuite/gcc.dg/pr35442.c +++ b/gcc/testsuite/gcc.dg/pr35442.c @@ -1,5 +1,6 @@ /* PR c/35442 */ /* { dg-bogus "not supported by" "" { target *-*-* } 0 } */ +/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ typedef char A __attribute__ ((vector_size (64))); typedef int B __attribute__ ((vector_size (64))); diff --git a/gcc/testsuite/gcc.dg/pr46309.c b/gcc/testsuite/gcc.dg/pr46309.c index 2629a3cef37..ba27090201e 100644 --- a/gcc/testsuite/gcc.dg/pr46309.c +++ b/gcc/testsuite/gcc.dg/pr46309.c @@ -1,6 +1,9 @@ /* PR tree-optimization/46309 */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-reassoc-details" } */ +/* The transformation depends on BRANCH_COST being greater than 1 + (see the notes in the PR), so try to force that. */ +/* { dg-additional-options "-mtune=octeon2" { target mips*-*-* } } */ int f1 (int a) diff --git a/gcc/testsuite/gcc.dg/pr49994-3.c b/gcc/testsuite/gcc.dg/pr49994-3.c index ef079d78b4b..11e8fe5ade5 100644 --- a/gcc/testsuite/gcc.dg/pr49994-3.c +++ b/gcc/testsuite/gcc.dg/pr49994-3.c @@ -2,7 +2,7 @@ /* { dg-options "-O2 -fsched2-use-superblocks -g" } */ /* { dg-options "-O2 -fsched2-use-superblocks -g -mbackchain" { target s390*-*-* } } */ /* { dg-require-effective-target scheduling } */ -/* { dg-skip-if "PR testsuite/50722" { *-*-hpux* } } */ +/* { dg-skip-if "PR testsuite/50722" { ia64-*-*-* hppa*-*-* *-*-hpux* } } */ void * foo (int offset) diff --git a/gcc/testsuite/gcc.dg/pr51644.c b/gcc/testsuite/gcc.dg/pr51644.c new file mode 100644 index 00000000000..2038a0c4b93 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51644.c @@ -0,0 +1,33 @@ +/* PR middle-end/51644 */ +/* { dg-do compile } */ +/* { dg-options "-Wall -fexceptions" } */ + +#include <stdarg.h> + +extern void baz (int, va_list) __attribute__ ((__noreturn__)); + +__attribute__ ((__noreturn__)) +void +foo (int s, ...) +{ + va_list ap; + va_start (ap, s); + baz (s, ap); + va_end (ap); +} /* { dg-bogus "function does return" } */ + +__attribute__ ((__noreturn__)) +void +bar (int s, ...) +{ + va_list ap1; + va_start (ap1, s); + { + va_list ap2; + va_start (ap2, s); + baz (s, ap1); + baz (s, ap2); + va_end (ap2); + } + va_end (ap1); +} /* { dg-bogus "function does return" } */ diff --git a/gcc/testsuite/gcc.dg/pr51683.c b/gcc/testsuite/gcc.dg/pr51683.c new file mode 100644 index 00000000000..f5a4a8be485 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr51683.c @@ -0,0 +1,18 @@ +/* PR tree-optimization/51683 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ + +static inline void * +bar (void *p, void *q, int r) +{ + return __builtin_memcpy (p, q, r); +} + +void * +foo (void *p) +{ + return bar ((void *) 0x12345000, p, 256); +} + +/* { dg-final { scan-tree-dump "memcpy" "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/scal-to-vec1.c b/gcc/testsuite/gcc.dg/scal-to-vec1.c index 503426dbb29..0c1a5093315 100644 --- a/gcc/testsuite/gcc.dg/scal-to-vec1.c +++ b/gcc/testsuite/gcc.dg/scal-to-vec1.c @@ -1,5 +1,7 @@ /* { dg-do compile } */ /* { dg-options "-Wno-long-long" } */ +/* { dg-options "-Wno-long-long -mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ + #define vector(elcount, type) \ __attribute__((vector_size((elcount)*sizeof(type)))) type diff --git a/gcc/testsuite/gcc.dg/scal-to-vec2.c b/gcc/testsuite/gcc.dg/scal-to-vec2.c index 9ff8c059e56..1897b93e050 100644 --- a/gcc/testsuite/gcc.dg/scal-to-vec2.c +++ b/gcc/testsuite/gcc.dg/scal-to-vec2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */ +/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ /* Test for C_MAYBE_CONST are folded correctly when expanding an expression to vector. */ diff --git a/gcc/testsuite/gcc.dg/sms-11.c b/gcc/testsuite/gcc.dg/sms-11.c new file mode 100644 index 00000000000..6134598632d --- /dev/null +++ b/gcc/testsuite/gcc.dg/sms-11.c @@ -0,0 +1,37 @@ +/* { dg-do run } */ +/* { dg-options "-O2 -fmodulo-sched -fmodulo-sched-allow-regmoves -fdump-rtl-sms" } */ + +extern void abort (void); + +float out[4][4] = { 6, 6, 7, 5, 6, 7, 5, 5, 6, 4, 4, 4, 6, 2, 3, 4 }; + +void +invert (void) +{ + int i, j, k = 0, swap; + float tmp[4][4] = { 5, 6, 7, 5, 6, 7, 5, 5, 4, 4, 4, 4, 3, 2, 3, 4 }; + + for (i = 0; i < 4; i++) + { + for (j = i + 1; j < 4; j++) + if (tmp[j][i] > tmp[i][i]) + swap = j; + + if (swap != i) + tmp[i][k] = tmp[swap][k]; + } + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + if (tmp[i][j] != out[i][j]) + abort (); +} + +int +main () +{ + invert (); + return 0; +} + +/* { dg-final { cleanup-rtl-dump "sms" } } */ diff --git a/gcc/testsuite/gcc.dg/tm/pr51472.c b/gcc/testsuite/gcc.dg/tm/pr51472.c new file mode 100644 index 00000000000..2897c3d78c9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tm/pr51472.c @@ -0,0 +1,17 @@ +/* { dg-do compile } */ +/* { dg-options "-fgnu-tm -O --param tm-max-aggregate-size=32" } */ + +typedef int __attribute__ ((vector_size (16))) vectype; +vectype v; + +void +foo (int c) +{ + vectype *p = __builtin_malloc (sizeof (vectype)); + __transaction_atomic + { + *p = v; + if (c) + __transaction_cancel; + } +} diff --git a/gcc/testsuite/gcc.dg/torture/pr36891.c b/gcc/testsuite/gcc.dg/torture/pr36891.c index 5a8e5c32e3e..ab58e43b9cd 100644 --- a/gcc/testsuite/gcc.dg/torture/pr36891.c +++ b/gcc/testsuite/gcc.dg/torture/pr36891.c @@ -2,6 +2,7 @@ /* { dg-options "-ffast-math" } */ /* { dg-options "-ffast-math -msse" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ /* { dg-require-effective-target sse { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ +/* { dg-options "-ffast-math -mabi=altivec" { target { { powerpc*-*-linux* } && ia32 } } } */ #define __vector __attribute__((vector_size(16) )) __vector float f(void); diff --git a/gcc/testsuite/gcc.dg/torture/pr50396.c b/gcc/testsuite/gcc.dg/torture/pr50396.c new file mode 100644 index 00000000000..aa17ebdaa84 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr50396.c @@ -0,0 +1,22 @@ +/* { dg-do run } */ +/* { dg-add-options ieee } */ + +extern void abort (void); +typedef float vf128 __attribute__((vector_size(16))); +typedef float vf64 __attribute__((vector_size(8))); +int main() +{ +#if !__FINITE_MATH_ONLY__ +#if __FLT_HAS_QUIET_NAN__ + vf128 v = (vf128){ 0.f, 0.f, 0.f, 0.f }; + vf64 u = (vf64){ 0.f, 0.f }; + v = v / (vf128){ 0.f, 0.f, 0.f, 0.f }; + if (v[0] == v[0]) + abort (); + u = u / (vf64){ 0.f, 0.f }; + if (u[0] == u[0]) + abort (); +#endif +#endif + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c b/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c new file mode 100644 index 00000000000..24734004456 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr43491.c @@ -0,0 +1,42 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-pre-stats" } */ + +#define REGISTER register + +#if defined __arm__ +# define REG1 asm("r4") +#elif defined __i386__ +# define REG1 asm("ebx") +#elif defined __mips__ +# define REG1 asm("s0") +#elif defined __x86_64__ +# define REG1 asm("rbp") +#else +# undef REGISTER +# define REGISTER +# define REG1 +#endif + +REGISTER long data_0 REG1; +long data_3; + +long foo(long data, long v) +{ + long i; + long t, u; + + if (data) + i = data_0 + data_3; + else { + v = 2; + i = 5; + } + t = data_0 + data_3; + u = i; + return v * t * u; +} +/* We should not eliminate global register variable when it is the RHS of + a single assignment. */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre" { target { arm-*-* i?86-*-* mips*-*-* x86_64-*-* } } } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 3" 1 "pre" { target { ! { arm-*-* i?86-*-* mips*-*-* x86_64-*-* } } } } } */ +/* { dg-final { cleanup-tree-dump "pre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c index f90bedb1ebc..08b788abaf3 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp47.c @@ -5,7 +5,7 @@ this. */ /* { dg-do compile { target { ! "mips*-*-* s390*-*-* avr-*-* mn10300-*-*" } } } */ /* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dom1 -fdump-tree-dom2" } */ -/* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +/* { dg-additional-options "-march=i586" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */ int h(int x, int y) { diff --git a/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c index d8394060bad..1da8e7b2cd5 100644 --- a/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c +++ b/gcc/testsuite/gcc.dg/vect/fast-math-pr35982.c @@ -20,7 +20,6 @@ float method2_int16 (struct mem *mem) return avg; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_extract_even_odd } } } */ -/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail vect_extract_even_odd } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_extract_even_odd || vect_strided2 } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 0 loops" 1 "vect" { xfail { vect_extract_even_odd || vect_strided2 } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ - diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c index 21b87a39677..350c3f46bea 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-31.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 32 +#define N 64 struct t{ int k[N]; diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c index 94767734688..1384e8b7cc2 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-36.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 16 +#define N 32 struct { char ca[N]; diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c index 2281104871c..ab2f576774a 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-64.c @@ -7,7 +7,7 @@ int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; int ia[N][4][N+1]; -int ic[N][N][3][N+1]; +int ic[N][N][3][2*N+2]; int id[N][N][N+4]; __attribute__ ((noinline)) diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c index 49a9098f79f..ffb455c05d5 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-66.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 16 +#define N 32 int ia[8][5][N+2]; int ic[16][16][5][N+2]; @@ -79,5 +79,6 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { {! vect_aligned_arrays} && {vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {vect_aligned_arrays} && {! vect_sizes_32B_16B} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c index de036e88ebf..4b613050a4c 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-68.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 32 +#define N 64 struct s{ int m; @@ -88,5 +88,6 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 4 "vect" { target { {! vect_aligned_arrays} && {vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { target { {vect_aligned_arrays} && {! vect_sizes_32B_16B} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c index cc4f26fa6c5..a18d7d6a9e8 100644 --- a/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c +++ b/gcc/testsuite/gcc.dg/vect/no-section-anchors-vect-69.c @@ -3,7 +3,7 @@ #include <stdarg.h> #include "tree-vect.h" -#define N 12 +#define N 24 struct s{ int m; @@ -114,7 +114,7 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 4 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail {! vector_alignment_reachable} } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { {! vector_alignment_reachable} || { ! vect_aligned_arrays} } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c index 1a49ef26911..2b4482a3c0b 100644 --- a/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c +++ b/gcc/testsuite/gcc.dg/vect/no-vfa-vect-dv-2.c @@ -74,5 +74,6 @@ int main () /* The initialization induction loop (with aligned access) is also vectorized. */ /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" } } */ +/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/pr45752.c b/gcc/testsuite/gcc.dg/vect/pr45752.c index 18047d5250b..b4b3c1b7ec6 100644 --- a/gcc/testsuite/gcc.dg/vect/pr45752.c +++ b/gcc/testsuite/gcc.dg/vect/pr45752.c @@ -102,7 +102,7 @@ int main (int argc, const char* argv[]) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 2 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump "permutation requires at least three vectors" "vect" { target vect_perm } } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-4.c b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c index 239461a0f85..d0a069589ac 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-4.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-4.c @@ -81,7 +81,7 @@ int main (int argc, const char* argv[]) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm } } } */ +/* { dg-final { scan-tree-dump "permutation requires at least three vectors" "vect" { target vect_perm} } } */ /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c index d1653ba1b07..2f1cb357984 100644 --- a/gcc/testsuite/gcc.dg/vect/slp-perm-9.c +++ b/gcc/testsuite/gcc.dg/vect/slp-perm-9.c @@ -52,8 +52,10 @@ int main (int argc, const char* argv[]) return 0; } -/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { {! vect_perm } || {! vect_sizes_32B_16B } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target { { vect_perm } && { vect_sizes_32B_16B } } } } } */ /* { dg-final { scan-tree-dump-times "permutation requires at least three vectors" 1 "vect" { target vect_perm_short } } } */ -/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" { target { {! vect_perm } || {! vect_sizes_32B_16B } } } } } */ +/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { target { { vect_perm } && { vect_sizes_32B_16B } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-33.c b/gcc/testsuite/gcc.dg/vect/vect-33.c index d35bce4d6f6..43daaa80704 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-33.c +++ b/gcc/testsuite/gcc.dg/vect/vect-33.c @@ -39,6 +39,6 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vector_alignment_reachable } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ +/* { dg-final { scan-tree-dump "Alignment of access forced using peeling" "vect" { target vector_alignment_reachable } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 1 "vect" { target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-35.c b/gcc/testsuite/gcc.dg/vect/vect-35.c index 0f4284a6257..63fc8c819dc 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-35.c +++ b/gcc/testsuite/gcc.dg/vect/vect-35.c @@ -46,5 +46,5 @@ int main (void) /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" { xfail { ia64-*-* sparc*-*-* } } } } */ -/* { dg-final { scan-tree-dump-times "can't determine dependence between" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "can't determine dependence between" "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c index 14d3faa0a12..11b7fe2a996 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-6-big-array.c @@ -75,5 +75,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-6.c b/gcc/testsuite/gcc.dg/vect/vect-6.c index 5f2e0ea5936..76117146b12 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-6.c +++ b/gcc/testsuite/gcc.dg/vect/vect-6.c @@ -54,5 +54,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-91.c b/gcc/testsuite/gcc.dg/vect/vect-91.c index 619c8edd734..019cf353f17 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-91.c +++ b/gcc/testsuite/gcc.dg/vect/vect-91.c @@ -58,7 +58,8 @@ main3 () } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 3 "vect" { xfail vect_no_int_add } } } */ -/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" } } */ +/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 3 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "accesses have the same alignment." 2 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 3 "vect" {target { vector_alignment_reachable } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using versioning" 3 "vect" {target { {! vector_alignment_reachable} && {! vect_hw_misalign} } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c b/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c index ef5213a3685..16da0764eae 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c +++ b/gcc/testsuite/gcc.dg/vect/vect-all-big-array.c @@ -249,6 +249,7 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-all.c b/gcc/testsuite/gcc.dg/vect/vect-all.c index 6adb7bf88bd..6756283b7d9 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-all.c +++ b/gcc/testsuite/gcc.dg/vect/vect-all.c @@ -215,6 +215,7 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 10 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 0 "vect" { target { { vect_aligned_arrays } && {! vect_sizes_32B_16B} } } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { {! vect_aligned_arrays } && {vect_sizes_32B_16B} } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 0 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c b/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c index 7981c4a475f..782f7b03ea7 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-multitypes-1.c @@ -81,7 +81,7 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_align } } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail { vect_no_align } } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail { vect_no_align } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 2 "vect" { xfail {{ vect_no_align } || {! vect_aligned_arrays }}} } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 4 "vect" { xfail {{ vect_no_align } || {! vect_aligned_arrays }}} } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c b/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c index 3342b79b215..6053b19e7a5 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-4c.c @@ -23,5 +23,5 @@ foo (){ } /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_short_mult && { ! vect_no_align } } } } } */ -/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" } } */ +/* { dg-final { scan-tree-dump "zero step in outer loop." "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c index e319d77e492..2d37d6d148e 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-outer-5.c +++ b/gcc/testsuite/gcc.dg/vect/vect-outer-5.c @@ -78,5 +78,5 @@ int main () is known. */ /* { dg-final { scan-tree-dump-times "not vectorized: possible dependence between data-refs" 1 "vect" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "zero step in outer loop." 1 "vect" { xfail vect_no_align } } } */ +/* { dg-final { scan-tree-dump "zero step in outer loop." "vect" { xfail vect_no_align } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c index 36f4684ad58..47db4a16030 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-1.c @@ -58,7 +58,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" { target {! vect_sizes_32B_16B} } } } */ +/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 8 "vect" { target vect_sizes_32B_16B } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c index ed36688f6c6..c69465898fa 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-3.c @@ -58,7 +58,7 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "vect_recog_over_widening_pattern: detected" "vect" } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c index c1291e38f6d..d3d44430814 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c +++ b/gcc/testsuite/gcc.dg/vect/vect-over-widen-4.c @@ -62,7 +62,8 @@ int main (void) return 0; } -/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" } } */ +/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 4 "vect" { target {! vect_sizes_32B_16B } } } } */ +/* { dg-final { scan-tree-dump-times "vect_recog_over_widening_pattern: detected" 8 "vect" { target vect_sizes_32B_16B } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c index 342da1827a2..b593411c7bc 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-1.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-1.c @@ -48,6 +48,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */ /* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-2.c b/gcc/testsuite/gcc.dg/vect/vect-peel-2.c index 6a764c15040..ea270436e1a 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-2.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-2.c @@ -49,6 +49,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target vect_element_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target vect_element_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { target { { vect_element_align } && { vect_aligned_arrays } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-peel-3.c b/gcc/testsuite/gcc.dg/vect/vect-peel-3.c index 8f4d3571494..caf0a4dd590 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-peel-3.c +++ b/gcc/testsuite/gcc.dg/vect/vect-peel-3.c @@ -48,6 +48,6 @@ int main (void) } /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail vect_no_align } } } */ -/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail vect_no_align } } } */ +/* { dg-final { scan-tree-dump-times "Vectorizing an unaligned access" 1 "vect" { xfail { { vect_no_align } || {! vect_aligned_arrays } } } } } */ +/* { dg-final { scan-tree-dump-times "Alignment of access forced using peeling" 1 "vect" { xfail { { vect_no_align } || {! vect_aligned_arrays } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c index 6effa87ebb5..553ab6fcdfd 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1b.c @@ -34,7 +34,7 @@ main (void) return foo (); } -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect"} } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si || vect_unpack } } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c index 872e6e82e5b..2fc7f9a5914 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-1c.c @@ -34,7 +34,7 @@ main (void) return foo (); } -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect" } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_hi } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c index 53d5f0d5cce..6106ed8f53a 100644 --- a/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c +++ b/gcc/testsuite/gcc.dg/vect/vect-reduc-pattern-2b.c @@ -34,7 +34,7 @@ main (void) return foo (); } -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect" } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_widen_sum_qi_to_si && vect_unpack } } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { { ! vect_widen_sum_qi_to_si } && { ! vect_unpack } } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c index 12f3650783e..7611c353c0a 100644 --- a/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c +++ b/gcc/testsuite/gcc.dg/vect/wrapv-vect-reduc-pattern-2c.c @@ -35,7 +35,7 @@ main (void) return foo (); } -/* { dg-final { scan-tree-dump-times "vect_recog_widen_sum_pattern: detected" 1 "vect" } } */ +/* { dg-final { scan-tree-dump "vect_recog_widen_sum_pattern: detected" "vect" } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_widen_sum_qi_to_hi } } } */ /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 0 "vect" { target { ! vect_widen_sum_qi_to_hi } } } } */ /* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.dg/vector-compare-1.c b/gcc/testsuite/gcc.dg/vector-compare-1.c index b5682398810..f6c1b404b0c 100644 --- a/gcc/testsuite/gcc.dg/vector-compare-1.c +++ b/gcc/testsuite/gcc.dg/vector-compare-1.c @@ -1,4 +1,6 @@ /* { dg-do compile } */ +/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ + #define vector(elcount, type) \ __attribute__((vector_size((elcount)*sizeof(type)))) type diff --git a/gcc/testsuite/gcc.dg/vector-compare-2.c b/gcc/testsuite/gcc.dg/vector-compare-2.c index f42986fdcb5..8cbcf0787c4 100644 --- a/gcc/testsuite/gcc.dg/vector-compare-2.c +++ b/gcc/testsuite/gcc.dg/vector-compare-2.c @@ -1,5 +1,6 @@ /* { dg-do compile } */ /* { dg-options "-fno-common" { target hppa*-*-hpux* } } */ +/* { dg-options "-mabi=altivec" { target { { powerpc*-*-linux* } && ilp32 } } } */ /* Test if C_MAYBE_CONST are folded correctly when creating VEC_COND_EXPR. */ diff --git a/gcc/testsuite/gcc.dg/volatile-bitfields-2.c b/gcc/testsuite/gcc.dg/volatile-bitfields-2.c new file mode 100644 index 00000000000..a57cd74753c --- /dev/null +++ b/gcc/testsuite/gcc.dg/volatile-bitfields-2.c @@ -0,0 +1,15 @@ +/* { dg-do run } */ +/* { dg-options "-fstrict-volatile-bitfields" } */ + +extern void abort(void); +struct thing { + volatile unsigned short a: 8; + volatile unsigned short b: 8; +} t = {1,2}; + +int main() +{ + t.a = 3; + if (t.a !=3 || t.b !=2) abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.target/arm/neon/vect-vcvt.c b/gcc/testsuite/gcc.target/arm/neon/vect-vcvt.c new file mode 100644 index 00000000000..f31d9bfabf9 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon/vect-vcvt.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details -mvectorize-with-neon-double" } */ +/* { dg-add-options arm_neon } */ + +#define N 32 + +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float fa[N]; +int ia[N]; + +int convert() +{ + int i; + + /* int -> float */ + for (i = 0; i < N; i++) + fa[i] = (float) ib[i]; + + /* float -> int */ + for (i = 0; i < N; i++) + ia[i] = (int) fa[i]; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.target/arm/neon/vect-vcvtq.c b/gcc/testsuite/gcc.target/arm/neon/vect-vcvtq.c new file mode 100644 index 00000000000..f3f01c65e23 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/neon/vect-vcvtq.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-O2 -ftree-vectorize -fdump-tree-vect-details" } */ +/* { dg-add-options arm_neon } */ + +#define N 32 + +int ib[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45,0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45}; +float fa[N]; +int ia[N]; + +int convert() +{ + int i; + + /* int -> float */ + for (i = 0; i < N; i++) + fa[i] = (float) ib[i]; + + /* float -> int */ + for (i = 0; i < N; i++) + ia[i] = (int) fa[i]; + + return 0; +} + +/* { dg-final { scan-tree-dump-times "vectorized 2 loops" 1 "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/testsuite/gcc.target/arm/sibcall-2.c b/gcc/testsuite/gcc.target/arm/sibcall-2.c new file mode 100644 index 00000000000..921c0f30284 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/sibcall-2.c @@ -0,0 +1,12 @@ +/* { dg-require-effective-target arm_eabi } */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mabi=aapcs" } */ + + +extern void __attribute__((weak)) wfunc(void); +void main(void) +{ + wfunc(); /* Must not tail-call. */ +} + +/* { dg-final { scan-assembler-not "b\[\\t \]+wfunc" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr50038.c b/gcc/testsuite/gcc.target/i386/pr50038.c new file mode 100644 index 00000000000..e111574c473 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr50038.c @@ -0,0 +1,20 @@ +/* PR target/50038 */ +/* { dg-options "-O2" } */ + +void +test (int len, unsigned char *in, unsigned char *out) +{ + int i; + unsigned char xr, xg; + unsigned char xy=0; + for (i = 0; i < len; i++) + { + xr = *in++; + xg = *in++; + xy = (unsigned char) ((19595 * xr + 38470 * xg) >> 16); + + *out++ = xy; + } +} + +/* { dg-final { scan-assembler-times "movzbl" 2 } } */ diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c index 8b815e5acb6..c685974895d 100644 --- a/gcc/testsuite/gcc.target/mips/dspr2-MULT.c +++ b/gcc/testsuite/gcc.target/mips/dspr2-MULT.c @@ -1,11 +1,12 @@ /* Test MIPS32 DSP REV 2 MULT instruction. Tune for a CPU that has pipelined mult. */ /* { dg-do compile } */ -/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo -mtune=74kc" } */ +/* { dg-options "-mgp32 -mdspr2 -O2 -mtune=74kc" } */ +/* See PR target/51729 for the reason behind the XFAILs. */ /* { dg-final { scan-assembler "\tmult\t" } } */ -/* { dg-final { scan-assembler "ac1" } } */ -/* { dg-final { scan-assembler "ac2" } } */ +/* { dg-final { scan-assembler "ac1" { xfail *-*-* } } } */ +/* { dg-final { scan-assembler "ac2" { xfail *-*-* } } } */ typedef long long a64; diff --git a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c index c457d245a31..7f04315efe5 100644 --- a/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c +++ b/gcc/testsuite/gcc.target/mips/dspr2-MULTU.c @@ -1,11 +1,12 @@ /* Test MIPS32 DSP REV 2 MULTU instruction. Tune for a CPU that has pipelined multu. */ /* { dg-do compile } */ -/* { dg-options "-mgp32 -mdspr2 -O2 -ffixed-hi -ffixed-lo -mtune=74kc" } */ +/* { dg-options "-mgp32 -mdspr2 -O2 -mtune=74kc" } */ +/* See PR target/51729 for the reason behind the XFAILs. */ /* { dg-final { scan-assembler "\tmultu\t" } } */ -/* { dg-final { scan-assembler "ac1" } } */ -/* { dg-final { scan-assembler "ac2" } } */ +/* { dg-final { scan-assembler "ac1" { xfail *-*-* } } } */ +/* { dg-final { scan-assembler "ac2" { xfail *-*-* } } } */ typedef unsigned long long a64; diff --git a/gcc/testsuite/gcc.target/powerpc/altivec-34.c b/gcc/testsuite/gcc.target/powerpc/altivec-34.c index 8e6372bfb43..98fa5d2d419 100644 --- a/gcc/testsuite/gcc.target/powerpc/altivec-34.c +++ b/gcc/testsuite/gcc.target/powerpc/altivec-34.c @@ -1,6 +1,7 @@ /* PR target/49621 */ /* { dg-do compile } */ -/* { dg-options "-O2 -maltivec" } */ +/* { dg-require-effective-target powerpc_altivec_ok } */ +/* { dg-options "-O2 -maltivec -mno-vsx" } */ #include <altivec.h> diff --git a/gcc/testsuite/gcc.target/powerpc/ehreturn.c b/gcc/testsuite/gcc.target/powerpc/ehreturn.c index abada8300e8..558db42381e 100644 --- a/gcc/testsuite/gcc.target/powerpc/ehreturn.c +++ b/gcc/testsuite/gcc.target/powerpc/ehreturn.c @@ -12,4 +12,4 @@ void foo () __builtin_eh_return (l, p); } -/* { dg-final { scan-assembler "st\[wd\] 30," } } */ +/* { dg-final { scan-assembler "(st\[wd\]|evstdd) 30," } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-pow.c b/gcc/testsuite/gcc.target/powerpc/ppc-pow.c index ee09d690f50..29614e8f514 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-pow.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-pow.c @@ -1,6 +1,9 @@ /* { dg-do compile { target { { powerpc*-*-* } && { ! powerpc*-apple-darwin* } } } } */ -/* { dg-require-effective-target powerpc_fprs } */ -/* { dg-options "-O2 -ffast-math -mcpu=power6" } */ +/* Check for VSX here, even though we don't use VSX to eliminate SPE, PAIRED + and other ppc floating point varients. However, we need to also eliminate + Darwin, since it doesn't like -mcpu=power6. */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -ffast-math -mcpu=power6 -mno-vsx -mno-altivec" } */ /* { dg-final { scan-assembler-times "fsqrt" 3 } } */ /* { dg-final { scan-assembler-times "fmul" 1 } } */ /* { dg-final { scan-assembler-times "bl? pow" 1 } } */ diff --git a/gcc/testsuite/gcc.target/powerpc/pr51623.c b/gcc/testsuite/gcc.target/powerpc/pr51623.c new file mode 100644 index 00000000000..37b7d6557a4 --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr51623.c @@ -0,0 +1,123 @@ +/* PR target/51623 */ +/* { dg-do compile { target { { powerpc*-*-linux* && ilp32 } || { powerpc-*-eabi* } } } } */ +/* { dg-options "-mrelocatable -ffreestanding" } */ + +/* This generated an error, since the compiler was calling + unlikely_text_section_p in a context where it wasn't valid. */ + +typedef long long loff_t; +typedef unsigned size_t; + + +struct mtd_info { + unsigned writesize; + unsigned oobsize; + const char *name; +}; + +extern int strcmp(const char *,const char *); +extern char * strchr(const char *,int); + +struct cmd_tbl_s { + char *name; +}; + + +int printf(const char *fmt, ...) __attribute__ ((format (__printf__, 1, 2))); +void* malloc(size_t); +void free(void*); + + +extern int nand_curr_device; +extern struct mtd_info nand_info[]; + +static int nand_dump(struct mtd_info *nand, unsigned long off, int only_oob) +{ + int i; + unsigned char *datbuf, *oobbuf, *p; + + datbuf = malloc(nand->writesize + nand->oobsize); + oobbuf = malloc(nand->oobsize); + off &= ~(nand->writesize - 1); + + printf("Page %08lx dump:\n", off); + i = nand->writesize >> 4; + p = datbuf; + + while (i--) { + if (!only_oob) + printf("\t%02x %02x %02x %02x %02x %02x %02x %02x" + " %02x %02x %02x %02x %02x %02x %02x %02x\n", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], + p[8], p[9], p[10], p[11], p[12], p[13], p[14], + p[15]); + p += 16; + } + + i = nand->oobsize >> 3; + free(datbuf); + free(oobbuf); + + return 0; +} + +int do_nand(struct cmd_tbl_s * cmdtp, int flag, int argc, char *argv[]) +{ + int dev; + unsigned long off; + char *cmd, *s; + struct mtd_info *nand; + + if (argc < 2) + goto usage; + + cmd = argv[1]; + + if (strcmp(cmd, "info") == 0) { + putc('\n'); + return 0; + } + + if (strcmp(cmd, "device") == 0) { + if (argc < 3) { + putc('\n'); + } + dev = (int)simple_strtoul(argv[2], ((void *)0), 10); + nand_curr_device = dev; + return 0; + } + + if (strcmp(cmd, "bad") != 0 && strcmp(cmd, "erase") != 0 ) + goto usage; + + if (nand_curr_device < 0 ) { + return 1; + } + nand = &nand_info[nand_curr_device]; + + if (strcmp(cmd, "erase") == 0 || strcmp(cmd, "scrub") == 0) { + int clean = argc > 2 && !strcmp("clean", argv[2]); + int scrub = !strcmp(cmd, "scrub"); + return 0; + } + + if (strncmp(cmd, "dump", 4) == 0) { + if (argc < 3) + goto usage; + + s = strchr(cmd, '.'); + off = (int)simple_strtoul(argv[2], ((void *)0), 16); + + if (s != ((void *)0) && strcmp(s, ".oob") == 0) + nand_dump(nand, off, 1); + else + nand_dump(nand, off, 0); + + return 0; + } +usage: + cmd_usage(cmdtp); + return 1; +} + +void *ptr = do_nand; diff --git a/gcc/testsuite/gfortran.dg/coarray/image_index_3.f90 b/gcc/testsuite/gfortran.dg/coarray/image_index_3.f90 new file mode 100644 index 00000000000..9bfa02db3e6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/image_index_3.f90 @@ -0,0 +1,103 @@ +! { dg-do run } +! { dg-options "-fdefault-integer-8" } +! +! As image_index_1.f90 but with -fdefault-integer-8 +! PR fortran/51682 +! +! Run-time test for IMAGE_INDEX with cobounds only known at +! the compile time, suitable for any number of NUM_IMAGES() +! For compile-time cobounds, the -fcoarray=lib version still +! needs to run-time evalulation if image_index returns > 1 +! as image_index is 0 if the index would exceed num_images(). +! +! Please set num_images() to >= 13, if possible. +! +! PR fortran/18918 +! + +program test_image_index +implicit none +integer :: index1, index2, index3 +logical :: one + +integer, allocatable :: a(:)[:,:,:], b(:)[:,:], c(:,:)[:] +integer, save :: d(2)[-1:3, *] +integer, save :: e(2)[-1:-1, 3:*] + +one = num_images() == 1 + +allocate(a(1)[3:3, -4:-3, 88:*]) +allocate(b(2)[-1:0,0:*]) +allocate(c(3,3)[*]) + +index1 = image_index(a, [3, -4, 88] ) +index2 = image_index(b, [-1, 0] ) +index3 = image_index(c, [1] ) +if (index1 /= 1 .or. index2 /= 1 .or. index3 /= 1) call abort() + + +index1 = image_index(a, [3, -3, 88] ) +index2 = image_index(b, [0, 0] ) +index3 = image_index(c, [2] ) + +if (one .and. (index1 /= 0 .or. index2 /= 0 .or. index3 /= 0)) & + call abort() +if (.not. one .and. (index1 /= 2 .or. index2 /= 2 .or. index3 /= 2)) & + call abort() + + +index1 = image_index(d, [-1, 1] ) +index2 = image_index(d, [0, 1] ) + +if (one .and. (index1 /= 1 .or. index2 /= 0)) & + call abort() +if (.not. one .and. (index1 /= 1 .or. index2 /= 2)) & + call abort() + +index1 = image_index(e, [-1, 3] ) +index2 = image_index(e, [-1, 4] ) + +if (one .and. (index1 /= 1 .or. index2 /= 0)) & + call abort() +if (.not. one .and. (index1 /= 1 .or. index2 /= 2)) & + call abort() + +call test(1, a,b,c) + +! The following test is in honour of the F2008 standard: +deallocate(a) +allocate(a (10) [10, 0:9, 0:*]) + +index1 = image_index(a, [1, 0, 0] ) +index2 = image_index(a, [3, 1, 2] ) ! = 213, yeah! +index3 = image_index(a, [3, 1, 0] ) ! = 13 + +if (num_images() < 13 .and. (index1 /= 1 .or. index2 /= 0 .or. index3 /= 0)) & + call abort() +if (num_images() >= 213 .and. (index1 /= 1 .or. index2 /= 213 .or. index3 /= 13)) & + call abort() +if (num_images() >= 13 .and. (index1 /= 1 .or. index2 /= 0 .or. index3 /= 13)) & + call abort() + + +contains +subroutine test(n, a, b, c) + integer :: n + integer :: a(1)[3*n:3*n, -4*n:-3*n, 88*n:*], b(2)[-1*n:0*n,0*n:*], c(3*n,3*n)[*] + + index1 = image_index(a, [3, -4, 88] ) + index2 = image_index(b, [-1, 0] ) + index3 = image_index(c, [1] ) + if (index1 /= 1 .or. index2 /= 1 .or. index3 /= 1) call abort() + + + index1 = image_index(a, [3, -3, 88] ) + index2 = image_index(b, [0, 0] ) + index3 = image_index(c, [2] ) + + if (one .and. (index1 /= 0 .or. index2 /= 0 .or. index3 /= 0)) & + call abort() + if (.not. one .and. (index1 /= 2 .or. index2 /= 2 .or. index3 /= 2)) & + call abort() +end subroutine test +end program test_image_index diff --git a/gcc/testsuite/gfortran.dg/function_optimize_9.f90 b/gcc/testsuite/gfortran.dg/function_optimize_9.f90 new file mode 100644 index 00000000000..350ce9a8f66 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/function_optimize_9.f90 @@ -0,0 +1,23 @@ +! { dg-do compile } +! { dg-options "-O -fdump-tree-original" } +program main + integer, parameter :: n=100 + real, parameter :: pi=4*atan(1.) + real, parameter :: tmax=20. + real, parameter :: dt = tmax/(2*pi)/real(n) + real, parameter :: t0 = dt/30. + integer :: i + interface + pure function purefunc(x) + real :: purefunc + real, intent(in) :: x + end function purefunc + end interface + real :: a(n) + do i=1,n + a(i) = purefunc(dt*i + t0) * 3. + 2 * purefunc(t0 + i*dt) + end do + print *,a +end program main +! { dg-final { scan-tree-dump-times "purefunc" 1 "original" } } +! { dg-final { cleanup-tree-dump "original" } } diff --git a/gcc/testsuite/gfortran.dg/implicit_pure_2.f90 b/gcc/testsuite/gfortran.dg/implicit_pure_2.f90 new file mode 100644 index 00000000000..496e856e04a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/implicit_pure_2.f90 @@ -0,0 +1,17 @@ +! { dg-do compile } +! PR 51502 - this was wrongly detected to be implicit pure. +module m + integer :: i +contains + subroutine foo(x) + integer, intent(inout) :: x + outer: block + block + i = 5 + end block + end block outer + end subroutine foo +end module m + +! { dg-final { scan-module-absence "m" "IMPLICIT_PURE" } } +! { dg-final { cleanup-modules "m" } } diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_3.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_3.f90 index 8a6f0965060..8043167cd7f 100644 --- a/gcc/testsuite/gfortran.dg/io_real_boz_3.f90 +++ b/gcc/testsuite/gfortran.dg/io_real_boz_3.f90 @@ -1,5 +1,6 @@ ! { dg-do run } ! { dg-options "-std=f2008" } +! { dg-require-effective-target fortran_real_16 } ! ! PR fortran/51407 ! diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_4.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_4.f90 index b70555a4687..f2c2aca4bd6 100644 --- a/gcc/testsuite/gfortran.dg/io_real_boz_4.f90 +++ b/gcc/testsuite/gfortran.dg/io_real_boz_4.f90 @@ -1,5 +1,6 @@ ! { dg-do run } ! { dg-options "-std=f2003" } +! { dg-require-effective-target fortran_real_16 } ! ! PR fortran/51407 ! diff --git a/gcc/testsuite/gfortran.dg/io_real_boz_5.f90 b/gcc/testsuite/gfortran.dg/io_real_boz_5.f90 index 6a36ee59ccb..db8e6e7557c 100644 --- a/gcc/testsuite/gfortran.dg/io_real_boz_5.f90 +++ b/gcc/testsuite/gfortran.dg/io_real_boz_5.f90 @@ -1,5 +1,6 @@ ! { dg-do run } ! { dg-options "-std=f2008" } +! { dg-require-effective-target fortran_real_16 } ! ! PR fortran/51407 ! diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_7.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_7.f03 new file mode 100644 index 00000000000..c61a00c6671 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_operator_7.f03 @@ -0,0 +1,103 @@ +! { dg-do run } +! PR46328 - complex expressions involving typebound operators of class objects. +! +module field_module + implicit none + type ,abstract :: field + contains + procedure(field_op_real) ,deferred :: multiply_real + procedure(field_plus_field) ,deferred :: plus + procedure(assign_field) ,deferred :: assn + generic :: operator(*) => multiply_real + generic :: operator(+) => plus + generic :: ASSIGNMENT(=) => assn + end type + abstract interface + function field_plus_field(lhs,rhs) + import :: field + class(field) ,intent(in) :: lhs + class(field) ,intent(in) :: rhs + class(field) ,allocatable :: field_plus_field + end function + end interface + abstract interface + function field_op_real(lhs,rhs) + import :: field + class(field) ,intent(in) :: lhs + real ,intent(in) :: rhs + class(field) ,allocatable :: field_op_real + end function + end interface + abstract interface + subroutine assign_field(lhs,rhs) + import :: field + class(field) ,intent(OUT) :: lhs + class(field) ,intent(IN) :: rhs + end subroutine + end interface +end module + +module i_field_module + use field_module + implicit none + type, extends (field) :: i_field + integer :: i + contains + procedure :: multiply_real => i_multiply_real + procedure :: plus => i_plus_i + procedure :: assn => i_assn + end type +contains + function i_plus_i(lhs,rhs) + class(i_field) ,intent(in) :: lhs + class(field) ,intent(in) :: rhs + class(field) ,allocatable :: i_plus_i + integer :: m = 0 + select type (lhs) + type is (i_field); m = lhs%i + end select + select type (rhs) + type is (i_field); m = rhs%i + m + end select + allocate (i_plus_i, source = i_field (m)) + end function + function i_multiply_real(lhs,rhs) + class(i_field) ,intent(in) :: lhs + real ,intent(in) :: rhs + class(field) ,allocatable :: i_multiply_real + integer :: m = 0 + select type (lhs) + type is (i_field); m = lhs%i * int (rhs) + end select + allocate (i_multiply_real, source = i_field (m)) + end function + subroutine i_assn(lhs,rhs) + class(i_field) ,intent(OUT) :: lhs + class(field) ,intent(IN) :: rhs + select type (lhs) + type is (i_field) + select type (rhs) + type is (i_field) + lhs%i = rhs%i + end select + end select + end subroutine +end module + +program main + use i_field_module + implicit none + class(i_field) ,allocatable :: u + allocate (u, source = i_field (99)) + + u = u*2. + u = (u*2.0*4.0) + u*4.0 + u = u%multiply_real (2.0)*4.0 + u = i_multiply_real (u, 2.0) * 4.0 + + select type (u) + type is (i_field); if (u%i .ne. 152064) call abort + end select +end program +! { dg-final { cleanup-modules "field_module i_field_module" } } + diff --git a/gcc/testsuite/gfortran.dg/typebound_operator_8.f03 b/gcc/testsuite/gfortran.dg/typebound_operator_8.f03 new file mode 100644 index 00000000000..9519e98abb0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_operator_8.f03 @@ -0,0 +1,499 @@ +! { dg-do run } +! +! Solve a diffusion problem using an object-oriented approach +! +! Author: Arjen Markus (comp.lang.fortran) +! This version: pault@gcc.gnu.org +! +! Note: +! (i) This could be turned into a more sophisticated program +! using the techniques described in the chapter on +! mathematical abstractions. +! (That would allow the selection of the time integration +! method in a transparent way) +! +! (ii) The target procedures for process_p and source_p are +! different to the typebound procedures for dynamic types +! because the passed argument is not type(base_pde_object). +! +! (iii) Two solutions are calculated, one with the procedure +! pointers and the other with typebound procedures. The sums +! of the solutions are compared. + +! (iv) The source is a delta function in the middle of the +! mesh, whilst the process is quartic in the local value, +! when it is positive. +! +! base_pde_objects -- +! Module to define the basic objects +! +module base_pde_objects + implicit none + type, abstract :: base_pde_object +! No data + procedure(process_p), pointer, pass :: process_p + procedure(source_p), pointer, pass :: source_p + contains + procedure(process), deferred :: process + procedure(source), deferred :: source + procedure :: initialise + procedure :: nabla2 + procedure :: print + procedure(real_times_obj), pass(obj), deferred :: real_times_obj + procedure(obj_plus_obj), deferred :: obj_plus_obj + procedure(obj_assign_obj), deferred :: obj_assign_obj + generic :: operator(*) => real_times_obj + generic :: operator(+) => obj_plus_obj + generic :: assignment(=) => obj_assign_obj + end type + abstract interface + function process_p (obj) + import base_pde_object + class(base_pde_object), intent(in) :: obj + class(base_pde_object), allocatable :: process_p + end function process_p + end interface + abstract interface + function source_p (obj, time) + import base_pde_object + class(base_pde_object), intent(in) :: obj + real, intent(in) :: time + class(base_pde_object), allocatable :: source_p + end function source_p + end interface + abstract interface + function process (obj) + import base_pde_object + class(base_pde_object), intent(in) :: obj + class(base_pde_object), allocatable :: process + end function process + end interface + abstract interface + function source (obj, time) + import base_pde_object + class(base_pde_object), intent(in) :: obj + real, intent(in) :: time + class(base_pde_object), allocatable :: source + end function source + end interface + abstract interface + function real_times_obj (factor, obj) result(newobj) + import base_pde_object + real, intent(in) :: factor + class(base_pde_object), intent(in) :: obj + class(base_pde_object), allocatable :: newobj + end function real_times_obj + end interface + abstract interface + function obj_plus_obj (obj1, obj2) result(newobj) + import base_pde_object + class(base_pde_object), intent(in) :: obj1 + class(base_pde_object), intent(in) :: obj2 + class(base_pde_object), allocatable :: newobj + end function obj_plus_obj + end interface + abstract interface + subroutine obj_assign_obj (obj1, obj2) + import base_pde_object + class(base_pde_object), intent(inout) :: obj1 + class(base_pde_object), intent(in) :: obj2 + end subroutine obj_assign_obj + end interface +contains +! print -- +! Print the concentration field + subroutine print (obj) + class(base_pde_object) :: obj + ! Dummy + end subroutine print +! initialise -- +! Initialise the concentration field using a specific function + subroutine initialise (obj, funcxy) + class(base_pde_object) :: obj + interface + real function funcxy (coords) + real, dimension(:), intent(in) :: coords + end function funcxy + end interface + ! Dummy + end subroutine initialise +! nabla2 -- +! Determine the divergence + function nabla2 (obj) + class(base_pde_object), intent(in) :: obj + class(base_pde_object), allocatable :: nabla2 + ! Dummy + end function nabla2 +end module base_pde_objects +! cartesian_2d_objects -- +! PDE object on a 2D cartesian grid +! +module cartesian_2d_objects + use base_pde_objects + implicit none + type, extends(base_pde_object) :: cartesian_2d_object + real, dimension(:,:), allocatable :: c + real :: dx + real :: dy + contains + procedure :: process => process_cart2d + procedure :: source => source_cart2d + procedure :: initialise => initialise_cart2d + procedure :: nabla2 => nabla2_cart2d + procedure :: print => print_cart2d + procedure, pass(obj) :: real_times_obj => real_times_cart2d + procedure :: obj_plus_obj => obj_plus_cart2d + procedure :: obj_assign_obj => obj_assign_cart2d + end type cartesian_2d_object + interface grid_definition + module procedure grid_definition_cart2d + end interface +contains + function process_cart2d (obj) + class(cartesian_2d_object), intent(in) :: obj + class(base_pde_object), allocatable :: process_cart2d + allocate (process_cart2d,source = obj) + select type (process_cart2d) + type is (cartesian_2d_object) + process_cart2d%c = -sign (obj%c, 1.0)*obj%c** 4 + class default + call abort + end select + end function process_cart2d + function process_cart2d_p (obj) + class(base_pde_object), intent(in) :: obj + class(base_pde_object), allocatable :: process_cart2d_p + allocate (process_cart2d_p,source = obj) + select type (process_cart2d_p) + type is (cartesian_2d_object) + select type (obj) + type is (cartesian_2d_object) + process_cart2d_p%c = -sign (obj%c, 1.0)*obj%c** 4 + end select + class default + call abort + end select + end function process_cart2d_p + function source_cart2d (obj, time) + class(cartesian_2d_object), intent(in) :: obj + real, intent(in) :: time + class(base_pde_object), allocatable :: source_cart2d + integer :: m, n + m = size (obj%c, 1) + n = size (obj%c, 2) + allocate (source_cart2d, source = obj) + select type (source_cart2d) + type is (cartesian_2d_object) + if (allocated (source_cart2d%c)) deallocate (source_cart2d%c) + allocate (source_cart2d%c(m, n)) + source_cart2d%c = 0.0 + if (time .lt. 5.0) source_cart2d%c(m/2, n/2) = 0.1 + class default + call abort + end select + end function source_cart2d + + function source_cart2d_p (obj, time) + class(base_pde_object), intent(in) :: obj + real, intent(in) :: time + class(base_pde_object), allocatable :: source_cart2d_p + integer :: m, n + select type (obj) + type is (cartesian_2d_object) + m = size (obj%c, 1) + n = size (obj%c, 2) + class default + call abort + end select + allocate (source_cart2d_p,source = obj) + select type (source_cart2d_p) + type is (cartesian_2d_object) + if (allocated (source_cart2d_p%c)) deallocate (source_cart2d_p%c) + allocate (source_cart2d_p%c(m,n)) + source_cart2d_p%c = 0.0 + if (time .lt. 5.0) source_cart2d_p%c(m/2, n/2) = 0.1 + class default + call abort + end select + end function source_cart2d_p + +! grid_definition -- +! Initialises the grid +! + subroutine grid_definition_cart2d (obj, sizes, dims) + class(base_pde_object), allocatable :: obj + real, dimension(:) :: sizes + integer, dimension(:) :: dims + allocate( cartesian_2d_object :: obj ) + select type (obj) + type is (cartesian_2d_object) + allocate (obj%c(dims(1), dims(2))) + obj%c = 0.0 + obj%dx = sizes(1)/dims(1) + obj%dy = sizes(2)/dims(2) + class default + call abort + end select + end subroutine grid_definition_cart2d +! print_cart2d -- +! Print the concentration field to the screen +! + subroutine print_cart2d (obj) + class(cartesian_2d_object) :: obj + character(len=20) :: format + write( format, '(a,i0,a)' ) '(', size(obj%c,1), 'f6.3)' + write( *, format ) obj%c + end subroutine print_cart2d +! initialise_cart2d -- +! Initialise the concentration field using a specific function +! + subroutine initialise_cart2d (obj, funcxy) + class(cartesian_2d_object) :: obj + interface + real function funcxy (coords) + real, dimension(:), intent(in) :: coords + end function funcxy + end interface + integer :: i, j + real, dimension(2) :: x + obj%c = 0.0 + do j = 2,size (obj%c, 2)-1 + x(2) = obj%dy * (j-1) + do i = 2,size (obj%c, 1)-1 + x(1) = obj%dx * (i-1) + obj%c(i,j) = funcxy (x) + enddo + enddo + end subroutine initialise_cart2d +! nabla2_cart2d +! Determine the divergence + function nabla2_cart2d (obj) + class(cartesian_2d_object), intent(in) :: obj + class(base_pde_object), allocatable :: nabla2_cart2d + integer :: m, n + real :: dx, dy + m = size (obj%c, 1) + n = size (obj%c, 2) + dx = obj%dx + dy = obj%dy + allocate (cartesian_2d_object :: nabla2_cart2d) + select type (nabla2_cart2d) + type is (cartesian_2d_object) + allocate (nabla2_cart2d%c(m,n)) + nabla2_cart2d%c = 0.0 + nabla2_cart2d%c(2:m-1,2:n-1) = & + -(2.0 * obj%c(2:m-1,2:n-1) - obj%c(1:m-2,2:n-1) - obj%c(3:m,2:n-1)) / dx**2 & + -(2.0 * obj%c(2:m-1,2:n-1) - obj%c(2:m-1,1:n-2) - obj%c(2:m-1,3:n)) / dy**2 + class default + call abort + end select + end function nabla2_cart2d + function real_times_cart2d (factor, obj) result(newobj) + real, intent(in) :: factor + class(cartesian_2d_object), intent(in) :: obj + class(base_pde_object), allocatable :: newobj + integer :: m, n + m = size (obj%c, 1) + n = size (obj%c, 2) + allocate (cartesian_2d_object :: newobj) + select type (newobj) + type is (cartesian_2d_object) + allocate (newobj%c(m,n)) + newobj%c = factor * obj%c + class default + call abort + end select + end function real_times_cart2d + function obj_plus_cart2d (obj1, obj2) result( newobj ) + class(cartesian_2d_object), intent(in) :: obj1 + class(base_pde_object), intent(in) :: obj2 + class(base_pde_object), allocatable :: newobj + integer :: m, n + m = size (obj1%c, 1) + n = size (obj1%c, 2) + allocate (cartesian_2d_object :: newobj) + select type (newobj) + type is (cartesian_2d_object) + allocate (newobj%c(m,n)) + select type (obj2) + type is (cartesian_2d_object) + newobj%c = obj1%c + obj2%c + class default + call abort + end select + class default + call abort + end select + end function obj_plus_cart2d + subroutine obj_assign_cart2d (obj1, obj2) + class(cartesian_2d_object), intent(inout) :: obj1 + class(base_pde_object), intent(in) :: obj2 + select type (obj2) + type is (cartesian_2d_object) + obj1%c = obj2%c + class default + call abort + end select + end subroutine obj_assign_cart2d +end module cartesian_2d_objects +! define_pde_objects -- +! Module to bring all the PDE object types together +! +module define_pde_objects + use base_pde_objects + use cartesian_2d_objects + implicit none + interface grid_definition + module procedure grid_definition_general + end interface +contains + subroutine grid_definition_general (obj, type, sizes, dims) + class(base_pde_object), allocatable :: obj + character(len=*) :: type + real, dimension(:) :: sizes + integer, dimension(:) :: dims + select case (type) + case ("cartesian 2d") + call grid_definition (obj, sizes, dims) + case default + write(*,*) 'Unknown grid type: ', trim (type) + stop + end select + end subroutine grid_definition_general +end module define_pde_objects +! pde_specific -- +! Module holding the routines specific to the PDE that +! we are solving +! +module pde_specific + implicit none +contains + real function patch (coords) + real, dimension(:), intent(in) :: coords + if (sum ((coords-[50.0,50.0])**2) < 40.0) then + patch = 1.0 + else + patch = 0.0 + endif + end function patch +end module pde_specific +! test_pde_solver -- +! Small test program to demonstrate the usage +! +program test_pde_solver + use define_pde_objects + use pde_specific + implicit none + class(base_pde_object), allocatable :: solution, deriv + integer :: i + real :: time, dtime, diff, chksum(2) + + call simulation1 ! Use proc pointers for source and process define_pde_objects + select type (solution) + type is (cartesian_2d_object) + deallocate (solution%c) + end select + select type (deriv) + type is (cartesian_2d_object) + deallocate (deriv%c) + end select + deallocate (solution, deriv) + + call simulation2 ! Use typebound procedures for source and process + if (chksum(1) .ne. chksum(2)) call abort + if ((chksum(1) - 0.881868720)**2 > 1e-4) call abort +contains + subroutine simulation1 +! +! Create the grid +! + call grid_definition (solution, "cartesian 2d", [100.0, 100.0], [16, 16]) + call grid_definition (deriv, "cartesian 2d", [100.0, 100.0], [16, 16]) +! +! Initialise the concentration field +! + call solution%initialise (patch) +! +! Set the procedure pointers +! + solution%source_p => source_cart2d_p + solution%process_p => process_cart2d_p +! +! Perform the integration - explicit method +! + time = 0.0 + dtime = 0.1 + diff = 5.0e-3 + +! Give the diffusion coefficient correct dimensions. + select type (solution) + type is (cartesian_2d_object) + diff = diff * solution%dx * solution%dy / dtime + end select + +! write(*,*) 'Time: ', time, diff +! call solution%print + do i = 1,100 + deriv = solution%nabla2 () + solution = solution + diff * dtime * deriv + solution%source_p (time) + solution%process_p () +! if ( mod(i, 25) == 0 ) then +! write(*,*)'Time: ', time +! call solution%print +! endif + time = time + dtime + enddo +! write(*,*) 'End result 1: ' +! call solution%print + select type (solution) + type is (cartesian_2d_object) + chksum(1) = sum (solution%c) + end select + end subroutine + subroutine simulation2 +! +! Create the grid +! + call grid_definition (solution, "cartesian 2d", [100.0, 100.0], [16, 16]) + call grid_definition (deriv, "cartesian 2d", [100.0, 100.0], [16, 16]) +! +! Initialise the concentration field +! + call solution%initialise (patch) +! +! Set the procedure pointers +! + solution%source_p => source_cart2d_p + solution%process_p => process_cart2d_p +! +! Perform the integration - explicit method +! + time = 0.0 + dtime = 0.1 + diff = 5.0e-3 + +! Give the diffusion coefficient correct dimensions. + select type (solution) + type is (cartesian_2d_object) + diff = diff * solution%dx * solution%dy / dtime + end select + +! write(*,*) 'Time: ', time, diff +! call solution%print + do i = 1,100 + deriv = solution%nabla2 () + solution = solution + diff * dtime * deriv + solution%source (time) + solution%process () +! if ( mod(i, 25) == 0 ) then +! write(*,*)'Time: ', time +! call solution%print +! endif + time = time + dtime + enddo +! write(*,*) 'End result 2: ' +! call solution%print + select type (solution) + type is (cartesian_2d_object) + chksum(2) = sum (solution%c) + end select + end subroutine +end program test_pde_solver +! { dg-final { cleanup-modules "pde_specific define_pde_objects cartesian_2d_objects base_pde_objects" } } diff --git a/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90 b/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90 new file mode 100644 index 00000000000..acfe1b7df42 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/vect/no-fre-no-copy-prop-O3-pr51704.f90 @@ -0,0 +1,57 @@ +! { dg-do compile } + + integer, parameter :: q = 2 + integer, parameter :: nx=3, ny=2*q, nz=5 + integer, parameter, dimension(nx,ny,nz) :: p = & + & reshape ((/ (i**2, i=1,size(p)) /), shape(p)) + integer, parameter, dimension( ny,nz) :: px = & + & reshape ((/ (( & + & + nx*(nx-1)*(2*nx-1)/6, & + & j=0,ny-1), k=0,nz-1) /), shape(px)) + integer, parameter, dimension(nx, nz) :: py = & + & reshape ((/ (( & + & +(nx )**2*ny*(ny-1)*(2*ny-1)/6, & + & i=0,nx-1), k=0,nz-1) /), shape(py)) + integer, parameter, dimension(nx,ny ) :: pz = & + & reshape ((/ (( & + & +(nx*ny)**2*nz*(nz-1)*(2*nz-1)/6, & + & i=0,nx-1), j=0,ny-1) /), shape(pz)) + integer, dimension(nx,ny,nz) :: a + integer, dimension(nx,ny ) :: az + if (sum(sum(sum(a,1),2),1) /= sum(a)) call abort + if (sum(sum(sum(a,3),1),1) /= sum(a)) call abort + if (any(1+sum(eid(a),1)+ax+sum( & + neid3(a), & + 1)+1 /= 3*ax+2)) call abort + if (any(1+eid(sum(a,2))+ay+ & + neid2( & + sum(a,2) & + )+1 /= 3*ay+2)) call abort + if (any(sum(eid(sum(a,3))+az+2* & + neid2(az) & + ,1)+1 /= 4*sum(az,1)+1)) call abort +contains + elemental function eid (x) + integer, intent(in) :: x + end function eid + function neid2 (x) + integer, intent(in) :: x(:,:) + integer :: neid2(size(x,1),size(x,2)) + neid2 = x + end function neid2 + function neid3 (x) + integer, intent(in) :: x(:,:,:) + integer :: neid3(size(x,1),size(x,2),size(x,3)) + end function neid3 + elemental subroutine set (o, i) + integer, intent(in) :: i + integer, intent(out) :: o + end subroutine set + elemental subroutine tes (i, o) + integer, intent(in) :: i + integer, intent(out) :: o + end subroutine tes +end + +! { dg-final { cleanup-tree-dump "vect" } } + diff --git a/gcc/testsuite/gfortran.dg/vect/vect.exp b/gcc/testsuite/gfortran.dg/vect/vect.exp index 048e57d3bf1..f00b2577337 100644 --- a/gcc/testsuite/gfortran.dg/vect/vect.exp +++ b/gcc/testsuite/gfortran.dg/vect/vect.exp @@ -90,6 +90,12 @@ lappend DEFAULT_VECTCFLAGS "-Ofast" dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/Ofast-*.\[fF\]{,90,95,03,08} ]] \ "" $DEFAULT_VECTCFLAGS +# With -fno-tree-copy-prop -fno-tree-fre -O3 +set DEFAULT_VECTCFLAGS $SAVED_DEFAULT_VECTCFLAGS +lappend DEFAULT_VECTCFLAGS "-fno-tree-copy-prop" "-fno-tree-fre" "-O3" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/no-fre-no-copy-prop-O3-*.\[fF\]{,90,95,03,08} ]] \ + "" $DEFAULT_VECTCFLAGS + # Clean up. set dg-do-what-default ${save-dg-do-what-default} diff --git a/gcc/testsuite/go.test/test/closure.go b/gcc/testsuite/go.test/test/closure.go index 3033c02ed81..191514def49 100644 --- a/gcc/testsuite/go.test/test/closure.go +++ b/gcc/testsuite/go.test/test/closure.go @@ -76,7 +76,6 @@ func h() { func newfunc() func(int) int { return func(x int) int { return x } } - func main() { go f() check([]int{1, 4, 5, 4}) @@ -90,10 +89,6 @@ func main() { check([]int{100, 200, 101, 201, 500, 101, 201, 500}) x, y := newfunc(), newfunc() - if x == y { - println("newfunc returned same func") - panic("fail") - } if x(1) != 1 || y(2) != 2 { println("newfunc returned broken funcs") panic("fail") diff --git a/gcc/testsuite/go.test/test/cmp1.go b/gcc/testsuite/go.test/test/cmp1.go deleted file mode 100644 index 698544c5821..00000000000 --- a/gcc/testsuite/go.test/test/cmp1.go +++ /dev/null @@ -1,130 +0,0 @@ -// $G $D/$F.go && $L $F.$A && ./$A.out - -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import "unsafe" - -func use(bool) {} - -func stringptr(s string) uintptr { return *(*uintptr)(unsafe.Pointer(&s)) } - -func isfalse(b bool) { - if b { - // stack will explain where - panic("wanted false, got true") - } -} - -func istrue(b bool) { - if !b { - // stack will explain where - panic("wanted true, got false") - } -} - -type T *int - -func main() { - var a []int - var b map[string]int - - var c string = "hello" - var d string = "hel" // try to get different pointer - d = d + "lo" - if stringptr(c) == stringptr(d) { - panic("compiler too smart -- got same string") - } - - var e = make(chan int) - - var ia interface{} = a - var ib interface{} = b - var ic interface{} = c - var id interface{} = d - var ie interface{} = e - - // these comparisons are okay because - // string compare is okay and the others - // are comparisons where the types differ. - isfalse(ia == ib) - isfalse(ia == ic) - isfalse(ia == id) - isfalse(ib == ic) - isfalse(ib == id) - istrue(ic == id) - istrue(ie == ie) - - // these are okay because one side of the - // comparison need only be assignable to the other. - isfalse(a == ib) - isfalse(a == ic) - isfalse(a == id) - isfalse(b == ic) - isfalse(b == id) - istrue(c == id) - istrue(e == ie) - - isfalse(ia == b) - isfalse(ia == c) - isfalse(ia == d) - isfalse(ib == c) - isfalse(ib == d) - istrue(ic == d) - istrue(ie == e) - - // 6g used to let this go through as true. - var g uint64 = 123 - var h int64 = 123 - var ig interface{} = g - var ih interface{} = h - isfalse(ig == ih) - - // map of interface should use == on interface values, - // not memory. - // TODO: should m[c], m[d] be valid here? - var m = make(map[interface{}]int) - m[ic] = 1 - m[id] = 2 - if m[ic] != 2 { - println("m[ic] = ", m[ic]) - panic("bad m[ic]") - } - - // non-interface comparisons - { - c := make(chan int) - c1 := (<-chan int)(c) - c2 := (chan<- int)(c) - istrue(c == c1) - istrue(c == c2) - istrue(c1 == c) - istrue(c2 == c) - - d := make(chan int) - isfalse(c == d) - isfalse(d == c) - isfalse(d == c1) - isfalse(d == c2) - isfalse(c1 == d) - isfalse(c2 == d) - } - - // named types vs not - { - var x = new(int) - var y T - var z T = x - - isfalse(x == y) - istrue(x == z) - isfalse(y == z) - - isfalse(y == x) - istrue(z == x) - isfalse(z == y) - } -} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug285.go b/gcc/testsuite/go.test/test/fixedbugs/bug285.go index 544d3487eff..7eed8fb7abc 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/bug285.go +++ b/gcc/testsuite/go.test/test/fixedbugs/bug285.go @@ -45,20 +45,6 @@ func main() { mp[p] = 42 mp[&T{7}] = 42 - type F func(x int) - f := func(x int) {} - mf := make(map[F]int) - mf[nil] = 42 - mf[f] = 42 - mf[func(x int) {}] = 42 - - type M map[int]int - m := make(M) - mm := make(map[M]int) - mm[nil] = 42 - mm[m] = 42 - mm[make(M)] = 42 - type C chan int c := make(C) mc := make(map[C]int) diff --git a/gcc/testsuite/go.test/test/typeswitch.go b/gcc/testsuite/go.test/test/typeswitch.go index 83fb0985a91..aa911f9b621 100644 --- a/gcc/testsuite/go.test/test/typeswitch.go +++ b/gcc/testsuite/go.test/test/typeswitch.go @@ -82,9 +82,9 @@ func main() { case []int: assert(x[3] == 3 && i == Array, "array") case map[string]int: - assert(x == m && i == Map, "map") + assert(x != nil && i == Map, "map") case func(i int) interface{}: - assert(x == f && i == Func, "fun") + assert(x != nil && i == Func, "fun") default: assert(false, "unknown") } @@ -111,5 +111,4 @@ func main() { default: assert(false, "switch 4 unknown") } - } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index d0b679d7ad6..026a8a96a6c 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -598,6 +598,24 @@ proc scan-module { args } { } } +# Scan Fortran modules for absence of a given regexp. +# +# Argument 0 is the module name +# Argument 1 is the regexp to match +proc scan-module-absence { args } { + set modfilename [string tolower [lindex $args 0]].mod + set fd [open $modfilename r] + set text [read $fd] + close $fd + + upvar 2 name testcase + if [regexp -- [lindex $args 1] $text] { + fail "$testcase scan-module [lindex $args 1]" + } else { + pass "$testcase scan-module [lindex $args 1]" + } +} + # Verify that the compiler output file exists, invoked via dg-final. proc output-exists { args } { # Process an optional target or xfail list. diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 78223afe601..ebf69db66b9 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -1829,7 +1829,9 @@ proc check_effective_target_vect_intfloat_cvt { } { if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || [istarget x86_64-*-*] } { + || [istarget x86_64-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_neon_ok])} { set et_vect_intfloat_cvt_saved 1 } } @@ -1865,7 +1867,9 @@ proc check_effective_target_vect_uintfloat_cvt { } { if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || [istarget x86_64-*-*] } { + || [istarget x86_64-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_neon_ok])} { set et_vect_uintfloat_cvt_saved 1 } } @@ -1888,7 +1892,9 @@ proc check_effective_target_vect_floatint_cvt { } { if { [istarget i?86-*-*] || ([istarget powerpc*-*-*] && ![istarget powerpc-*-linux*paired*]) - || [istarget x86_64-*-*] } { + || [istarget x86_64-*-*] + || ([istarget arm*-*-*] + && [check_effective_target_arm_neon_ok])} { set et_vect_floatint_cvt_saved 1 } } @@ -1908,7 +1914,9 @@ proc check_effective_target_vect_floatuint_cvt { } { } else { set et_vect_floatuint_cvt_saved 0 if { ([istarget powerpc*-*-*] - && ![istarget powerpc-*-linux*paired*]) } { + && ![istarget powerpc-*-linux*paired*]) + || ([istarget arm*-*-*] + && [check_effective_target_arm_neon_ok])} { set et_vect_floatuint_cvt_saved 1 } } @@ -3207,9 +3215,14 @@ proc check_effective_target_vect_aligned_arrays { } { verbose "check_effective_target_vect_aligned_arrays: using cached result" 2 } else { set et_vect_aligned_arrays_saved 0 - if { (([istarget x86_64-*-*] - || [istarget i?86-*-*]) && [is-effective-target lp64]) - || [istarget spu-*-*] } { + if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { ([is-effective-target lp64] + && ( ![check_avx_available] + || [check_prefer_avx128])) } { + set et_vect_aligned_arrays_saved 1 + } + } + if [istarget spu-*-*] { set et_vect_aligned_arrays_saved 1 } } @@ -3507,13 +3520,14 @@ foreach N {2 3 4 8} { proc check_effective_target_vect_multiple_sizes { } { global et_vect_multiple_sizes_saved - if [info exists et_vect_multiple_sizes_saved] { - verbose "check_effective_target_vect_multiple_sizes: using cached result" 2 - } else { - set et_vect_multiple_sizes_saved 0 - if { ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } { - set et_vect_multiple_sizes_saved 1 - } + set et_vect_multiple_sizes_saved 0 + if { ([istarget arm*-*-*] && [check_effective_target_arm_neon]) } { + set et_vect_multiple_sizes_saved 1 + } + if { ([istarget x86_64-*-*] || [istarget i?86-*-*]) } { + if { ([check_avx_available] && ![check_prefer_avx128]) } { + set et_vect_multiple_sizes_saved 1 + } } verbose "check_effective_target_vect_multiple_sizes: returning $et_vect_multiple_sizes_saved" 2 @@ -4125,6 +4139,39 @@ proc check_effective_target_automatic_stack_alignment { } { return 0; } +# Return true if we are compiling for AVX target. + +proc check_avx_available { } { + if { [check_no_compiler_messages avx_available assembly { + #ifndef __AVX__ + #error unsupported + #endif + } ""] } { + return 1; + } + return 0; +} + +# Return true if 32- and 16-bytes vectors are available. + +proc check_effective_target_vect_sizes_32B_16B { } { + return [check_avx_available]; +} + +# Return true if 128-bits vectors are preferred even if 256-bits vectors +# are available. + +proc check_prefer_avx128 { } { + if ![check_avx_available] { + return 0; + } + return [check_no_messages_and_pattern avx_explicit "xmm" assembly { + float a[1024],b[1024],c[1024]; + void foo (void) { int i; for (i = 0; i < 1024; i++) a[i]=b[i]+c[i];} + } "-O2 -ftree-vectorize"] +} + + # Return 1 if avx instructions can be compiled. proc check_effective_target_avx { } { |