From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../tr1/8_c_compatibility/complex/50880.cc | 51 +++++++++++ .../tr1/8_c_compatibility/complex/51083.cc | 54 +++++++++++ .../tr1/8_c_compatibility/complex/functions.cc | 48 ++++++++++ .../8_c_compatibility/complex/overloads_float.cc | 102 +++++++++++++++++++++ .../tr1/8_c_compatibility/complex/overloads_int.cc | 98 ++++++++++++++++++++ 5 files changed, 353 insertions(+) create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc create mode 100644 libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc (limited to 'libstdc++-v3/testsuite/tr1/8_c_compatibility/complex') diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc new file mode 100644 index 000000000..eaa2f3d81 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/50880.cc @@ -0,0 +1,51 @@ +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include +#include + +template + void test01_do() + { + bool test __attribute__((unused)) = true; + + const std::complex ca(T(-2), T(2)); + const std::complex cb(T(-2), T(0)); + const std::complex cc(T(-2), T(-2)); + + std::complex cra = std::tr1::acosh(ca); + std::complex crb = std::tr1::acosh(cb); + std::complex crc = std::tr1::acosh(cc); + + VERIFY( cra.real() > T(0) ); + VERIFY( crb.real() > T(0) ); + VERIFY( crc.real() > T(0) ); + } + +// libstdc++/50880 +void test01() +{ + test01_do(); + test01_do(); + test01_do(); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc new file mode 100644 index 000000000..f41914ee9 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/51083.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } +// +// Copyright (C) 2011 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +namespace a +{ + template class Mat { }; + + template struct Mat2 : Mat { }; + + template int arg(Mat) { return 1; } + template int conj(Mat) { return 1; } + template int imag(Mat) { return 1; } + template int norm(Mat) { return 1; } + template int proj(Mat) { return 1; } + template int real(Mat) { return 1; } + + template int pow(Mat, U) { return 1; } + template int pow(T, Mat) { return 1; } +} + +int main() +{ + int __attribute__((unused)) i; + + using namespace std::tr1; + + a::Mat2< std::complex > c; + i = arg(c); + i = conj(c); + i = imag(c); + i = norm(c); + i = proj(c); + i = real(c); + i = pow(std::complex(), c); + i = pow(c, std::complex()); +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc new file mode 100644 index 000000000..3560d4fd4 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/functions.cc @@ -0,0 +1,48 @@ +// { dg-do compile } + +// 2006-01-10 Paolo Carlini +// +// Copyright (C) 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.1 Additions to header + +#include + +template + void test01_do() + { + typedef std::complex cmplx_type; + + cmplx_type ans; + + ans = std::tr1::acos(cmplx_type(1.0, 1.0)); + ans = std::tr1::asin(cmplx_type(1.0, 1.0)); + ans = std::tr1::atan(cmplx_type(1.0, 1.0)); + + ans = std::tr1::acosh(cmplx_type(1.0, 1.0)); + ans = std::tr1::asinh(cmplx_type(1.0, 1.0)); + ans = std::tr1::atanh(cmplx_type(1.0, 1.0)); + ans = std::tr1::fabs(cmplx_type(1.0, 1.0)); + } + +void test01() +{ + test01_do(); + test01_do(); + test01_do(); +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc new file mode 100644 index 000000000..1e12cdba2 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_float.cc @@ -0,0 +1,102 @@ +// { dg-do compile } + +// 2006-01-12 Paolo Carlini +// +// Copyright (C) 2006, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.1 Additions to header + +#include +#include + +void test01() +{ + using __gnu_test::check_ret_type; + + typedef std::complex cmplx_f_type; + typedef std::complex cmplx_d_type; + typedef std::complex cmplx_ld_type; + + const float f1 = 1.0f; + const double d1 = 1.0; + const long double ld1 = 1.0l; + + const cmplx_f_type c_f1(f1, f1); + const cmplx_d_type c_d1(d1, d1); + const cmplx_ld_type c_ld1(ld1, ld1); + + check_ret_type(std::tr1::arg(f1)); + check_ret_type(std::tr1::arg(d1)); + check_ret_type(std::tr1::arg(ld1)); + + check_ret_type(std::tr1::conj(f1)); + check_ret_type(std::tr1::conj(d1)); + check_ret_type(std::tr1::conj(ld1)); + + check_ret_type(std::tr1::imag(f1)); + check_ret_type(std::tr1::imag(d1)); + check_ret_type(std::tr1::imag(ld1)); + + check_ret_type(std::tr1::norm(f1)); + check_ret_type(std::tr1::norm(d1)); + check_ret_type(std::tr1::norm(ld1)); + + check_ret_type(std::tr1::polar(f1, f1)); + check_ret_type(std::tr1::polar(d1, f1)); + check_ret_type(std::tr1::polar(f1, d1)); + check_ret_type(std::tr1::polar(d1, d1)); + check_ret_type(std::tr1::polar(ld1, d1)); + check_ret_type(std::tr1::polar(d1, ld1)); + check_ret_type(std::tr1::polar(ld1, f1)); + check_ret_type(std::tr1::polar(f1, ld1)); + check_ret_type(std::tr1::polar(ld1, ld1)); + + check_ret_type(std::tr1::pow(c_f1, f1)); + check_ret_type(std::tr1::pow(c_d1, f1)); + check_ret_type(std::tr1::pow(c_f1, d1)); + check_ret_type(std::tr1::pow(c_d1, d1)); + check_ret_type(std::tr1::pow(c_ld1, d1)); + check_ret_type(std::tr1::pow(c_d1, ld1)); + check_ret_type(std::tr1::pow(c_ld1, f1)); + check_ret_type(std::tr1::pow(c_f1, ld1)); + check_ret_type(std::tr1::pow(c_ld1, ld1)); + + check_ret_type(std::tr1::pow(f1, c_f1)); + check_ret_type(std::tr1::pow(d1, c_f1)); + check_ret_type(std::tr1::pow(f1, c_d1)); + check_ret_type(std::tr1::pow(d1, c_d1)); + check_ret_type(std::tr1::pow(ld1, c_d1)); + check_ret_type(std::tr1::pow(d1, c_ld1)); + check_ret_type(std::tr1::pow(ld1, c_f1)); + check_ret_type(std::tr1::pow(f1, c_ld1)); + check_ret_type(std::tr1::pow(ld1, c_ld1)); + + check_ret_type(std::tr1::pow(c_f1, c_f1)); + check_ret_type(std::tr1::pow(c_d1, c_f1)); + check_ret_type(std::tr1::pow(c_f1, c_d1)); + check_ret_type(std::tr1::pow(c_d1, c_d1)); + check_ret_type(std::tr1::pow(c_ld1, c_d1)); + check_ret_type(std::tr1::pow(c_d1, c_ld1)); + check_ret_type(std::tr1::pow(c_ld1, c_f1)); + check_ret_type(std::tr1::pow(c_f1, c_ld1)); + check_ret_type(std::tr1::pow(c_ld1, c_ld1)); + + check_ret_type(std::tr1::real(f1)); + check_ret_type(std::tr1::real(d1)); + check_ret_type(std::tr1::real(ld1)); +} diff --git a/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc new file mode 100644 index 000000000..a8a9bfba3 --- /dev/null +++ b/libstdc++-v3/testsuite/tr1/8_c_compatibility/complex/overloads_int.cc @@ -0,0 +1,98 @@ +// 2006-01-12 Paolo Carlini +// +// Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +// 8.1 Additions to header + +#include +#include +#include + +void test01() +{ + bool test __attribute__((unused)) = true; + using __gnu_test::check_ret_type; + + typedef std::complex cmplx_f_type; + typedef std::complex cmplx_d_type; + + const int i1 = 1; + const unsigned u1 = 1; + const long l1 = 1; + const double f1 = 1.0f; + const double d1 = 1.0; + + check_ret_type(std::tr1::arg(i1)); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(double(i1)) ); + VERIFY( std::tr1::arg(i1) == std::tr1::arg(cmplx_d_type(double(i1))) ); + + check_ret_type(std::tr1::conj(i1)); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(double(i1)) ); + VERIFY( std::tr1::conj(i1) == std::tr1::conj(cmplx_d_type(double(i1))) ); + + check_ret_type(std::tr1::imag(i1)); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(double(i1)) ); + VERIFY( std::tr1::imag(i1) == std::tr1::imag(cmplx_d_type(double(i1))) ); + + check_ret_type(std::tr1::norm(i1)); + VERIFY( std::tr1::norm(i1) == std::tr1::norm(double(i1)) ); + // std::norm&) is mathematically equivalent to just + // this for a real, but the general algorithm goes through std::abs + // and a multiplication. + VERIFY( std::tr1::norm(i1) == double(i1) * double(i1) ); + + // NB: The existing std::polar wins and a cmplx_i_type is returned. + // check_ret_type(std::tr1::polar(i1, i1)); + // VERIFY( std::tr1::polar(i1, i1) + // == std::tr1::polar(double(i1), double(i1)) ); + typedef std::complex cmplx_i_type; + check_ret_type(std::tr1::polar(i1, i1)); + + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), i1)); + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), u1)); + check_ret_type(std::tr1::pow(cmplx_f_type(f1, f1), l1)); + check_ret_type(std::tr1::pow(cmplx_d_type(d1, d1), i1)); + + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), i1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(i1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), u1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(u1)) ); + VERIFY( std::tr1::pow(cmplx_d_type(d1, d1), l1) + == std::tr1::pow(cmplx_d_type(d1, d1), double(l1)) ); + + check_ret_type(std::tr1::pow(i1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(u1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(l1, cmplx_f_type(f1, f1))); + check_ret_type(std::tr1::pow(i1, cmplx_d_type(d1, d1))); + VERIFY( std::tr1::pow(i1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(i1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(u1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(u1), cmplx_d_type(d1, d1)) ); + VERIFY( std::tr1::pow(l1, cmplx_d_type(d1, d1)) + == std::tr1::pow(double(l1), cmplx_d_type(d1, d1)) ); + + check_ret_type(std::tr1::real(i1)); + VERIFY( std::tr1::real(i1) == std::tr1::real(double(i1)) ); + VERIFY( std::tr1::real(i1) == std::tr1::real(cmplx_d_type(double(i1))) ); +} + +int main() +{ + test01(); + return 0; +} -- cgit v1.2.3