On 01/04/17 17:48 +0100, Andrew Jenner wrote:
Index: libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc
===================================================================
--- libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc   (revision 
475331)
+++ libstdc++-v3/testsuite/25_algorithms/nth_element/58800.cc   (revision 
475455)
@@ -18,20 +18,22 @@
// 25.3.2 [lib.alg.nth.element]

// { dg-options "-std=gnu++11" }
+// { dg-require-effective-target stdint_types }

#include <algorithm>
#include <vector>
#include <testsuite_hooks.h>
#include <testsuite_iterators.h>
+#include <stdint.h>

using __gnu_test::test_container;
using __gnu_test::random_access_iterator_wrapper;

-typedef test_container<int, random_access_iterator_wrapper> Container;
+typedef test_container<int_least32_t, random_access_iterator_wrapper> 
Container;

void test01()
{
-  std::vector<int> v = {
+  std::vector<int_least32_t> v = {

We could just use long here, but this is OK too.

    207089,
    202585,
    180067,


Index: libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc  
(revision 475331)
+++ libstdc++-v3/testsuite/27_io/ios_base/types/fmtflags/case_label.cc  
(revision 475455)
@@ -75,6 +75,6 @@ case_labels(bitmask_type b)
    case ~__INT_MAX__:
      break;
    }
-  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) >= sizeof(int),
      "underlying type has same range of values as int");
}

We need to be careful here.

This check is ensuring there is no undefined behaviour in
<bits/ios_base.h>.

Same for ...

Index: libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc  
(revision 475331)
+++ libstdc++-v3/testsuite/27_io/ios_base/types/openmode/case_label.cc  
(revision 475455)
@@ -51,6 +51,6 @@ case_labels(bitmask_type b)
    case ~__INT_MAX__:
      break;
    }
-  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) >= sizeof(int),
      "underlying type has same range of values as int");
}
Index: libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc   
(revision 475331)
+++ libstdc++-v3/testsuite/27_io/ios_base/types/iostate/case_label.cc   
(revision 475455)
@@ -47,6 +47,6 @@ case_labels(bitmask_type b)
    case ~__INT_MAX__:
      break;
    }
-  static_assert( sizeof(std::underlying_type_t<bitmask_type>) == sizeof(int),
+  static_assert( sizeof(std::underlying_type_t<bitmask_type>) >= sizeof(int),
      "underlying type has same range of values as int");
}

If the target uses a larger size for these enumerations then we need
to be sure the code is still correct, not just adjust the tests.

enum _Ios_Fmtflags { ...
     _S_ios_fmtflags_end = 1L << 16,
     _S_ios_fmtflags_max = __INT_MAX__,
     _S_ios_fmtflags_min = ~__INT_MAX__
   };

 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
 { return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }

...

 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
 operator~(_Ios_Fmtflags __a)
 { return _Ios_Fmtflags(~static_cast<int>(__a)); }

I think the operations and casts are still valid if the type is larger
than int. If not, we could replace __INT_MAX__ with __LONG_MAX__ when
defined(__ia16__) and then use long for the static_cast conversions.



Index: libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc    
(revision 475331)
+++ libstdc++-v3/testsuite/27_io/basic_stringbuf/setbuf/wchar_t/4.cc    
(revision 475455)
@@ -19,7 +19,7 @@

// 27.8.1.4 Overridden virtual functions

-// { dg-options "-DMAX_SIZE=4096" { target simulator } }
+// { dg-options "-DMAX_SIZE=4096" { target { simulator || ia16-*-* } } }

