diff options
Diffstat (limited to 'gcc/testsuite/g++.dg')
81 files changed, 1426 insertions, 89 deletions
diff --git a/gcc/testsuite/g++.dg/abi/covariant1.C b/gcc/testsuite/g++.dg/abi/covariant1.C index 203ec2c9fcb..ae8c5e603da 100644 --- a/gcc/testsuite/g++.dg/abi/covariant1.C +++ b/gcc/testsuite/g++.dg/abi/covariant1.C @@ -1,8 +1,8 @@ // { dg-do compile } // { dg-options "-w" } -// We don't want to use a covariant thunk to have a virtual -// primary base +// If a covariant thunk is overriding a virtual primary base, we have to +// use the vcall offset even though we know it will be 0. struct c4 {}; @@ -16,6 +16,11 @@ struct c12 : c11 { }; struct c14 : virtual c12, - virtual c11 { virtual c12* f17(); }; + virtual c11 { virtual void f(); c12* f17(); }; -// { dg-final { scan-assembler-not "\n_ZTch0_v0_n16_N3c143f17Ev\[: \t\n\]" } } +void c14::f() { } + +// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N3c143f17Ev" { target ilp32 } } } +// { dg-final { scan-assembler-not "_ZTch0_v0_n16_N3c143f17Ev" } } +// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N3c143f17Ev" { target lp64 } } } +// { dg-final { scan-assembler-not "_ZTch0_v0_n32_N3c143f17Ev" } } diff --git a/gcc/testsuite/g++.dg/abi/covariant6.C b/gcc/testsuite/g++.dg/abi/covariant6.C new file mode 100644 index 00000000000..9dfc5ba74ab --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/covariant6.C @@ -0,0 +1,34 @@ +struct A +{ + virtual A* f(); +}; + +struct B: virtual A +{ + virtual A* f(); +}; + +struct C: B +{ + virtual C* f(); +}; + +C* C::f() { return 0; } + +// When we emit C::f, we should emit both thunks: one for B and one for A. +// { dg-final { scan-assembler "_ZTch0_v0_n16_N1C1fEv" { target ilp32 } } } +// { dg-final { scan-assembler "_ZTch0_v0_n32_N1C1fEv" { target lp64 } } } +// { dg-final { scan-assembler "_ZTcv0_n12_v0_n16_N1C1fEv" { target ilp32 } } } +// { dg-final { scan-assembler "_ZTcv0_n24_v0_n32_N1C1fEv" { target lp64 } } } + +struct D: B +{ + virtual void dummy (); + virtual D* f(); +}; + +void D::dummy() { } + +// When we emit the D vtable, it should refer to the thunk for B. +// { dg-final { scan-assembler "_ZTch0_v0_n16_N1D1fEv" { target ilp32 } } } +// { dg-final { scan-assembler "_ZTch0_v0_n32_N1D1fEv" { target lp64 } } } diff --git a/gcc/testsuite/g++.dg/abi/mangle44.C b/gcc/testsuite/g++.dg/abi/mangle44.C new file mode 100644 index 00000000000..8454148421c --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/mangle44.C @@ -0,0 +1,19 @@ +// PR c++/45008 + +template <typename T> +struct A +{ + void fn1 () { + struct Nested { + static void fn2 () { } + }; + Nested::fn2(); + } +}; + +void fn3 () { + A<double> a; + a.fn1(); +} + +// { dg-final { scan-assembler-not "_ZZN1AIT_E3fn1EvEN6Nested3fn2Ev" } } diff --git a/gcc/testsuite/g++.dg/abi/noreturn1.C b/gcc/testsuite/g++.dg/abi/noreturn1.C new file mode 100644 index 00000000000..0532cf2f803 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/noreturn1.C @@ -0,0 +1,14 @@ +// Test that attribute noreturn is not part of the mangled name. +// { dg-options -fabi-version=0 } + +void baz (const char *fmt, ...); + +// { dg-final { scan-assembler "_Z3barPFvPKczE" } } +void bar (void (*baz) (const char *fmt, ...) + __attribute__ ((noreturn, format (printf, 1, 2)))); + +void +foo () +{ + bar (&baz); +} diff --git a/gcc/testsuite/g++.dg/abi/noreturn2.C b/gcc/testsuite/g++.dg/abi/noreturn2.C new file mode 100644 index 00000000000..72accafe660 --- /dev/null +++ b/gcc/testsuite/g++.dg/abi/noreturn2.C @@ -0,0 +1,14 @@ +// Test for buggy mangling of attribute noreturn in abi<=4 +// { dg-options -fabi-version=4 } + +void baz (const char *fmt, ...); + +// { dg-final { scan-assembler "_Z3barPVFvPKczE" } } +void bar (void (*baz) (const char *fmt, ...) + __attribute__ ((noreturn, format (printf, 1, 2)))); + +void +foo () +{ + bar (&baz); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype23.C b/gcc/testsuite/g++.dg/cpp0x/decltype23.C new file mode 100644 index 00000000000..78eb89d8ee2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype23.C @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +int x, &&y = static_cast<int &&>(x); +typedef decltype((y)) myInt; // `y' is a parenthesized id-expression of type int that is an lvalue +typedef int &myInt; diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C index 909ebc5e6e0..1f400f4fad0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted2.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted2.C @@ -54,7 +54,7 @@ G::G() = default; union U { - G g; // { dg-error "constructor" } + G g; // { dg-error "union member.*non-trivial" } }; int main() @@ -62,5 +62,7 @@ int main() F f; F f2(f); // { dg-error "use" } B* b = new const B; // { dg-error "uninitialized const" } + U u; // { dg-error "deleted" } } +// { dg-prune-output "implicitly deleted because" } diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit6.C b/gcc/testsuite/g++.dg/cpp0x/implicit6.C new file mode 100644 index 00000000000..c7902969dce --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit6.C @@ -0,0 +1,23 @@ +// Circular implicit declarations were causing errors +// { dg-options -std=c++0x } + +struct Ray; + +struct Vector +{ + virtual void f(); // make non-trivially-copyable + Vector(const Ray &) ; +}; + +struct array +{ + Vector v; +}; + +struct Ray +{ + array a; +}; + +extern Ray r1; +Ray r2=r1; diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit7.C b/gcc/testsuite/g++.dg/cpp0x/implicit7.C new file mode 100644 index 00000000000..f29e5009fbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit7.C @@ -0,0 +1,37 @@ +// PR c++/44909 +// { dg-options -std=c++0x } +// Declaring A<D<E>>'s copy ctor means choosing a ctor to initialize D<E>, +// which means choosing a ctor for C<B<E>>, which meant considering +// C(const B<E>&) which means choosing a ctor for B<E>, which means choosing +// a ctor for A<D<E>>. Cycle. + +template<typename T> +struct A +{ + T t; +}; + +template <typename T> +struct B +{ + typename T::U u; +}; + +template <typename T> +struct C +{ + C(const T&); +}; + +template <typename T> +struct D +{ + C<B<T> > v; +}; + +struct E { + typedef A<D<E> > U; +}; + +extern A<D<E> > a; +A<D<E> > a2(a); diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit8.C b/gcc/testsuite/g++.dg/cpp0x/implicit8.C new file mode 100644 index 00000000000..2f3febae8b2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit8.C @@ -0,0 +1,34 @@ +// The hack for PR c++/44909 breaks this testcase. We need feedback +// from the C++ committee to know how to proceed. +// { dg-options -std=c++0x } +// { dg-prune-output "implicitly deleted" } +// { dg-prune-output "cannot bind" } +// { dg-prune-output "initializing argument" } + +struct A +{ + A(); + A(A&); +}; + +struct B; +struct BP +{ + BP(const B&); +}; + +struct B +{ + B(); + B(B&&); + B(const BP&); +}; + +// If B(B&&) suppresses the B copy constructor, then copying the B +// subobject of C should use B(const BP&). But we ignore that constructor +// in order to break the cycle in 44909. Perhaps the move ctor shouldn't +// suppress the copy ctor? +struct C: A, B { }; + +C c; +C c2(c); // { dg-bogus "deleted" "" { xfail *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist41.C b/gcc/testsuite/g++.dg/cpp0x/initlist41.C new file mode 100644 index 00000000000..b5385480c89 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist41.C @@ -0,0 +1,14 @@ +// PR c++/44703 +// { dg-options -std=c++0x } + +#include <initializer_list> + +typedef std::initializer_list<int> type ; +void f(type) {} + +int main() +{ +// error: could not convert '{1, 2, 3}' to 'type' + f({1,2,3}) ; +} + diff --git a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C index 6e1d1256c57..be581bcb6e3 100644 --- a/gcc/testsuite/g++.dg/cpp0x/nullptr04.C +++ b/gcc/testsuite/g++.dg/cpp0x/nullptr04.C @@ -3,17 +3,15 @@ // Test cast to int -#define unsigned -__extension__ typedef __SIZE_TYPE__ ssize_t; -#undef unsigned +__extension__ typedef __INTPTR_TYPE__ intptr_t; const int n4 = static_cast<const int>(nullptr); // { dg-error "invalid static_cast " } const short int n5 = reinterpret_cast<short int>(nullptr); // { dg-error "loses precision" } -const ssize_t n6 = reinterpret_cast<ssize_t>(nullptr); -const ssize_t n7 = (ssize_t)nullptr; +const intptr_t n6 = reinterpret_cast<intptr_t>(nullptr); +const intptr_t n7 = (intptr_t)nullptr; decltype(nullptr) mynull = 0; const int n8 = static_cast<const int>(mynull); // { dg-error "invalid static_cast " } const short int n9 = reinterpret_cast<short int>(mynull); // { dg-error "loses precision" } -const ssize_t n10 = reinterpret_cast<ssize_t>(mynull); -const ssize_t n11 = (ssize_t)mynull; +const intptr_t n10 = reinterpret_cast<intptr_t>(mynull); +const intptr_t n11 = (intptr_t)mynull; diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae2.C b/gcc/testsuite/g++.dg/cpp0x/sfinae2.C new file mode 100644 index 00000000000..b9ef70d99cf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae2.C @@ -0,0 +1,39 @@ +// PR c++/44967 +// { dg-options -std=c++0x } + +template <typename T> T&& declval(); + +template<typename T1, typename T2, typename... Args> +struct has_construct +{ + typedef char one; + typedef struct {char _m[2]; } two; + + template<typename U1, typename U2, typename... Args2> + static decltype(declval<U1>().construct(declval<U2*>(), declval<Args2>()...), one()) test(int); + template<typename, typename, typename...> + static two test(...); + + static const bool value = sizeof(test<T1, T2, Args...>(0)) == 1; +}; + + +struct A0 +{}; + +struct A1 +{ + void construct(int*, int); +}; + +template<typename _Tp> +struct A2 +{ + template<typename _Tp1, typename... _Args> + void construct(_Tp1*, _Args&&...) {} +}; + +#define SA(X) static_assert(X,#X) +SA((!has_construct<A0, int, int>::value)); // ok +SA((has_construct<A1, int, int>::value)); // bang +SA((has_construct<A2<int>, int>::value)); // bang diff --git a/gcc/testsuite/g++.dg/cpp0x/union1.C b/gcc/testsuite/g++.dg/cpp0x/union1.C new file mode 100644 index 00000000000..291853d5aae --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/union1.C @@ -0,0 +1,34 @@ +// Negative test for C++0x unrestricted unions +// { dg-options -std=c++0x } +// { dg-prune-output "implicitly deleted because" } + +struct A +{ + A(); + A(const A&); + ~A(); +}; + +union B +{ + A a; // { dg-error "union member" } +}; + +B b; // { dg-error "B::B\\(\\)" } +B b2(b); // { dg-error "B::B\\(const B&\\)" } + +struct C +{ + union + { + A a; // { dg-error "union member" } + }; +}; + +C c; // { dg-error "C::C\\(\\)" } +C c2(c); // { dg-error "C::C\\(const C&\\)" } + +// { dg-error "B::~B" "" { target *-*-* } 17 } +// { dg-error "B::~B" "" { target *-*-* } 18 } +// { dg-error "C::~C" "" { target *-*-* } 28 } +// { dg-error "C::~C" "" { target *-*-* } 29 } diff --git a/gcc/testsuite/g++.dg/cpp0x/union2.C b/gcc/testsuite/g++.dg/cpp0x/union2.C new file mode 100644 index 00000000000..4f193e281c8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/union2.C @@ -0,0 +1,34 @@ +// Positive test for C++0x unrestricted unions +// { dg-options -std=c++0x } + +struct A +{ + A(); + A(const A&); + ~A(); +}; + +union B +{ + A a; + B(); + B(const B&); + ~B(); +}; + +B b; +B b2(b); + +struct C +{ + union + { + A a; + }; + C(); + C(const C&); + ~C(); +}; + +C c; +C c2(c); diff --git a/gcc/testsuite/g++.dg/cpp0x/union3.C b/gcc/testsuite/g++.dg/cpp0x/union3.C new file mode 100644 index 00000000000..f1e8ddb6109 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/union3.C @@ -0,0 +1,69 @@ +// Runtime test for C++0x unrestricted unions +// { dg-options -std=c++0x } +// { dg-do run } + +int c, d; +struct A +{ + int i; + A(): i(1) { ++c; } + A(const A&): i(2) { ++c; } + ~A() { ++d; } +}; + +union B +{ + A a; + B() { } + B(const B& b) { } + ~B() { } +}; + +struct C +{ + union { A a; }; + C() { } + C(const C&) { } + ~C() { } +}; + +union D +{ + A a; + D(): a() { } + D(const D& d): a(d.a) { } + ~D() { a.~A(); } +}; + +struct E +{ + union { A a; }; + E(): a() { } + E(const E& e): a (e.a) { } + ~E() { a.~A(); } +}; + +int main() +{ + { + B b1; + B b2(b1); + + C c1; + C c2(c1); + } + + if (c != 0 || d != 0) + return c+d*10; + + { + D d1; + D d2(d1); + + E e1; + E e2(e1); + } + + if (c != 4 || d != 4) + return c*100+d*1000; +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C b/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C index 593e080ac69..81360c2439f 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/const2b.C @@ -1,5 +1,6 @@ /* { dg-do compile { target i386*-*-* } } */ /* { dg-options "-O -gdwarf-2 -dA -msse" } */ +/* { dg-require-effective-target sse } */ /* { dg-final { scan-assembler "DW_AT_const_value" } } */ typedef float FloatVect __attribute__((__vector_size__(16))); diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C b/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C new file mode 100644 index 00000000000..e0ef7f71ca3 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/lineno-simple1.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// { dg-options "-g -O0 -dA" } + +struct C { // { dg-function-on-line {_ZN1CC[12]Ev} } + virtual void + foo() {} // { dg-function-on-line _ZN1C3fooEv } +}; +static C dummy; + +int +main (void) +{ // { dg-function-on-line main } +} diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C b/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C new file mode 100644 index 00000000000..2386baaacb9 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/nested-2.C @@ -0,0 +1,37 @@ +/* + Origin: PR debug/45024 + { dg-options "-g -dA -fno-merge-debug-strings" } + { dg-do compile } +*/ + +struct S { + template<typename Z> struct T { }; +}; + +S::T<int> tval; + +/* +We want to express that the DIE of S::T<int> must be a child of the DIE of S, like in assembly this output: + + .uleb128 0x2 # (DIE (0x9e) DW_TAG_structure_type) + .ascii "S\0" # DW_AT_name + .byte 0x1 # DW_AT_byte_size + .byte 0x1 # DW_AT_decl_file (../../prtests/test-PR45024.cc) + .byte 0x1 # DW_AT_decl_line + .long 0xbc # DW_AT_sibling + .uleb128 0x3 # (DIE (0xa8) DW_TAG_structure_type) + .ascii "T<int>\0" # DW_AT_name + .byte 0x1 # DW_AT_byte_size + .byte 0x1 # DW_AT_decl_file (../../prtests/test-PR45024.cc) + .byte 0x2 # DW_AT_decl_line + .uleb128 0x4 # (DIE (0xb3) DW_TAG_template_type_param) + .ascii "Z\0" # DW_AT_name + .long 0xbc # DW_AT_type + .byte 0 # end of children of DIE 0xa8 + .byte 0 # end of children of DIE 0x9e + +Hence the slightly odd regexp: + + { dg-final { scan-assembler "\[^\n\r\]*\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"S\\\\0\"\[ \t\]+#\[ \t\]+DW_AT_name\[\n\r\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_structure_type\\)\[\n\r\]+\[^\n\r\]*\"T<int>\\\\0\"\[ \t\]+\(.*\)?\\(DIE\[^\n\r\]*DW_TAG_template_type_param\\)\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*\[\n\r\]+\[^\n\r\]*#\[ \t\]+end of children of DIE\[^\n\r\]*\[\n\r\]+\[^\n\r\]*end of children of DIE\[^\n\r\]*" } } + + */ diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C new file mode 100644 index 00000000000..2df002f6b00 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr44641.C @@ -0,0 +1,41 @@ +// Origin: PR 44641 +// { dg-do compile } +// { dg-options "-g -O0 -dA" } + +template <class A> struct MisplacedDbg; +template<class T> struct MisplacedDbg<T*>; +struct Full; +template<> struct MisplacedDbg<Full>; + +struct Arg; +typedef MisplacedDbg<Arg> Typedef1; +typedef MisplacedDbg<Arg*> Typedef2; +typedef MisplacedDbg<Full> Typedef3; + +template<typename T> struct Base { + virtual ~Base() { + } +}; + +template <> +struct MisplacedDbg<Full> // { dg-function-on-line {_ZN12MisplacedDbgI4FullEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgI4FullED0Ev} { target *-*-* } 21 } + + : public Base<int> { +}; + +template <class T> +struct MisplacedDbg<T*> // { dg-function-on-line {_ZN12MisplacedDbgIP3ArgEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgIP3ArgED0Ev} { target *-*-* } 28 } + : public Base<int> { +}; + +template <class A> +struct MisplacedDbg // { dg-function-on-line {_ZN12MisplacedDbgI3ArgEC[12]Ev} } + // { dg-function-on-line {_ZN12MisplacedDbgI3ArgED0Ev} { target *-*-* } 34 } + : public Base<int> { +}; + +static MisplacedDbg<Arg> static_var1; +static MisplacedDbg<Arg*> static_var2; +static MisplacedDbg<Full> static_var3; diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C index 543439da323..18d1df0d952 100644 --- a/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pubnames-1.C @@ -1,7 +1,7 @@ // Contributed by Dodji Seketeli <dodji@redhat.com> // Origin PR debug/39706 +// { dg-do compile { target *-*-darwin* } } // { dg-options "-g -dA -fno-merge-debug-strings" } -// { dg-do compile } // // There should be one debug_pubnames section generated. // On Darwin though, there is also a label pointing at the begining of the diff --git a/gcc/testsuite/g++.dg/dg.exp b/gcc/testsuite/g++.dg/dg.exp index 5758218a267..5851dcc94f2 100644 --- a/gcc/testsuite/g++.dg/dg.exp +++ b/gcc/testsuite/g++.dg/dg.exp @@ -1,4 +1,4 @@ -# Copyright (C) 2000, 2007 Free Software Foundation, Inc. +# Copyright (C) 2000, 2007, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ set tests [prune $tests $srcdir/$subdir/gomp/*] set tests [prune $tests $srcdir/$subdir/tree-prof/*] set tests [prune $tests $srcdir/$subdir/torture/*] set tests [prune $tests $srcdir/$subdir/graphite/*] +set tests [prune $tests $srcdir/$subdir/guality/*] # Main loop. dg-runtest $tests "" $DEFAULT_CXXFLAGS diff --git a/gcc/testsuite/g++.dg/ext/altivec-17.C b/gcc/testsuite/g++.dg/ext/altivec-17.C index e83c46b7039..54eff8a24ed 100644 --- a/gcc/testsuite/g++.dg/ext/altivec-17.C +++ b/gcc/testsuite/g++.dg/ext/altivec-17.C @@ -12,5 +12,5 @@ typedef vector__ bool__ int bool_simd_type; void Foo (bool_simd_type const &a) { - simd_type const &v = a; // { dg-error "'const __vector.4. unsigned int&' from expression of type 'const __vector.4. __bool int'" } + simd_type const &v = a; // { dg-error "'const simd_type&' from expression of type 'const bool_simd_type'" } } diff --git a/gcc/testsuite/g++.dg/ext/altivec-2.C b/gcc/testsuite/g++.dg/ext/altivec-2.C index 1185a79e5ec..eb8a92942bc 100644 --- a/gcc/testsuite/g++.dg/ext/altivec-2.C +++ b/gcc/testsuite/g++.dg/ext/altivec-2.C @@ -1,6 +1,6 @@ /* { dg-do compile { target powerpc*-*-* } } */ /* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec -Wall" } */ +/* { dg-options "-maltivec -Wall -Wno-unused-but-set-variable" } */ /* This test checks if AltiVec builtins accept const-qualified arguments. */ diff --git a/gcc/testsuite/g++.dg/ext/pretty3.C b/gcc/testsuite/g++.dg/ext/pretty3.C new file mode 100644 index 00000000000..01b14579af2 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/pretty3.C @@ -0,0 +1,19 @@ +// PR c++/16630 +// { dg-do compile } +// { dg-options "" } +extern "C" int printf (const char*, ...); + +template <class T> +struct B { typedef T X; }; + +template <class U> +struct D +{ + const char* foo (typename B<U>::X) { return __PRETTY_FUNCTION__; } +}; + +int main () +{ + printf ("%s\n", D<int>().foo (0)); +} +// { dg-final { scan-assembler "const char\\* D<U>::foo\\(typename B<U>::X\\)" } } diff --git a/gcc/testsuite/g++.dg/ext/vector14.C b/gcc/testsuite/g++.dg/ext/vector14.C index 78109c1a676..8e792108fb8 100644 --- a/gcc/testsuite/g++.dg/ext/vector14.C +++ b/gcc/testsuite/g++.dg/ext/vector14.C @@ -1,6 +1,7 @@ // PR c++/35758 // { dg-do compile } -// { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ +// { dg-options "-msse" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } +// { dg-require-effective-target sse } // Ignore warning on some powerpc-linux configurations. // { dg-prune-output "non-standard ABI extension" } // { dg-prune-output "mangled name" } diff --git a/gcc/testsuite/g++.dg/gomp/sections-4.C b/gcc/testsuite/g++.dg/gomp/sections-4.C index 44e7de98c20..62a2ecddf9a 100644 --- a/gcc/testsuite/g++.dg/gomp/sections-4.C +++ b/gcc/testsuite/g++.dg/gomp/sections-4.C @@ -1,5 +1,5 @@ /* PR c++/24613 */ -/* { dg-compile } */ +/* { dg-do compile } */ #pragma omp section /* { dg-error "may only be used in" } */ diff --git a/gcc/testsuite/g++.dg/guality/guality.exp b/gcc/testsuite/g++.dg/guality/guality.exp new file mode 100644 index 00000000000..9a1785036ef --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/guality.exp @@ -0,0 +1,53 @@ +# This harness is for tests that should be run at all optimisation levels. + +load_lib g++-dg.exp +load_lib gcc-gdb-test.exp + +# Disable on darwin until radr://7264615 is resolved. +if { [istarget *-*-darwin*] } { + return +} + +proc check_guality {args} { + set result [eval check_compile guality_check executable $args "-g -O0"] + set lines [lindex $result 0] + set output [lindex $result 1] + set ret 0 + if {[string match "" $lines]} { + set execout [g++_load "./$output"] + set ret [string match "*1 PASS, 0 FAIL, 0 UNRESOLVED*" $execout] + } + remote_file build delete $output + return $ret +} + +dg-init + +global GDB +if ![info exists ::env(GUALITY_GDB_NAME)] { + if [info exists GDB] { + set guality_gdb_name "$GDB" + } else { + set guality_gdb_name "[transform gdb]" + } + setenv GUALITY_GDB_NAME "$guality_gdb_name" +} + +if {[check_guality " + #include \"$srcdir/$subdir/guality.h\" + volatile long int varl = 6; + int main (int argc, char *argv\[\]) + { + GUALCHKVAL (varl); + return 0; + } +"]} { + gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "" + gcc-dg-runtest [lsort [glob $srcdir/c-c++-common/guality/*.c]] "" +} + +if [info exists guality_gdb_name] { + unsetenv GUALITY_GDB_NAME +} + +dg-finish diff --git a/gcc/testsuite/g++.dg/guality/guality.h b/gcc/testsuite/g++.dg/guality/guality.h new file mode 100644 index 00000000000..dd858d28b4b --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/guality.h @@ -0,0 +1 @@ +#include "../../gcc.dg/guality/guality.h" diff --git a/gcc/testsuite/g++.dg/guality/redeclaration1.C b/gcc/testsuite/g++.dg/guality/redeclaration1.C new file mode 100644 index 00000000000..16f2f0ca481 --- /dev/null +++ b/gcc/testsuite/g++.dg/guality/redeclaration1.C @@ -0,0 +1,26 @@ +// { dg-do run } +// { dg-options "-g" } + +volatile int l; + +namespace S +{ + int i = 24; + void __attribute__((noinline)) + f() + { + int i = 42; + l = i; // { dg-final { gdb-test 13 "i" "42" } } + { + extern int i; + l = i; // { dg-final { gdb-test 16 "i" "24" } } + } + } +} + +int +main (void) +{ + S::f (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/inherit/covariant17.C b/gcc/testsuite/g++.dg/inherit/covariant17.C new file mode 100644 index 00000000000..b2de15f7ed6 --- /dev/null +++ b/gcc/testsuite/g++.dg/inherit/covariant17.C @@ -0,0 +1,43 @@ +// PR c++/43120 +// { dg-do run } + +extern "C" void abort (); + +struct A { + int a; + + A(int a_) : a(a_) {} + + A(const A &other) { } + + virtual void dummy() {} +}; + +struct B { + virtual B *clone() const = 0; +}; + +struct C : public virtual B { + virtual C *clone() const = 0; +}; + +struct E* ep; +struct E : public A, public C { + E(int a_) : A(a_) { ep = this; } + + virtual E *clone() const { + if (this != ep) + abort(); + return 0; + } +}; + +int main() { + E *a = new E(123); + C *c = a; + B *b = a; + c->clone(); + b->clone(); + delete a; + return 0; +} diff --git a/gcc/testsuite/g++.dg/inherit/covariant7.C b/gcc/testsuite/g++.dg/inherit/covariant7.C index cbd58bb24e1..4d519ed400b 100644 --- a/gcc/testsuite/g++.dg/inherit/covariant7.C +++ b/gcc/testsuite/g++.dg/inherit/covariant7.C @@ -1,4 +1,6 @@ // { dg-do compile } +// { dg-prune-output "direct base" } +// { dg-options "-fdump-class-hierarchy" } // Copyright (C) 2002 Free Software Foundation, Inc. // Contributed by Nathan Sidwell 27 Dec 2002 <nathan@codesourcery.com> @@ -27,7 +29,23 @@ struct c4 : virtual c3, virtual c0, virtual c1 int m; }; -struct c6 : c0, c3, c4 // { dg-warning "direct base" "" } +struct c6 : c0, c3, c4 { virtual c1 &f2() volatile; }; + +// f2 appears four times in the c6 vtables: +// once in c1-in-c3-in-c6 - covariant, virtual base, uses c1 vcall offset and c0 vbase offset +// { dg-final { scan-tree-dump "24 c6::_ZTcv0_n16_v0_n12_NV2c62f2Ev" "class" { target ilp32 } } } +// { dg-final { scan-tree-dump "48 c6::_ZTcv0_n32_v0_n24_NV2c62f2Ev" "class" { target lp64 } } } +// once in c3-in-c6 - non-covariant, non-virtual base, calls f2 directly +// { dg-final { scan-tree-dump "28 c6::f2" "class" { target ilp32 } } } +// { dg-final { scan-tree-dump "56 c6::f2" "class" { target lp64 } } } +// once in c1-in-c3-in-c4-in-c6 - lost primary +// { dg-final { scan-tree-dump "80 0u" "class" { target ilp32 } } } +// { dg-final { scan-tree-dump "160 0u" "class" { target lp64 } } } +// once in c3-in-c4-in-c6 - c3 vcall offset +// { dg-final { scan-tree-dump "84 c6::_ZTv0_n16_NV2c62f2Ev" "class" { target ilp32 } } } +// { dg-final { scan-tree-dump "168 c6::_ZTv0_n32_NV2c62f2Ev" "class" { target lp64 } } } + +// { dg-final { cleanup-tree-dump "class" } } diff --git a/gcc/testsuite/g++.dg/lto/20100721-1_0.C b/gcc/testsuite/g++.dg/lto/20100721-1_0.C new file mode 100644 index 00000000000..09132e5992b --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20100721-1_0.C @@ -0,0 +1,9 @@ +/* { dg-lto-do assemble } */ + +static inline int __gthread_active_p (void) { } +template <int rank, int dim> class Tensor; +template <int dimension> struct G; +template <int dim> class T { + typedef void A; + typedef Tensor<1,dim> F[G<dim>::v]; +}; diff --git a/gcc/testsuite/g++.dg/lto/20100722-1_0.C b/gcc/testsuite/g++.dg/lto/20100722-1_0.C new file mode 100644 index 00000000000..72393950d03 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/20100722-1_0.C @@ -0,0 +1,5 @@ +/* { dg-lto-do assemble } */ + +template <class T> void void_cast_register(T *) __attribute__ ((used)); +template <class T> void void_cast_register(T *) { } + diff --git a/gcc/testsuite/g++.dg/opt/nrv16.C b/gcc/testsuite/g++.dg/opt/nrv16.C new file mode 100644 index 00000000000..7b24d4a4ee0 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/nrv16.C @@ -0,0 +1,16 @@ +// PR c++/44808 +// { dg-do compile } + +struct S +{ + void *a, *b; + int c; +}; + +S +foo () +{ + S x; + S y = x; + return x; +} diff --git a/gcc/testsuite/g++.dg/other/i386-1.C b/gcc/testsuite/g++.dg/other/i386-1.C index 5a91e603660..ec572ec948d 100644 --- a/gcc/testsuite/g++.dg/other/i386-1.C +++ b/gcc/testsuite/g++.dg/other/i386-1.C @@ -1,11 +1,9 @@ /* { dg-do run { target i?86-*-* x86_64-*-* } } */ /* { dg-options "-msse2" } */ -/* { dg-require-effective-target sse2 } */ +/* { dg-require-effective-target sse2_runtime } */ #include <xmmintrin.h> -#include "cpuid.h" - static void sse2_test (void) { @@ -25,14 +23,6 @@ sse2_test (void) int main () { - unsigned int eax, ebx, ecx, edx; - - if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) - return 0; - - /* Run SSE2 test only if host has SSE2 support. */ - if (edx & bit_SSE2) - sse2_test (); - + sse2_test (); return 0; } diff --git a/gcc/testsuite/g++.dg/other/i386-2.C b/gcc/testsuite/g++.dg/other/i386-2.C index 952fa14c364..729706852e2 100644 --- a/gcc/testsuite/g++.dg/other/i386-2.C +++ b/gcc/testsuite/g++.dg/other/i386-2.C @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -mxop -maes -mpclmul -mpopcnt -mabm -mlwp" } */ +/* { dg-options "-O -pedantic-errors -march=k8 -m3dnow -mavx -mxop -maes -mpclmul -mpopcnt -mabm -mlwp -mfsgsbase -mrdrnd -mf16c" } */ /* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, xopintrin.h, abmintrin.h, lwpintrin.h, popcntintrin.h and mm3dnow.h are usable with diff --git a/gcc/testsuite/g++.dg/other/i386-3.C b/gcc/testsuite/g++.dg/other/i386-3.C index 88dd7693891..75515efb42b 100644 --- a/gcc/testsuite/g++.dg/other/i386-3.C +++ b/gcc/testsuite/g++.dg/other/i386-3.C @@ -1,5 +1,5 @@ /* { dg-do compile { target i?86-*-* x86_64-*-* } } */ -/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -mxop -maes -mpclmul -mpopcnt -mabm -mlwp" } */ +/* { dg-options "-O -fkeep-inline-functions -march=k8 -m3dnow -mavx -mxop -maes -mpclmul -mpopcnt -mabm -mlwp -mfsgsbase -mrdrnd -mf16c" } */ /* Test that {,x,e,p,t,s,w,a,b,i}mmintrin.h, xopintrin.h, abmintrin.h, lwpintrin.h, popcntintrin.h and mm3dnow.h are usable with diff --git a/gcc/testsuite/g++.dg/other/mmintrin.C b/gcc/testsuite/g++.dg/other/mmintrin.C index 417a1acc6de..8315f93d355 100644 --- a/gcc/testsuite/g++.dg/other/mmintrin.C +++ b/gcc/testsuite/g++.dg/other/mmintrin.C @@ -1,4 +1,5 @@ // { dg-do compile { target i?86-*-* x86_64-*-* } } // { dg-options "-msse" } +// { dg-require-effective-target sse } #include <xmmintrin.h> diff --git a/gcc/testsuite/g++.dg/other/pr25632.C b/gcc/testsuite/g++.dg/other/pr25632.C index fe0ad7a2497..e66ae3b51ec 100644 --- a/gcc/testsuite/g++.dg/other/pr25632.C +++ b/gcc/testsuite/g++.dg/other/pr25632.C @@ -2,14 +2,12 @@ /* { dg-do compile } */ -#define unsigned -__extension__ typedef __SIZE_TYPE__ ssize_t; -#undef unsigned +__extension__ typedef __INTPTR_TYPE__ intptr_t; struct sockaddr_un { char sun_path[1]; }; -const unsigned SI_SUN_HEAD_LEN = (ssize_t)(((struct sockaddr_un *)0)->sun_path); +const unsigned SI_SUN_HEAD_LEN = (intptr_t)(((struct sockaddr_un *)0)->sun_path); int SiGetPeerName () { return SI_SUN_HEAD_LEN; diff --git a/gcc/testsuite/g++.dg/other/pr40446.C b/gcc/testsuite/g++.dg/other/pr40446.C index dd0aa482075..72cd1960649 100644 --- a/gcc/testsuite/g++.dg/other/pr40446.C +++ b/gcc/testsuite/g++.dg/other/pr40446.C @@ -1,10 +1,9 @@ // PR middle-end/40446 // { dg-do run { target i?86-*-* x86_64-*-* } } // { dg-options "-O1 -msse2" } -// { dg-require-effective-target sse2 } +// { dg-require-effective-target sse2_runtime } #include <emmintrin.h> -#include "cpuid.h" extern "C" void abort (); @@ -34,14 +33,6 @@ sse2_test () int main () { - unsigned int eax, ebx, ecx, edx; - - if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx)) - return 0; - - /* Run SSE2 test only if host has SSE2 support. */ - if (edx & bit_SSE2) - sse2_test (); - + sse2_test (); return 0; } diff --git a/gcc/testsuite/g++.dg/parse/error28.C b/gcc/testsuite/g++.dg/parse/error28.C index 7e235a13b21..a0b1e7f690f 100644 --- a/gcc/testsuite/g++.dg/parse/error28.C +++ b/gcc/testsuite/g++.dg/parse/error28.C @@ -3,7 +3,7 @@ struct virt { virt () {} virt (int i) {} }; struct der : public virtual virt { // { dg-message "8:der::der" } - der (int i) : virt(i) {} // { dg-message "3:candidates are: der" } + der (int i) : virt(i) {} // { dg-message "3:der::der" } }; struct top : public der { top () {} // { dg-bogus "der\\(const" } diff --git a/gcc/testsuite/g++.dg/parse/template25.C b/gcc/testsuite/g++.dg/parse/template25.C new file mode 100644 index 00000000000..8ffcd121e18 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/template25.C @@ -0,0 +1,14 @@ +// PR c++/22318. Improve diagnostic for local template declaration. +// { dg-do compile } +void f(void) +{ + template<typename T> class A /* { dg-error "a template declaration cannot appear at block scope" } */ + { + }; +} + +void g(void) +{ + template f<int>(); /* { dg-error "expected primary-expression" } */ + /* { dg-error "expected ';'" "" { target *-*-* } 12 } */ +} diff --git a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c index 6327095f7cd..e5b0566837d 100644 --- a/gcc/testsuite/g++.dg/plugin/attribute_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/attribute_plugin.c @@ -10,6 +10,7 @@ #include "intl.h" #include "toplev.h" #include "plugin.h" +#include "diagnostic.h" int plugin_is_GPL_compatible; @@ -43,7 +44,7 @@ handle_pre_generic (void *event_data, void *data) { tree fndecl = (tree) event_data; tree arg; - for (arg = DECL_ARGUMENTS(fndecl); arg; arg = TREE_CHAIN (arg)) { + for (arg = DECL_ARGUMENTS(fndecl); arg; arg = DECL_CHAIN (arg)) { tree attr; for (attr = DECL_ATTRIBUTES (arg); attr; attr = TREE_CHAIN (attr)) { tree attrname = TREE_PURPOSE (attr); diff --git a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c index f12a6a0d35b..5bbd5d790fe 100644 --- a/gcc/testsuite/g++.dg/plugin/dumb_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/dumb_plugin.c @@ -10,6 +10,7 @@ #include "tree-pass.h" #include "intl.h" #include "toplev.h" +#include "diagnostic.h" int plugin_is_GPL_compatible; diff --git a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c index 4a9ea47195d..940c302df7d 100644 --- a/gcc/testsuite/g++.dg/plugin/pragma_plugin.c +++ b/gcc/testsuite/g++.dg/plugin/pragma_plugin.c @@ -14,6 +14,7 @@ #include "tree-pass.h" #include "intl.h" #include "toplev.h" +#include "diagnostic.h" int plugin_is_GPL_compatible; diff --git a/gcc/testsuite/g++.dg/plugin/selfassign.c b/gcc/testsuite/g++.dg/plugin/selfassign.c index df42abd27df..84d2801d202 100644 --- a/gcc/testsuite/g++.dg/plugin/selfassign.c +++ b/gcc/testsuite/g++.dg/plugin/selfassign.c @@ -14,6 +14,7 @@ #include "tree-pass.h" #include "intl.h" #include "plugin-version.h" +#include "diagnostic.h" int plugin_is_GPL_compatible; @@ -52,9 +53,7 @@ get_real_ref_rhs (tree expr) /* We are only interested in an assignment with a single rhs operand because if it is not, the original assignment will not possibly be a self-assignment. */ - if (is_gimple_assign (def_stmt) - && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt)) - == GIMPLE_SINGLE_RHS)) + if (gimple_assign_single_p (def_stmt)) return get_real_ref_rhs (gimple_assign_rhs1 (def_stmt)); else return NULL_TREE; @@ -66,7 +65,7 @@ get_real_ref_rhs (tree expr) case PARM_DECL: case FIELD_DECL: case COMPONENT_REF: - case INDIRECT_REF: + case MEM_REF: case ARRAY_REF: return expr; default: @@ -116,17 +115,18 @@ get_non_ssa_expr (tree expr) else return expr; } - case INDIRECT_REF: + case MEM_REF: { tree orig_base = TREE_OPERAND (expr, 0); - tree base = get_non_ssa_expr (orig_base); - if (!base) - return NULL_TREE; - /* If BASE is converted, build a new indirect reference tree. */ - if (base != orig_base) - return build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (base)), base); - else - return expr; + if (TREE_CODE (orig_base) == SSA_NAME) + { + tree base = get_non_ssa_expr (orig_base); + if (!base) + return NULL_TREE; + return fold_build2 (MEM_REF, TREE_TYPE (expr), + base, TREE_OPERAND (expr, 1)); + } + return expr; } case ARRAY_REF: { @@ -153,9 +153,7 @@ get_non_ssa_expr (tree expr) && !gimple_nop_p (SSA_NAME_DEF_STMT (expr))) { gimple def_stmt = SSA_NAME_DEF_STMT (expr); - if (is_gimple_assign (def_stmt) - && (get_gimple_rhs_class (gimple_assign_rhs_code (def_stmt)) - == GIMPLE_SINGLE_RHS)) + if (gimple_assign_single_p (def_stmt)) vdecl = gimple_assign_rhs1 (def_stmt); } return get_non_ssa_expr (vdecl); @@ -201,9 +199,7 @@ warn_self_assign (gimple stmt) tree rhs, lhs; /* Check assigment statement. */ - if (is_gimple_assign (stmt) - && (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)) - == GIMPLE_SINGLE_RHS)) + if (gimple_assign_single_p (stmt)) { rhs = get_real_ref_rhs (gimple_assign_rhs1 (stmt)); if (!rhs) diff --git a/gcc/testsuite/g++.dg/template/crash100.C b/gcc/testsuite/g++.dg/template/crash100.C new file mode 100644 index 00000000000..c67ae2eca38 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash100.C @@ -0,0 +1,24 @@ +// PR c++/44628 + +template <typename T> +class Temp +{ + int Val; + public: + operator T&(void) { return Val; } + + virtual T& operator=(T a ) // { dg-error "overriding" } + { + Val = a; + return Val; + } +}; + +class Int : public Temp<int> +{ + public: + Int& operator=(int a) // { dg-error "conflicting return type" } + { + return (*this); + } +}; diff --git a/gcc/testsuite/g++.dg/template/crash101.C b/gcc/testsuite/g++.dg/template/crash101.C new file mode 100644 index 00000000000..c59737a8938 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash101.C @@ -0,0 +1,12 @@ +// PR c++/44039 + +struct locale { }; + +template<class charT> + void + foo() + { locale::locale(); } // { dg-error "cannot call|function-style" } + +void +bar() +{ foo<char>(); } diff --git a/gcc/testsuite/g++.dg/template/dtor7.C b/gcc/testsuite/g++.dg/template/dtor7.C index e96f56397eb..186b561e9c3 100644 --- a/gcc/testsuite/g++.dg/template/dtor7.C +++ b/gcc/testsuite/g++.dg/template/dtor7.C @@ -1,5 +1,5 @@ // PR c++/40373 -// { dg-compile } +// { dg-do compile } struct A; namespace diff --git a/gcc/testsuite/g++.dg/template/partial8.C b/gcc/testsuite/g++.dg/template/partial8.C new file mode 100644 index 00000000000..4db7e18689e --- /dev/null +++ b/gcc/testsuite/g++.dg/template/partial8.C @@ -0,0 +1,4 @@ +// PR c++/32505 +template <class T> struct A { }; +A<int*> a; +template <class T> struct A<T*> { }; // { dg-error "A<int\\*>" } diff --git a/gcc/testsuite/g++.dg/template/ptrmem17.C b/gcc/testsuite/g++.dg/template/ptrmem17.C index a79e3c882fa..5c5ee3fc30e 100644 --- a/gcc/testsuite/g++.dg/template/ptrmem17.C +++ b/gcc/testsuite/g++.dg/template/ptrmem17.C @@ -7,4 +7,4 @@ template<int> struct A ~A() { &A::i; } // { dg-error "reference" } }; -A<0> a; // { dg-message "instantiated" } +A<0> a; diff --git a/gcc/testsuite/g++.dg/template/ptrmem22.C b/gcc/testsuite/g++.dg/template/ptrmem22.C new file mode 100644 index 00000000000..762f377f5b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ptrmem22.C @@ -0,0 +1,29 @@ +// PR c++/44778 + +enum Healpix_Ordering_Scheme { RING, NEST }; + +class Healpix_Base + { + protected: + Healpix_Ordering_Scheme scheme_; + int nest2ring (int pix) const; + int ring2nest (int pix) const; + + typedef int (Healpix_Base::*swapfunc)(int pix) const; + }; + +template<typename T> class Healpix_Map: public Healpix_Base + { + public: + void Import_nograde (const Healpix_Map<T> &orig) + { + swapfunc swapper = (scheme_ == NEST) ? + &Healpix_Map::ring2nest : &Healpix_Map::nest2ring; + } + }; + +int main() + { + Healpix_Map<double> a,b; + a.Import_nograde(b); + } diff --git a/gcc/testsuite/g++.dg/template/sfinae19.C b/gcc/testsuite/g++.dg/template/sfinae19.C new file mode 100644 index 00000000000..59be183feb5 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae19.C @@ -0,0 +1,44 @@ +// PR c++/44907 + +struct A { }; + +struct B +: public A { }; + +struct C +: public A { }; + +struct D +: public B, public C { }; + +template<bool, typename T = void> struct enable_if { typedef T type; }; +template<typename T> struct enable_if<false, T> { }; + +template<typename From, typename To> + class mini_is_convertible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename To1> + static void test_aux(To1); + + template<typename To1, typename From1> + static typename + enable_if<(sizeof(test_aux<To1>(From1()), 1) > 0), one>::type + test(int); + + template<typename, typename> + static two test(...); + + public: + static const bool value = sizeof(test<To, From>(0)) == 1; + }; + +template<typename From, typename To> + const bool mini_is_convertible<From, To>::value; + +int Test1[mini_is_convertible<D*, A*>::value ? -1 : 1]; +int Test2[mini_is_convertible<A*, D*>::value ? -1 : 1]; +int Test3[mini_is_convertible<D, A>::value ? -1 : 1]; +int Test4[mini_is_convertible<A, D>::value ? -1 : 1]; diff --git a/gcc/testsuite/g++.dg/template/sfinae20.C b/gcc/testsuite/g++.dg/template/sfinae20.C new file mode 100644 index 00000000000..9767bc02984 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae20.C @@ -0,0 +1,45 @@ +// PR c++/44907 +// { dg-options "-std=c++0x" } + +#include <utility> + +struct A { }; + +struct B +: public A { }; + +struct C +: public A { }; + +struct D +: public B, public C { }; + +template<typename From, typename To> + class mini_is_convertible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename To1> + static void test_aux(To1); + + template<typename To1, typename From1> + static decltype(test_aux<To1>(std::declval<From1>()), one()) + test(int); + + template<typename, typename> + static two test(...); + + public: + static const bool value = sizeof(test<To, From>(0)) == 1; + }; + +template<typename From, typename To> + const bool mini_is_convertible<From, To>::value; + +static_assert (!mini_is_convertible<D*, A*>::value, ""); +static_assert (!mini_is_convertible<A*, D*>::value, ""); +static_assert (!mini_is_convertible<D&, A&>::value, ""); +static_assert (!mini_is_convertible<A&, D&>::value, ""); +static_assert (!mini_is_convertible<D, A>::value, ""); +static_assert (!mini_is_convertible<A, D>::value, ""); diff --git a/gcc/testsuite/g++.dg/template/sfinae21.C b/gcc/testsuite/g++.dg/template/sfinae21.C new file mode 100644 index 00000000000..6086f2f9e7d --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae21.C @@ -0,0 +1,40 @@ +// PR c++/44908 + +struct A { }; + +struct B +: public virtual A { }; + +template<bool, typename T = void> struct enable_if { typedef T type; }; +template<typename T> struct enable_if<false, T> { }; + +template<typename From, typename To> + class mini_is_convertible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename To1> + static void test_aux(To1); + + template<typename To1, typename From1> + static typename + enable_if<(sizeof(test_aux<To1>(From1()), 1) > 0), one>::type + test(int); + + template<typename, typename> + static two test(...); + + public: + static const bool value = sizeof(test<To, From>(0)) == 1; + }; + +template<typename From, typename To> + const bool mini_is_convertible<From, To>::value; + +int Test1[mini_is_convertible<int (B::*) (int), + int (A::*) (int)>::value ? -1 : 1]; +int Test2[mini_is_convertible<int (B::*), int (A::*)>::value ? -1 : 1]; +int Test3[mini_is_convertible<int (A::*) (int), + int (B::*) (int)>::value ? -1 : 1]; +int Test4[mini_is_convertible<int (A::*), int (B::*)>::value ? -1 : 1]; diff --git a/gcc/testsuite/g++.dg/template/sfinae22.C b/gcc/testsuite/g++.dg/template/sfinae22.C new file mode 100644 index 00000000000..cdac99d91b7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae22.C @@ -0,0 +1,39 @@ +// PR c++/44908 +// { dg-options "-std=c++0x" } + +#include <utility> + +struct A { }; + +struct B +: public virtual A { }; + +template<typename From, typename To> + class mini_is_convertible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename To1> + static void test_aux(To1); + + template<typename To1, typename From1> + static decltype(test_aux<To1>(std::declval<From1>()), one()) + test(int); + + template<typename, typename> + static two test(...); + + public: + static const bool value = sizeof(test<To, From>(0)) == 1; + }; + +template<typename From, typename To> + const bool mini_is_convertible<From, To>::value; + +static_assert (!mini_is_convertible<int (B::*) (int), + int (A::*) (int)>::value, ""); +static_assert (!mini_is_convertible<int (B::*), int (A::*)>::value, ""); +static_assert (!mini_is_convertible<int (A::*) (int), + int (B::*) (int)>::value, ""); +static_assert (!mini_is_convertible<int (A::*), int (B::*)>::value, ""); diff --git a/gcc/testsuite/g++.dg/template/sfinae23.C b/gcc/testsuite/g++.dg/template/sfinae23.C new file mode 100644 index 00000000000..9e0197a7050 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae23.C @@ -0,0 +1,23 @@ +// PR c++/44969 +// { dg-options "-std=c++0x" } + +template<typename Tp, typename... Args> + class mini_is_constructible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename Tp1, typename... Args1> + static decltype(Tp1(Args1()...), one()) + test(int); + + template<typename, typename...> + static two test(...); + + public: + static const bool value = sizeof(test<Tp, Args...>(0)) == 1; + }; + +class A { }; + +int Test[mini_is_constructible<int, A, A>::value ? -1 : 1]; diff --git a/gcc/testsuite/g++.dg/template/sfinae24.C b/gcc/testsuite/g++.dg/template/sfinae24.C new file mode 100644 index 00000000000..7138c96e66f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae24.C @@ -0,0 +1,26 @@ +// PR c++/44969 + +template<bool, typename T = void> struct enable_if { typedef T type; }; +template<typename T> struct enable_if<false, T> { }; + +template<typename Tp, typename Arg1, typename Arg2> + class mini_is_constructible + { + typedef char one; + typedef struct { char arr[2]; } two; + + template<typename Tp1, typename Arg1_, typename Arg2_> + static typename + enable_if<(sizeof(Tp1(Arg1_(), Arg2_()), 1) > 0), one>::type + test(int); + + template<typename, typename, typename> + static two test(...); + + public: + static const bool value = sizeof(test<Tp, Arg1, Arg2>(0)) == 1; + }; + +class A { }; + +int Test[mini_is_constructible<int, A, A>::value ? -1 : 1]; diff --git a/gcc/testsuite/g++.dg/template/warn1.C b/gcc/testsuite/g++.dg/template/warn1.C index 0cdffcd3c51..2b804f7ca8f 100644 --- a/gcc/testsuite/g++.dg/template/warn1.C +++ b/gcc/testsuite/g++.dg/template/warn1.C @@ -9,8 +9,8 @@ template <class T> void Foo(T i) { i++, i++; - i, i++; // { dg-warning "left-hand operand" "" } - i++, i; // { dg-warning "right-hand operand" "" } + i, i++; // { dg-warning "left operand" "" } + i++, i; // { dg-warning "right operand" "" } for (;; --i, ++i) ; } diff --git a/gcc/testsuite/g++.dg/tls/static-1.C b/gcc/testsuite/g++.dg/tls/static-1.C index 027a9429766..506b0fcf7a0 100644 --- a/gcc/testsuite/g++.dg/tls/static-1.C +++ b/gcc/testsuite/g++.dg/tls/static-1.C @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-require-effective-target tls_runtime } +// { dg-add-options tls } // { dg-additional-sources "static-1a.cc" } extern "C" void abort (); diff --git a/gcc/testsuite/g++.dg/tls/static-1a.cc b/gcc/testsuite/g++.dg/tls/static-1a.cc index 47a7a2717c0..1c6109f861e 100644 --- a/gcc/testsuite/g++.dg/tls/static-1a.cc +++ b/gcc/testsuite/g++.dg/tls/static-1a.cc @@ -1,6 +1,7 @@ // { dg-do run } // { dg-options "-O2" } // { dg-require-effective-target tls_runtime } +// { dg-add-options tls } // { dg-additional-sources "static-1a.cc" } struct A diff --git a/gcc/testsuite/g++.dg/torture/20100702-1.C b/gcc/testsuite/g++.dg/torture/20100702-1.C new file mode 100644 index 00000000000..3d223fffb48 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/20100702-1.C @@ -0,0 +1,37 @@ +// { dg-do compile } +// { dg-options "-fprefetch-loop-arrays -w" } + +class ggPoint3 { +public: + ggPoint3(); + inline double &x() { + return e[0]; + } + inline double &y() { + return e[1]; + } + ggPoint3(const ggPoint3 &p); + double e[3]; +}; +class ggBox3 { +public: + ggPoint3 min() const; +}; +class ggHAffineMatrix3; +ggPoint3 operator*(const ggHAffineMatrix3 &m, const ggPoint3 &v); +void foo (ggPoint3 *); +void SetMatrix(ggHAffineMatrix3& toworld, ggBox3& box) +{ + ggPoint3 p[2][2][2]; + int i, j, k; + for (i = 0; i < 2; j++) + for (k = 0; k < 2; k++) + { + if (i == 0) + p[i][j][k].x() = box.min().x(); + if (j == 0) + p[i][j][k].y() = box.min().y(); + p[i][j][k] = toworld * p[i][j][k]; + } + foo (&p[0][0][0]); +} diff --git a/gcc/testsuite/g++.dg/torture/pr36745.C b/gcc/testsuite/g++.dg/torture/pr36745.C index 86047f1f0d8..53845aaa78e 100644 --- a/gcc/testsuite/g++.dg/torture/pr36745.C +++ b/gcc/testsuite/g++.dg/torture/pr36745.C @@ -52,6 +52,7 @@ public: inline QMap ():d (&QMapData::shared_null) }; struct QVectorData { + QBasicAtomicInt ref; static QVectorData shared_null; }; template < typename T > struct QVectorTypedData diff --git a/gcc/testsuite/g++.dg/torture/pr36960.C b/gcc/testsuite/g++.dg/torture/pr36960.C new file mode 100644 index 00000000000..280a6755d95 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr36960.C @@ -0,0 +1,22 @@ +// { dg-do run } + +struct Lower { + const int& ref; + Lower(const int& ref) : ref(ref) { } +}; +struct Middle : public virtual Lower { + Middle(const int& ref) : Lower(ref) { } +}; +struct Upper : public Middle { + Upper(const int& ref) : Lower(ref), Middle(ref) { } + int get() { return ref; } +}; +extern "C" void abort (void); +int main() +{ + int i = 0; + Upper upper(i); + if (upper.get() != 0) + abort (); + return 0; +} diff --git a/gcc/testsuite/g++.dg/torture/pr44809.C b/gcc/testsuite/g++.dg/torture/pr44809.C new file mode 100644 index 00000000000..b6615f23f1c --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44809.C @@ -0,0 +1,6 @@ +// { dg-do compile } +unsigned int mEvictionRank[(1 << 5)]; +void Unswap(int i) +{ + mEvictionRank[i] = ({ unsigned int __v = i; __v; }); +} diff --git a/gcc/testsuite/g++.dg/torture/pr44813.C b/gcc/testsuite/g++.dg/torture/pr44813.C new file mode 100644 index 00000000000..1dc01b06a17 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44813.C @@ -0,0 +1,60 @@ +typedef unsigned int PRUint32; +typedef int PRInt32; +typedef unsigned long PRUint64; +typedef int PRIntn; +typedef PRIntn PRBool; +struct nsRect { + nsRect(const nsRect& aRect) { } +}; +enum nsCompatibility { eCompatibility_NavQuirks = 3 }; +class gfxContext; +typedef PRUint64 nsFrameState; +class nsPresContext { +public: + nsCompatibility CompatibilityMode() const { } +}; +class nsStyleContext { +public: + PRBool HasTextDecorations() const; +}; +class nsIFrame { +public: + nsPresContext* PresContext() const; + nsStyleContext* GetStyleContext() const; + nsFrameState GetStateBits() const; + nsRect GetOverflowRect() const; +}; +class nsFrame : public nsIFrame { }; +class nsLineList_iterator { }; +class nsLineList { +public: + typedef nsLineList_iterator iterator; +}; +class gfxSkipCharsIterator { }; +class gfxTextRun { +public: + class PropertyProvider { }; +}; +class nsTextFrame : public nsFrame +{ + virtual nsRect ComputeTightBounds(gfxContext* aContext) const; + gfxSkipCharsIterator EnsureTextRun(gfxContext* aReferenceContext = 0L, + nsIFrame* aLineContainer = 0L, + const nsLineList::iterator* aLine = 0L, + PRUint32* aFlowEndInTextRun = 0L); +}; +class PropertyProvider : public gfxTextRun::PropertyProvider +{ +public: + PropertyProvider(nsTextFrame* aFrame, const gfxSkipCharsIterator& aStart); + PRInt32 mLength[64]; +}; +nsRect nsTextFrame::ComputeTightBounds(gfxContext* aContext) const +{ + if ((GetStyleContext()->HasTextDecorations() + && eCompatibility_NavQuirks == PresContext()->CompatibilityMode()) + || (GetStateBits() & (nsFrameState(1) << (23)))) + return GetOverflowRect(); + gfxSkipCharsIterator iter = const_cast<nsTextFrame*>(this)->EnsureTextRun(); + PropertyProvider provider(const_cast<nsTextFrame*>(this), iter); +} diff --git a/gcc/testsuite/g++.dg/torture/pr44826.C b/gcc/testsuite/g++.dg/torture/pr44826.C new file mode 100644 index 00000000000..aece1407070 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44826.C @@ -0,0 +1,44 @@ +typedef unsigned short PRUint16; +typedef PRUint16 PRUnichar; +template <class CharT> struct nsCharTraits { +}; +class nsAString_internal { +public: + typedef PRUnichar char_type; +}; +class nsString : public nsAString_internal { +public: + typedef nsString self_type; + nsString( const self_type& str ); +}; +class nsDependentString : public nsString { +public: + explicit nsDependentString( const char_type* data ); +}; +typedef struct sqlite3_stmt sqlite3_stmt; +const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); +class nsIVariant { }; +template <typename DataType> struct variant_storage_traits { + typedef DataType ConstructorType; + typedef DataType StorageType; + static inline StorageType storage_conversion(ConstructorType aData) { + return aData; + } +}; +template <typename DataType> class Variant : public nsIVariant { +public: + Variant(typename variant_storage_traits<DataType>::ConstructorType aData) + : mData(variant_storage_traits<DataType>::storage_conversion(aData)) {} + typename variant_storage_traits<DataType>::StorageType mData; +}; +typedef Variant<nsString> TextVariant; +class Row { + void initialize(sqlite3_stmt *aStatement); +}; +void Row::initialize(sqlite3_stmt *aStatement) +{ + nsDependentString str(static_cast<const PRUnichar +*>(::sqlite3_column_text16(aStatement, 0))); + new TextVariant(str); +} + diff --git a/gcc/testsuite/g++.dg/torture/pr44900.C b/gcc/testsuite/g++.dg/torture/pr44900.C new file mode 100644 index 00000000000..5c0efcb4b4e --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44900.C @@ -0,0 +1,76 @@ +/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +/* { dg-options "-msse" } */ +/* { dg-require-effective-target sse } */ + +typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__)); +typedef float __v4sf __attribute__ ((__vector_size__ (16))); + +extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, +__artificial__)) +_mm_set_ps (const float __Z, const float __Y, const float __X, const float __W) +{ + return __extension__ (__m128)(__v4sf){ __W, __X, __Y, __Z }; +} + +struct vec +{ + union { + __m128 v; + float e[4]; + }; + + static const vec & zero() + { + static const vec v = _mm_set_ps(0, 0, 0, 0); + return v; + } + + vec() {} + vec(const __m128 & a) : v(a) {} + + operator const __m128&() const { return v; } +}; + +struct vec2 +{ + vec _v1; + vec _v2; + + vec2() {} + vec2(const vec & a, const vec & b) : _v1(a), _v2(b) {} + + static vec2 load(const float * a) + { + return vec2( + __builtin_ia32_loadups(&a[0]), + __builtin_ia32_loadups(&a[4])); + } + + const vec & v1() const { return _v1; } + const vec & v2() const { return _v2; } +}; + +extern "C" void abort(void); + + +inline bool operator==(const vec & a, const vec & b) +{ return 0xf == __builtin_ia32_movmskps(__builtin_ia32_cmpeqps(a, b)); } + +int main( int argc, char * argv[] ) +{ + __attribute__((aligned(16))) float data[] = + { 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5 }; + + float * p = &data[2]; + vec2 a; + + a = vec2::load(p); + + vec v1 = a.v1(); + vec v2 = a.v2(); + + if (v2.e[3] != 7.0) + abort(); + + return 0; +} diff --git a/gcc/testsuite/g++.dg/torture/pr44915.C b/gcc/testsuite/g++.dg/torture/pr44915.C new file mode 100644 index 00000000000..ba7e9660622 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr44915.C @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-findirect-inlining" } */ + +struct A; + +typedef void (A::*f_ptr) (); + +void dummy (f_ptr) { } + +void call_dummy (f_ptr cb) +{ + dummy (cb); +} diff --git a/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C b/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C index 2be04691537..03f6b1207c7 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C +++ b/gcc/testsuite/g++.dg/tree-ssa/copyprop-1.C @@ -25,5 +25,7 @@ int foo(Object&o) return o[0]; } -/* { dg-final { scan-tree-dump-not ".* = \[^>;\]*;" "dce2" } } */ +/* Remaining should be two loads. */ + +/* { dg-final { scan-tree-dump-times " = \[^\n\]*;" 2 "dce2" } } */ /* { dg-final { cleanup-tree-dump "dce2" } } */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr19952.C b/gcc/testsuite/g++.dg/tree-ssa/pr19952.C index 92d669c1415..54589a294cc 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr19952.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr19952.C @@ -1,5 +1,5 @@ /* PR 19952 */ -/* { dg-compile } */ +/* { dg-do compile } */ /* { dg-options "-ftree-vectorize -O2" } */ int i; diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr31146.C b/gcc/testsuite/g++.dg/tree-ssa/pr31146.C index 96790239693..478a488e3c2 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr31146.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr31146.C @@ -12,5 +12,5 @@ void foo (int j) *q = 1; } -/* { dg-final { scan-tree-dump "i\\\[j.*\\\] =.* 1;" "forwprop1" } } */ +/* { dg-final { scan-tree-dump "MEM\\\[.*&i\\\]\\\[j.*\\\] =.* 1;" "forwprop1" } } */ /* { dg-final { cleanup-tree-dump "forwprop?" } } */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C index d78006220ed..7e820d3ef16 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/pr33604.C +++ b/gcc/testsuite/g++.dg/tree-ssa/pr33604.C @@ -1,5 +1,5 @@ /* { dg-do run } */ -/* { dg-options "-O -fdump-tree-forwprop1" } */ +/* { dg-options "-O -fdump-tree-optimized-vops" } */ struct Value { @@ -35,12 +35,14 @@ int main(int argc, char *argv[]) return 0; } -/* Check that we forward propagated +/* Check that we propagate D.2182_13 = (struct Ref *) &D.2137.lhs; to D.2182_13->lhs.m ={v} &I; yielding - D.2137.lhs.m ={v} &I; */ + D.2137.lhs.m ={v} &I; + so that SRA can promote all locals to registers and we end up + referencing a single virtual operand at abort () after optimization. */ -/* { dg-final { scan-tree-dump-times "D\\\.....\\\..hs\\\.m =" 2 "forwprop1" } } */ -/* { dg-final { cleanup-tree-dump "forwprop1" } } */ +/* { dg-final { scan-tree-dump-times ".MEM_\[0-9\]*\\\(D\\\)" 1 "optimized" } } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr44706.C b/gcc/testsuite/g++.dg/tree-ssa/pr44706.C new file mode 100644 index 00000000000..39904d8b9e0 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr44706.C @@ -0,0 +1,46 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-fnsplit" } */ +class MemoryManager; +class XMLExcepts { +public : + enum Codes { + AttrList_BadIndex + }; +}; +class XMLException { +public: + XMLException(const char* const srcFile, const unsigned int srcLine, +MemoryManager* const memoryManager = 0); +}; +class ArrayIndexOutOfBoundsException : public XMLException { +public: + ArrayIndexOutOfBoundsException(const char* const srcFile , const unsigned +int srcLine , const XMLExcepts::Codes toThrow , MemoryManager* memoryManager = +0) : XMLException(srcFile, srcLine, memoryManager) { + } +}; +class XMLAttDef { + bool fExternalAttribute; +}; +class XMLAttDefList { +public: + MemoryManager* getMemoryManager() const; +}; +class DTDAttDef : public XMLAttDef { +}; +class DTDAttDefList : public XMLAttDefList { + virtual const XMLAttDef &getAttDef(unsigned int index) const ; + DTDAttDef** fArray; + unsigned int fCount; +}; +const XMLAttDef &DTDAttDefList::getAttDef(unsigned int index) const { + if(index >= fCount) + throw ArrayIndexOutOfBoundsException("foo.cpp", 0, +XMLExcepts::AttrList_BadIndex, getMemoryManager()); + return *(fArray[index]); +} + +/* Mistake in branch prediction caused us to split away real body of the function keeping + only throw () invokation. This is bad idea. */ +/* { dg-final { scan-tree-dump-not "Splitting function" "fnsplit"} } */ +/* { dg-final { cleanup-tree-dump "fnsplit" } } */ diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr44914.C b/gcc/testsuite/g++.dg/tree-ssa/pr44914.C new file mode 100644 index 00000000000..57ca7e83f17 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/pr44914.C @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fipa-sra -fnon-call-exceptions" } */ + +struct A +{ + ~A () { } +}; + +struct B +{ + A a; + int i; + void f (int) { } + B () + { + f (i); + } +}; + +B b; diff --git a/gcc/testsuite/g++.dg/vect/pr44861.cc b/gcc/testsuite/g++.dg/vect/pr44861.cc new file mode 100644 index 00000000000..07c59a1382d --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr44861.cc @@ -0,0 +1,34 @@ +// { dg-do compile } + +bool f(); + +struct counted_base { + virtual void destroy() { } + void release() { if (f()) destroy(); } +}; + +struct shared_count { + shared_count() { } + ~shared_count() { if (pi) pi->release(); } + shared_count(shared_count& r) : pi(r.pi) { if (pi) pi->release(); } + counted_base* pi; +}; + +struct Foo; + +struct shared_ptr { + Foo& operator*() { return *ptr; } + Foo* ptr; + shared_count refcount; +}; + +struct Bar { + Bar(Foo&, shared_ptr); +}; + +void g() { + shared_ptr foo; + new Bar(*foo, foo); +} + +// { dg-final { cleanup-tree-dump "vect" } } diff --git a/gcc/testsuite/g++.dg/vect/vect.exp b/gcc/testsuite/g++.dg/vect/vect.exp index aa450661107..fe173429a76 100644 --- a/gcc/testsuite/g++.dg/vect/vect.exp +++ b/gcc/testsuite/g++.dg/vect/vect.exp @@ -75,11 +75,8 @@ if [istarget "powerpc-*paired*"] { } elseif { [istarget "spu-*-*"] } { set dg-do-what-default run } elseif { [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] } { - if { ![check_effective_target_sse2] } then { - return - } lappend DEFAULT_VECTCFLAGS "-msse2" - if [check_sse2_hw_available] { + if { [check_effective_target_sse2_runtime] } { set dg-do-what-default run } else { set dg-do-what-default compile diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-7.C b/gcc/testsuite/g++.dg/warn/Wshadow-7.C new file mode 100644 index 00000000000..5de952ee790 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wshadow-7.C @@ -0,0 +1,37 @@ +// PR c++/44128 +// { dg-options "-Wshadow" } + +typedef long My_ssize_t; // { dg-warning "shadowed declaration" } +typedef int Foo; // { dg-warning "shadowed declaration" } +struct Bar1 { // { dg-bogus "shadowed declaration" } + int a; +}; +struct Bar2 { // { dg-warning "shadowed declaration" } + int a; +}; + +void func() { + typedef int My_ssize_t; // { dg-warning "shadows a global" } + typedef char My_Num; // { dg-warning "shadowed declaration" } + { + typedef short My_Num; // { dg-warning "shadows a previous local" } + } + int Foo; // { dg-warning "shadows a global" } + float Bar1; // { dg-bogus "shadows a global" } + struct Bar2 { // { dg-warning "shadows a global" } + int a; + }; + struct Bar3 { // { dg-warning "shadowed declaration" } + int a; + }; + struct Bar4 { // { dg-bogus "shadowed declaration" } + int a; + }; + { + struct Bar3 { // { dg-warning "shadows a previous local" } + int a; + }; + char Bar4; // { dg-bogus "shadows a previous local" } + int My_Num; // { dg-warning "shadows a previous local" } + } +} diff --git a/gcc/testsuite/g++.dg/warn/noeffect2.C b/gcc/testsuite/g++.dg/warn/noeffect2.C index 01323659597..451e0382a86 100644 --- a/gcc/testsuite/g++.dg/warn/noeffect2.C +++ b/gcc/testsuite/g++.dg/warn/noeffect2.C @@ -10,11 +10,11 @@ extern "C" void FormatDisk(); template <class T> struct C { - C(){ FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } + C(){ FormatDisk(), 0; } // { dg-warning "right operand of comma" "" } }; template struct C<int>; // { dg-message "instantiated" } template <class T> - void f() { FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } + void f() { FormatDisk(), 0; } // { dg-warning "right operand of comma" "" } template void f<int> (); // { dg-message "instantiated" } -void g() { FormatDisk(), 0; } // { dg-warning "right-hand operand of comma" "" } +void g() { FormatDisk(), 0; } // { dg-warning "right operand of comma" "" } diff --git a/gcc/testsuite/g++.dg/warn/volatile1.C b/gcc/testsuite/g++.dg/warn/volatile1.C index 5b1050f9a1c..ac9dd4df354 100644 --- a/gcc/testsuite/g++.dg/warn/volatile1.C +++ b/gcc/testsuite/g++.dg/warn/volatile1.C @@ -8,5 +8,5 @@ struct A }; void A::baz() volatile { - *this; // { dg-warning "will not be accessed" } + *this; // { dg-warning "indirection will not access" } } |