diff options
Diffstat (limited to 'gcc/testsuite')
23 files changed, 540 insertions, 38 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index abf1d8f648e..e2232f687ba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,102 @@ +2022-11-07 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/55157 + * gcc.dg/tree-ssa/pr55157.c: New test. + +2022-11-07 H.J. Lu <hjl.tools@gmail.com> + + PR middle-end/102566 + * g++.target/i386/pr102566-7.C + +2022-11-07 Nathan Sidwell <nathan@acm.org> + + * g++.dg/abi/lambda-tpl1.h: Add more cases. + * g++.dg/abi/lambda-tpl1-17.C: Add checks. + * g++.dg/abi/lambda-tpl1-18.C: Likewise. + * g++.dg/abi/lambda-tpl1-18vs17.C: Likewise. + +2022-11-07 Alexander Monakov <amonakov@ispras.ru> + + PR tree-optimization/107505 + * gcc.dg/pr107505.c: New test. + +2022-11-07 Aldy Hernandez <aldyh@redhat.com> + + PR tree-optimization/107541 + * gcc.dg/tree-ssa/pr107541.c: New test. + +2022-11-07 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/107508 + * gfortran.dg/widechar_11.f90: New test. + +2022-11-07 konglin1 <lingling.kong@intel.com> + + * gcc.target/i386/sse-22.c: Fix typo in pragma GCC target. + +2022-11-07 Kewen Lin <linkw@linux.ibm.com> + + PR tree-optimization/107412 + * gcc.target/powerpc/pr107412.c: New test. + * gcc.target/powerpc/p9-vec-length-epil-8.c: Adjust scan times for + folded LEN_LOAD. + +2022-11-07 Hu, Lin1 <lin1.hu@intel.com> + + * g++.target/i386/mv16.C: Add grandridge. + * gcc.target/i386/funcspec-56.inc: Handle new march. + +2022-11-07 konglin1 <lingling.kong@intel.com> + + * gcc.target/i386/raoint-atomic-fetch.c: New test. + +2022-11-07 konglin1 <lingling.kong@intel.com> + + * g++.dg/other/i386-2.C: Add -mraoint. + * g++.dg/other/i386-3.C: Ditto. + * gcc.target/i386/funcspec-56.inc: Add new target attribute. + * gcc.target/i386/sse-12.c: Add -mraoint. + * gcc.target/i386/sse-13.c: Ditto. + * gcc.target/i386/sse-14.c: Ditto. + * gcc.target/i386/sse-22.c: Add raoint target. + * gcc.target/i386/sse-23.c: Ditto. + * lib/target-supports.exp: Add check_effective_target_raoint. + * gcc.target/i386/rao-helper.h: New test. + * gcc.target/i386/raoint-1.c: Ditto. + * gcc.target/i386/raoint-aadd-2.c: Ditto. + * gcc.target/i386/raoint-aand-2.c: Ditto. + * gcc.target/i386/raoint-aor-2.c: Ditto. + * gcc.target/i386/raoint-axor-2.c: Ditto. + * gcc.target/i386/x86gprintrin-1.c: Ditto. + * gcc.target/i386/x86gprintrin-2.c: Ditto. + * gcc.target/i386/x86gprintrin-3.c: Ditto. + * gcc.target/i386/x86gprintrin-4.c: Ditto. + * gcc.target/i386/x86gprintrin-5.c: Ditto. + +2022-11-07 Haochen Jiang <haochen.jiang@intel.com> + + * g++.target/i386/mv16.C: Add graniterapids. + * gcc.target/i386/funcspec-56.inc: Handle new march. + +2022-11-07 Haochen Jiang <haochen.jiang@intel.com> + Hongtao Liu <hongtao.liu@intel.com> + + * g++.dg/other/i386-2.C: Add -mprefetchi. + * g++.dg/other/i386-3.C: Ditto. + * gcc.target/i386/avx-1.c: Ditto. + * gcc.target/i386/funcspec-56.inc: Add new target attribute. + * gcc.target/i386/sse-13.c: Add -mprefetchi. + * gcc.target/i386/sse-23.c: Ditto. + * gcc.target/i386/x86gprintrin-1.c: Ditto. + * gcc.target/i386/x86gprintrin-2.c: Ditto. + * gcc.target/i386/x86gprintrin-3.c: Ditto. + * gcc.target/i386/x86gprintrin-4.c: Ditto. + * gcc.target/i386/x86gprintrin-5.c: Ditto. + * gcc.target/i386/prefetchi-1.c: New test. + * gcc.target/i386/prefetchi-2.c: Ditto. + * gcc.target/i386/prefetchi-3.c: Ditto. + * gcc.target/i386/prefetchi-4.c: Ditto. + 2022-11-06 Patrick Palka <ppalka@redhat.com> * g++.dg/special/initpri3.C: New test. diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C index b61aaf98cd0..010f6222151 100644 --- a/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C +++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-17.C @@ -18,3 +18,9 @@ // { dg-final { scan-assembler {_ZNK6l_var3MUlRT_IJXspT0_EEEE_clI1XJLi1ELi2ELi3EEEEDaS1_:} } } // { dg-final { scan-assembler {_ZNK6l_var4MUlR1YIJDpT_EEE_clIJ1US6_EEEDaS3_:} } } // { dg-final { scan-assembler {_ZZ2FnILi1EEvvENKUlT_E_clIiEEDaS0_:} } } + +// { dg-final { scan-assembler {_ZZ1fvENKUlT_E_clIcLc0EEEDaS_:} } } +// { dg-final { scan-assembler {_ZZ1fvENKUlT_E_clIiLi0EEEDaS_:} } } +// { dg-final { scan-assembler {_ZZZ1fvENKUlT_E_clIcLc0EEEDaS_ENKUlcS_E_clIcEEDacS_:} } } +// { dg-final { scan-assembler {_ZZZ1fvENKUlT_E_clIiLi0EEEDaS_ENKUliS_E_clIiEEDaiS_:} } } +// { dg-final { scan-assembler {_ZZ1fvENKUlP1UIT_Lj0EEPS_IiLj0EEE0_clIcEEDaS2_S4_:} } } diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C index dbeea407651..66cce9aa266 100644 --- a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C +++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18.C @@ -23,3 +23,9 @@ // https://github.com/llvm/llvm-project/issues/58631 // { dg-final { scan-assembler {_ZZ2FnILi1EEvvENKUlTyT_E_clIiEEDaS0_:} } } + +// { dg-final { scan-assembler {_ZZ1fvENKUlTyTnT_S_E_clIcLc0EEEDaS_:} } } +// { dg-final { scan-assembler {_ZZ1fvENKUlTyTnT_S_E_clIiLi0EEEDaS_:} } } +// { dg-final { scan-assembler {_ZZZ1fvENKUlTyTnT_S_E_clIcLc0EEEDaS_ENKUlTycS_E_clIcEEDacS_:} } } +// { dg-final { scan-assembler {_ZZZ1fvENKUlTyTnT_S_E_clIiLi0EEEDaS_ENKUlTyiS_E_clIiEEDaiS_:} } } +// { dg-final { scan-assembler {_ZZ1fvENKUlTyP1UIT_Lj0EEPS_IiLj0EEE_clIcEEDaS2_S4_:} } } diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C index 8bead7393c7..6489db9e442 100644 --- a/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C +++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1-18vs17.C @@ -14,3 +14,8 @@ // { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK10l_tpl_autoMUlT_T0_E_clIiiEEDaS_S0_'\) and '-fabi-version=18' \('_ZNK10l_tpl_autoMUlTyT_T0_E_clIiiEEDaS0_S1_'\) [^\n]*\n} } // { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK5l_tplMUlT_E_clIiEEDaS_'\) and '-fabi-version=18' \('_ZNK5l_tplMUlTyT_E_clIiEEDaS0_'\) [^\n]*\n} } // { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZNK6l_autoMUlT_E_clIiEEDaS_'\) and '-fabi-version=18' \('_ZNK6l_autoMUlT_E_clIiEEDaS0_'\) [^\n]*\n} } +// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZ1fvENKUlT_E_clIiLi0EEEDaS_'\) and '-fabi-version=18' \('_ZZ1fvENKUlTyTnT_S_E_clIiLi0EEEDaS_'\) [^\n]*\n} } +// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZZ1fvENKUlT_E_clIiLi0EEEDaS_ENKUliS_E_clIiEEDaiS_'\) and '-fabi-version=18' \('_ZZZ1fvENKUlTyTnT_S_E_clIiLi0EEEDaS_ENKUlTyiS_E_clIiEEDaiS_'\) [^\n]*\n} } +// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZ1fvENKUlT_E_clIcLc0EEEDaS_'\) and '-fabi-version=18' \('_ZZ1fvENKUlTyTnT_S_E_clIcLc0EEEDaS_'\) [^\n]*\n} } +// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZZ1fvENKUlT_E_clIcLc0EEEDaS_ENKUlcS_E_clIcEEDacS_'\) and '-fabi-version=18' \('_ZZZ1fvENKUlTyTnT_S_E_clIcLc0EEEDaS_ENKUlTycS_E_clIcEEDacS_'\) [^\n]*\n} } +// { dg-regexp {[^\n]*lambda-tpl1.h:[:0-9]* warning: the mangled name [^\n]* \('_ZZ1fvENKUlP1UIT_Lj0EEPS_IiLj0EEE0_clIcEEDaS2_S4_'\) and '-fabi-version=18' \('_ZZ1fvENKUlTyP1UIT_Lj0EEPS_IiLj0EEE_clIcEEDaS2_S4_'\) [^\n]*\n} } diff --git a/gcc/testsuite/g++.dg/abi/lambda-tpl1.h b/gcc/testsuite/g++.dg/abi/lambda-tpl1.h index 5d6fe5e1d0a..376c3f6a2f4 100644 --- a/gcc/testsuite/g++.dg/abi/lambda-tpl1.h +++ b/gcc/testsuite/g++.dg/abi/lambda-tpl1.h @@ -56,4 +56,15 @@ void f () l_var4 (y); Fn<1> (); + + auto l1 = []<typename T, T v = T(0)> (T a) { + auto l2 = []<typename U> (T a, U b) {}; + + l2 (a, v); + }; + auto l3 = []<typename T>(U<T, 0> *, U<int, 0> *) {}; + + l1 (1); + l1 ('1'); + l3 ((U<char, 0> *)nullptr, nullptr); } diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C index 75e89c8ff0c..33de973a1fa 100644 --- a/gcc/testsuite/g++.dg/cpp0x/defaulted3.C +++ b/gcc/testsuite/g++.dg/cpp0x/defaulted3.C @@ -4,7 +4,7 @@ template<class T> struct A { template<class U> - bool operator==(const A<U>&) = delete; // { dg-message "declared" } + bool operator==(const A<U>&) const = delete; // { dg-message "declared" } operator bool () { return true; } }; diff --git a/gcc/testsuite/g++.dg/cpp2a/bit-cast7.C b/gcc/testsuite/g++.dg/cpp2a/bit-cast7.C index 4a3c6820070..6927db3c961 100644 --- a/gcc/testsuite/g++.dg/cpp2a/bit-cast7.C +++ b/gcc/testsuite/g++.dg/cpp2a/bit-cast7.C @@ -16,7 +16,7 @@ struct J struct K { long int a, b : 11, c; - constexpr bool operator == (const K &x) + constexpr bool operator == (const K &x) const { return a == x.a && b == x.b && c == x.c; } @@ -29,7 +29,7 @@ struct L struct M { long long int a, b : 11, c; - constexpr bool operator == (const M &x) + constexpr bool operator == (const M &x) const { return a == x.a && b == x.b && c == x.c; } diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C new file mode 100644 index 00000000000..dc509563140 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-eq15.C @@ -0,0 +1,208 @@ +// P2468R2 - The Equality Operator You Are Looking For +// { dg-do compile { target c++20 } } + +struct A { + bool operator== (const A &) { return true; } + bool operator!= (const A &) { return false; } +}; +bool a = A{} != A{}; + +template <typename T> +struct B { + bool operator== (const T &) const; + bool operator!= (const T &) const; +}; +struct B1 : B<B1> { }; +bool b1 = B1{} == B1{}; +bool b2 = B1{} != B1{}; + +template <bool> +struct C { + using C1 = C<true>; + using C2 = C<false>; + C () = default; + C (const C2 &); + bool operator== (C1) const; + bool operator!= (C1) const; +}; +using C3 = C<false>; +bool c = C3{} == C3{}; + +struct D { + D (); + D (int *); + bool operator== (const D &) const; // { dg-message "candidate: 'bool D::operator==\\\(const D&\\\) const' \\\(reversed\\\)" } + operator int * () const; +}; +bool d = nullptr != D{}; // { dg-error "ambiguous overload for 'operator!=' in 'nullptr != D\\\(\\\)' \\\(operand types are 'std::nullptr_t' and 'D'\\\)" } + // { dg-message "candidate: 'operator!=\\\(int\\\*, int\\\*\\\)' \\\(built-in\\\)" "" { target *-*-* } .-1 } + +using ubool = unsigned char; + +struct E { + operator bool () const; +}; +unsigned char operator== (E, E);// { dg-message "candidate: 'unsigned char operator==\\\(E, E\\\)'" } + // { dg-message "no known conversion for argument 1 from 'int' to 'E'" "" { target *-*-* } .-1 } +unsigned char e = E{} != E{}; // { dg-error "return type of 'unsigned char operator==\\\(E, E\\\)' is not 'bool'" } + // { dg-message "used as rewritten candidate for comparison of 'E' and 'E'" "" { target *-*-* } .-1 } + +// F-H are the testcase from [over.match.oper] +struct F {}; +template <typename T> +bool operator== (F, T); // { dg-message "candidate: 'template<class T> bool operator==\\\(F, T\\\)'" } + // { dg-message "template argument deduction/substitution failed:" "" { target *-*-* } .-1 } +bool f1 = 0 == F (); // OK, calls reversed == +template <typename T> +bool operator!= (F, T); +bool f2 = 0 == F (); // { dg-error "no match for 'operator==' in '0 == F\\\(\\\)' \\\(operand types are 'int' and 'F'\\\)" } + // { dg-message "cannot convert '0' \\\(type 'int'\\\) to type 'F'" "" { target *-*-* } .-1 } + +struct G { + bool operator== (const G &); +}; +struct G1 : G { + G1 (); + G1 (G); + bool operator!= (const G &); +}; +bool g1 = G () == G1 (); // OK, != prevents rewrite +bool g2 = G1 () == G (); // { dg-error "ambiguous, even though the second is reversed" } + +struct H {}; +template <typename T> +bool operator== (H, T); +inline namespace H1 { + template <typename T> + bool operator!= (H, T); +} +// [over.match.oper] currently says that this is OK because the inline +// namespace isn't searched, but that seems wrong to me, so I'm going to go +// ahead and search it for now. Remove the "0 &&" in add_candidates to +// change this to the currently specified behavior. +// { dg-error "no match" "" { target *-*-* } .+1 } +bool h = 0 == H (); // OK, calls reversed == + +template <class T> +struct I { + int operator== (const double &) const; + friend inline int operator== (const double &, const T &) { return 1; } +}; +struct I1 : I<I1> { }; +bool i = I1{} == 0.; // { dg-error "return type of 'int operator==\\\(const double&, const I1&\\\)' is not 'bool'" } + // { dg-message "used as rewritten candidate for comparison of 'I1' and 'double'" "" { target *-*-* } .-1 } + +struct J { + bool operator== (const J &) const; + bool operator!= (const J &) const; +}; +struct J1 : J { + J1 (const J &); + bool operator== (const J1 &x) const { + return static_cast<const J &> (*this) == x; // { dg-error "ambiguous overload for 'operator==' in '\\\*\\\(const J\\\*\\\)\\\(\\\(const J1\\\*\\\)this\\\) == x' \\\(operand types are 'const J' and 'const J1'\\\)" } + } +}; + +struct K { + bool operator== (const K &); +}; +bool k = K{} == K{}; // { dg-error "ambiguous, even though the second is reversed" } + +struct L { + bool operator== (const L &) const; +}; +bool l = L{} == L{}; + +struct M { + bool operator== (M); +}; +bool m = M () == M (); + +struct N { + virtual bool operator== (const N &) const; +}; +struct N1 : N { + bool operator== (const N &) const override; +}; +bool n = N1 () == N1 (); // { dg-error "ambiguous, even though the second is reversed" } + +struct O { + virtual signed char operator== (const O &) const; + signed char operator!= (const O &x) const { return !operator== (x); } +}; +struct O1 : O { + signed char operator== (const O &) const override; +}; +bool o = O1 () != O1 (); + +template <class T> +bool +foo (T x, T y) +requires requires { x == y; } +{ + return x == y; +} +bool b3 = foo (B1 (), B1 ()); + +struct P {}; +template <typename T, class U = int> +bool operator== (P, T); +template <class T> +bool operator!= (P, T); +bool p = 0 == P (); + +struct Q {}; +template <typename T> +bool operator== (Q, T); +template <typename U> +bool operator!= (Q, U); +bool q = 0 == Q (); // { dg-error "" } + +struct R { + template <typename T> + bool operator== (const T &); +}; +bool r = R () == R (); // { dg-error "ambiguous, even though the second is reversed" } + +struct S { + template <typename T> + bool operator== (const T &) const; + bool operator!= (const S &); +}; +bool s = S () == S (); + +struct T {}; +template <class U = int> +bool operator== (T, int); +bool operator!= (T, int); +bool t = 0 == T (); + +struct U {}; +bool operator== (U, int); +bool u1 = 0 == U (); +namespace U1 { bool operator!= (U, int); } +bool u2 = 0 == U (); +using U1::operator!=; +bool u3 = 0 == U (); // { dg-error "" } + +struct V {}; +template <typename T> +bool operator== (V, T); +bool v1 = 0 == V (); +namespace V1 { template <typename T> bool operator!= (V, T); } +bool v2 = 0 == V (); +using V1::operator!=; +bool v3 = 0 == V (); // { dg-error "" } + +template <int N> +struct W { +bool operator== (int) requires (N == 1); +bool operator!= (int) requires (N == 2); +}; +int w = 0 == W<1> (); + +struct X { + bool operator== (X const &); + static bool operator!= (X const &, X const &); // { dg-error "'static bool X::operator!=\\\(const X&, const X&\\\)' must be either a non-static member function or a non-member function" } +}; +bool x = X () == X (); // { dg-error "ambiguous, even though the second is reversed" } diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite1.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite1.C index c4030cd2f4d..ebe81e4b5e9 100644 --- a/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite1.C +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite1.C @@ -11,5 +11,5 @@ int main() { A<int> a1; A<void> a2; - return a1 == a2; + return a1 == a2; // { dg-error "ambiguous, even though the second is reversed" } } diff --git a/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite5.C b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite5.C index d0424377e8e..460f6332938 100644 --- a/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite5.C +++ b/gcc/testsuite/g++.dg/cpp2a/spaceship-rewrite5.C @@ -12,4 +12,4 @@ struct A { A<const int> a; A<int> b; -auto c = (a == b); +auto c = (a == b); // { dg-error "ambiguous, even though the second is reversed" "" { target c++20 } } diff --git a/gcc/testsuite/g++.old-deja/g++.jason/byval2.C b/gcc/testsuite/g++.old-deja/g++.jason/byval2.C index 40bf2a36528..0575109ed1a 100644 --- a/gcc/testsuite/g++.old-deja/g++.jason/byval2.C +++ b/gcc/testsuite/g++.old-deja/g++.jason/byval2.C @@ -18,6 +18,6 @@ inline char operator == (const Char a, const char b) { return 0; } char mystrcmp(Char s[31], Char t[31]) { - for (; *s == *t; ++s, ++t) if (*s == '\0') return 0; + for (; *s == *t; ++s, ++t) if (*s == '\0') return 0; // { dg-error "reversed" "" { target c++20 } } return char(*s - *t); } diff --git a/gcc/testsuite/g++.old-deja/g++.other/overload13.C b/gcc/testsuite/g++.old-deja/g++.other/overload13.C index 54ab404af11..f59bd4a49c3 100644 --- a/gcc/testsuite/g++.old-deja/g++.other/overload13.C +++ b/gcc/testsuite/g++.old-deja/g++.other/overload13.C @@ -2,7 +2,7 @@ // Origin: Nathan Sidwell <nathan@codesourcery.com> struct A { - bool operator== (A const &); + bool operator== (A const &) const; operator bool () const; operator int * () const; }; diff --git a/gcc/testsuite/g++.target/i386/pr102566-7.C b/gcc/testsuite/g++.target/i386/pr102566-7.C new file mode 100644 index 00000000000..ce90214f33d --- /dev/null +++ b/gcc/testsuite/g++.target/i386/pr102566-7.C @@ -0,0 +1,22 @@ +/* { dg-do compile { target c++11 } } */ +/* { dg-options "-O2" } */ + +#include <atomic> + +template<uint32_t b> +void lock_bts(std::atomic<uint32_t> &a) { while (!(a.fetch_or(b) & b)); } +template<uint32_t b> +void lock_btr(std::atomic<uint32_t> &a) { while (a.fetch_and(~b) & b); } +template<uint32_t b> +void lock_btc(std::atomic<uint32_t> &a) { while (a.fetch_xor(b) & b); } +template void lock_bts<1U<<30>(std::atomic<uint32_t> &a); +template void lock_btr<1U<<30>(std::atomic<uint32_t> &a); +template void lock_btc<1U<<30>(std::atomic<uint32_t> &a); +template void lock_bts<1U<<31>(std::atomic<uint32_t> &a); +template void lock_btr<1U<<31>(std::atomic<uint32_t> &a); +template void lock_btc<1U<<31>(std::atomic<uint32_t> &a); + +/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btsl" 2 } } */ +/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 2 } } */ +/* { dg-final { scan-assembler-times "lock;?\[ \t\]*btcl" 2 } } */ +/* { dg-final { scan-assembler-not "cmpxchg" } } */ diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-1.c b/gcc/testsuite/gcc.dg/analyzer/errno-1.c new file mode 100644 index 00000000000..6b9d28c1079 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/errno-1.c @@ -0,0 +1,23 @@ +#include <errno.h> +#include "analyzer-decls.h" + +extern void external_fn (void); + +int test_reading_errno (void) +{ + return errno; +} + +void test_setting_errno (int val) +{ + errno = val; +} + +void test_storing_to_errno (int val) +{ + __analyzer_eval (errno == val); /* { dg-warning "UNKNOWN" } */ + errno = val; + __analyzer_eval (errno == val); /* { dg-warning "TRUE" } */ + external_fn (); + __analyzer_eval (errno == val); /* { dg-warning "UNKNOWN" } */ +} diff --git a/gcc/testsuite/gcc.dg/analyzer/strchr-1.c b/gcc/testsuite/gcc.dg/analyzer/strchr-1.c index dfe1bc9ea1a..bfa48916ca2 100644 --- a/gcc/testsuite/gcc.dg/analyzer/strchr-1.c +++ b/gcc/testsuite/gcc.dg/analyzer/strchr-1.c @@ -3,12 +3,13 @@ const char* test_literal (int x) { - char *p = __builtin_strchr ("123", x); + char *p = __builtin_strchr ("123", x); /* { dg-message "when '__builtin_strchr' returns non-NULL" } */ if (p) { __analyzer_eval (*p == x); /* { dg-message "UNKNOWN" } */ /* TODO: this ought to be TRUE, but it's unclear that it's worth stashing this constraint. */ + *p = 'A'; /* { dg-warning "write to string literal" } */ } return p; } diff --git a/gcc/testsuite/gcc.dg/pr104530.c b/gcc/testsuite/gcc.dg/pr104530.c new file mode 100644 index 00000000000..1ec10154e1b --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr104530.c @@ -0,0 +1,19 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +void foo(void); + +static int a, *b = &a, c, d = 1; + +int main() { + c = 0 == b; + a = *b; + if (c % d) + for (; d; --d) + foo(); + b = 0; +} + + +/* { dg-final { scan-tree-dump-not "foo" "evrp" } } */ + diff --git a/gcc/testsuite/gcc.dg/pr107505.c b/gcc/testsuite/gcc.dg/pr107505.c new file mode 100644 index 00000000000..01270eac91c --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr107505.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-guess-branch-probability" } */ + +int n; + +void +bar (void); + +__attribute__ ((noinline, returns_twice)) int +zero (void) +{ + return 0; +} + +void +foo (void) +{ + int a = zero (); + + for (n = 0; n < 2; ++n) + { + } + + if (a) + bar (); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c b/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c new file mode 100644 index 00000000000..475142186b5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr107541.c @@ -0,0 +1,16 @@ +// { dg-do run } +// { dg-options "-O1" } + +unsigned char a = 1; +char b, e; +long c; +short d; +int main() { + a = ~(1 && a); + c = ~((~a / 8 | -2) & 11007578330939886389LLU); + e = -c; + d = ~c / e; + if (d < 2000) + __builtin_abort(); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c new file mode 100644 index 00000000000..bbdda45bd64 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55157.c @@ -0,0 +1,19 @@ +// { dg-do compile } +// { dg-options "-O2 -fdump-tree-evrp" } + +void gg(void); +int f(unsigned t) +{ + unsigned g = t*16; + if (g==0) return 1; + gg(); + gg(); + gg(); + gg(); + gg(); + gg(); + if (g<=4) return 1; + return 0; +} + +// { dg-final { scan-tree-dump-times " if " 1 "evrp" } } diff --git a/gcc/testsuite/gcc.target/i386/pr107546.c b/gcc/testsuite/gcc.target/i386/pr107546.c new file mode 100644 index 00000000000..e5cf56d7620 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr107546.c @@ -0,0 +1,19 @@ +/* PR target/107546 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -mno-xop -mno-avx512f" } */ +/* { dg-final { scan-assembler-not "pcmpeqb\t" } } */ +/* { dg-final { scan-assembler-times "pcmpgtb\t" 2 } } */ + +typedef signed char V __attribute__((vector_size(16))); + +V +foo (V x) +{ + return x < 48; +} + +V +bar (V x) +{ + return x >= (V) { 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 }; +} diff --git a/gcc/testsuite/gcc.target/i386/raoint-atomic-fetch.c b/gcc/testsuite/gcc.target/i386/raoint-atomic-fetch.c deleted file mode 100644 index ac4099d888e..00000000000 --- a/gcc/testsuite/gcc.target/i386/raoint-atomic-fetch.c +++ /dev/null @@ -1,29 +0,0 @@ -/* { dg-do compile } */ -/* { dg-options "-mraoint -O2 -mprefer-remote-atomic" } */ -/* { dg-final { scan-assembler-times "aadd" 2 { target {! ia32 } } } } */ -/* { dg-final { scan-assembler-times "aand" 2 { target {! ia32 } } } } */ -/* { dg-final { scan-assembler-times "aor" 2 { target {! ia32 } } } } */ -/* { dg-final { scan-assembler-times "axor" 2 { target {! ia32 } } } } */ -/* { dg-final { scan-assembler-times "aadd" 1 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "aand" 1 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "aor" 1 { target ia32 } } } */ -/* { dg-final { scan-assembler-times "axor" 1 { target ia32 } } } */ -volatile int x; -volatile long long y; -int *a; -long long *b; - -void extern -rao_int_test (void) -{ - __atomic_add_fetch (a, x, __ATOMIC_RELAXED); - __atomic_and_fetch (a, x, __ATOMIC_RELAXED); - __atomic_or_fetch (a, x, __ATOMIC_RELAXED); - __atomic_xor_fetch (a, x, __ATOMIC_RELAXED); -#ifdef __x86_64__ - __atomic_add_fetch (b, y, __ATOMIC_RELAXED); - __atomic_and_fetch (b, y, __ATOMIC_RELAXED); - __atomic_or_fetch (b, y, __ATOMIC_RELAXED); - __atomic_xor_fetch (b, y, __ATOMIC_RELAXED); -#endif -} diff --git a/gcc/testsuite/gcc.target/i386/sse-22.c b/gcc/testsuite/gcc.target/i386/sse-22.c index f5808e4513b..f600bb544b2 100644 --- a/gcc/testsuite/gcc.target/i386/sse-22.c +++ b/gcc/testsuite/gcc.target/i386/sse-22.c @@ -103,7 +103,7 @@ #ifndef DIFFERENT_PRAGMAS -#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni,avx512fp16,avxifma,avxvnniint8,avxneconvert,amx-fp16.raoint") +#pragma GCC target ("sse4a,3dnow,avx,avx2,fma4,xop,aes,pclmul,popcnt,abm,lzcnt,bmi,bmi2,tbm,lwp,fsgsbase,rdrnd,f16c,rtm,rdseed,prfchw,adx,fxsr,xsaveopt,avx512f,avx512er,avx512cd,avx512pf,sha,prefetchwt1,avx512vl,avx512bw,avx512dq,avx512vbmi,avx512vbmi2,avx512ifma,avx5124fmaps,avx5124vnniw,avx512vpopcntdq,gfni,avx512bitalg,avx512bf16,avx512vp2intersect,serialize,tsxldtrk,amx-tile,amx-int8,amx-bf16,kl,widekl,avxvnni,avx512fp16,avxifma,avxvnniint8,avxneconvert,amx-fp16,raoint") #endif /* Following intrinsics require immediate arguments. They diff --git a/gcc/testsuite/gfortran.dg/widechar_11.f90 b/gcc/testsuite/gfortran.dg/widechar_11.f90 new file mode 100644 index 00000000000..02530fb1730 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/widechar_11.f90 @@ -0,0 +1,51 @@ +! { dg-do run } +! { dg-additional-options "-fdump-tree-original" } +! +! PR fortran/107508 +! +use iso_c_binding +implicit none +character(len=:,kind=4), allocatable, target :: a4str(:), a4str2 +type(c_ptr) :: cptr, cptr2 + +allocate(character(len=7,kind=4) :: a4str(-2:3)) +allocate(character(len=9,kind=4) :: a4str2) + +cptr = c_loc(a4str) +cptr2 = c_loc(a4str2) + +if (len(a4str) /= 7) error stop +if (lbound(a4str,1) /= -2) error stop +if (ubound(a4str,1) /= 3) error stop +if (len(a4str2) /= 9) error stop + +a4str = [4_"sf456aq", 4_"3dtzu24", 4_"_4fh7sm", 4_"=ff85s7", 4_"j=8af4d", 4_".,A%Fsz"] +a4str2 = 4_"4f5g5f8a9" + +!print *, lbound(a4str), ubound(a4str) ! expected (-2:3) - actually: (1:6) + +if (len(a4str) /= 7) error stop +if (lbound(a4str,1) /= -2) error stop +if (ubound(a4str,1) /= 3) error stop +if (len(a4str2) /= 9) error stop +if (.not. c_associated (cptr, c_loc(a4str))) error stop +if (.not. c_associated (cptr2, c_loc(a4str2))) error stop +end + +! { dg-final { scan-tree-dump-times "__builtin_malloc" 4 "original" } } +! { dg-final { scan-tree-dump-times "__builtin_realloc" 2 "original" } } + +! { dg-final { scan-tree-dump-times "a4str.data = __builtin_malloc \\(168\\);" 2 "original" } } +! { dg-final { scan-tree-dump-times "a4str.data = __builtin_realloc \\(a4str.data, 168\\);" 1 "original" } } +! { dg-final { scan-tree-dump-times "a4str2 = \\(character\\(kind=4\\)\\\[1:.a4str2\\\] \\*\\) __builtin_malloc \\(36\\);" 2 "original" } } +! { dg-final { scan-tree-dump-times "a4str2 = \\(character\\(kind=4\\)\\\[1:.a4str2\\\] \\*\\) __builtin_realloc \\(\\(void \\*\\) a4str2, 36\\);" 1 "original" } } + +! Array: Assert, realloc-check assign string length (alloc + (realloc'ed) assignment): +! { dg-final { scan-tree-dump-times "if \\(\[^\\n\\r\]*\\.a4str != 7\\)" 2 "original" } } +! { dg-final { scan-tree-dump-times "if \\(D\\.\[0-9\]+ != 28\\) goto L\\." 1 "original" } } +! { dg-final { scan-tree-dump-times "\\.a4str = 7;" 2 "original" } } + +! Scalar: Assert, realloc-check assign string length (alloc + (realloc'ed) assignment): +! { dg-final { scan-tree-dump-times "if \\(\[^\\n\\r\]*\\.a4str2 != 9\\)" 2 "original" } } +! { dg-final { scan-tree-dump-times "if \\(\\.a4str2 == 9\\) goto L\\." 1 "original" } } +! { dg-final { scan-tree-dump-times "\\.a4str2 = 9;" 2 "original" } } |