#ifndef MAX_SIZE
#define MAX_SIZE (1 << 18)
Index: libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc
===================================================================
--- libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc     
(revision 475331)
+++ libstdc++-v3/testsuite/27_io/basic_istream/getline/wchar_t/5.cc     
(revision 475455)
@@ -50,7 +50,11 @@ check(wistream& stream, const wstring& s
{
  bool test __attribute__((unused)) = true;

+#ifdef __ia16__
+  static wchar_t buf[1000];
+#else
  static wchar_t buf[1000000];
+#endif

Hmm, I guess this can't use { target { simulator || ia16-*-* } } to
reduce the MAX_LENGTH instead, because this array would still be too
large for ia16. OK.

  wstring::size_type index = 0, index_new = 0;
  unsigned n = 0;

Index: 
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc
===================================================================
--- 
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc    
    (revision 475331)
+++ 
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/errc_std_c++0x.cc    
    (revision 475455)
@@ -104,7 +104,10 @@ void test01()

  TEST_ERRC(not_connected);
  TEST_ERRC(not_enough_memory);
+
+#ifdef _GLIBCXX_HAVE_ENOTSUP
  TEST_ERRC(not_supported);
+#endif

Ironic that ENOTSUP is not supported :-)


Index: 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc
===================================================================
--- 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc
    (revision 475331)
+++ 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_functions.cc
    (revision 475455)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target { stdint_types } } }
// { dg-options "-std=gnu++11" }

// Copyright (C) 2010-2016 Free Software Foundation, Inc.
@@ -20,6 +20,7 @@

#include <random>
#include <testsuite_common_types.h>
+#include <stdint.h>

namespace __gnu_test
{
@@ -49,7 +50,7 @@ namespace __gnu_test
int main()
{
  __gnu_test::constexpr_member_functions test;
-  typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> 
type;
+  typedef std::linear_congruential_engine<uint_least32_t, 41, 0, 2147483647> 
type;

I see no harm in just using INT_MAX for the last parameter, so the
type can stay as unsigned int.



Index: 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc
===================================================================
--- 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc
 (revision 475331)
+++ 
libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/constexpr_data.cc
 (revision 475455)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target { stdint_types } } }
// { dg-options "-std=gnu++11" }

// Copyright (C) 2010-2016 Free Software Foundation, Inc.
@@ -20,6 +20,7 @@

#include <random>
#include <testsuite_common_types.h>
+#include <stdint.h>

namespace __gnu_test
{
@@ -53,7 +54,7 @@ namespace __gnu_test
int main()
{
  __gnu_test::constexpr_member_data test;
-  typedef std::linear_congruential_engine<unsigned int, 41, 0, 2147483647> 
type;
+  typedef std::linear_congruential_engine<uint_least32_t, 41, 0, 2147483647> 
type;

Ditto.

  test.operator()<type>();
  return 0;
}


Index: libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc
===================================================================
--- libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc        
(revision 475331)
+++ libstdc++-v3/testsuite/20_util/tuple/creation_functions/constexpr.cc        
(revision 475455)
@@ -1,4 +1,4 @@
-// { dg-do compile }
+// { dg-do compile { target { stdint_types } } }
// { dg-options "-std=gnu++11" }

// Copyright (C) 2011-2016 Free Software Foundation, Inc.
@@ -24,6 +24,7 @@
// changes this test may begin to fail.

#include <tuple>
+#include <stdint.h>

bool test __attribute__((unused)) = true;

@@ -60,9 +61,9 @@ test_forward_as_tuple()
  {
    static int i(22);
    static float f(22.222);
-    static int ii(77799);
+    static int_least32_t ii(77799);

This can just be changed to a smaller number that fits in int.


-    typedef std::tuple<int&, float&, int&&> tuple_type;
+    typedef std::tuple<int&, float&, int_least32_t&&> tuple_type;
    constexpr tuple_type p1 __attribute__((unused))
      = std::forward_as_tuple(i, f, std::move(ii));
  }
@@ -83,9 +84,9 @@ test_tie()
  {
    static int i(22);
    static float f(22.222);
-    static const int ii(77799);
+    static const int_least32_t ii(77799);

-    typedef std::tuple<int&, float&, const int&> tuple_type;
+    typedef std::tuple<int&, float&, const int_least32_t&> tuple_type;
    constexpr tuple_type p1 __attribute__((unused))
      = std::tie(i, f, ii);
  }



Otherwise this seems OK for stage 1.


Reply via email to