public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Results for 8.0.1 20180316 (experimental) [trunk revision 258610] (GCC) libstdc++ testsuite on x86_64-pc-linux-gnu
       [not found] ` <CAH6eHdQZr1uB5ADsuj+A688mWbAObBmhuWQ_PQNpsOuA75gjFw@mail.gmail.com>
@ 2018-03-20 21:03   ` François Dumont
  2018-03-20 21:44     ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: François Dumont @ 2018-03-20 21:03 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]

On 20/03/2018 19:20, Jonathan Wakely wrote:
> On 17 March 2018 at 09:01, Jonathan Wakely wrote:
>> Native configuration is x86_64-pc-linux-gnu
>>
>>                  === libstdc++ tests ===
>>
>>
>> Running target unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS
>>
>>                  === libstdc++ Summary for unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS ===
>>
>> # of expected passes            12330
>> # of expected failures          71
>> # of unsupported tests          579
>>
>> Running target unix/-std=gnu++11/-D_GLIBCXX_DEBUG
>> XPASS: 21_strings/basic_string_view/element_access/char/2.cc execution test
>> XPASS: 21_strings/basic_string_view/element_access/wchar_t/2.cc execution test
>> FAIL: 23_containers/bitset/hash/1.cc (test for excess errors)
>> UNRESOLVED: 23_containers/bitset/hash/1.cc compilation failed to produce executable
> These debug mode failures are regressions, reported as
> https://gcc.gnu.org/PR84998
>
> I think they all have the same root cause (Nathan fixed a bug in G++).
>
I had already prepared this patch. Thanks for explaining why we have 
this problem now.

Note that I chose to use full specialization with std::hash<> for std::bitset and std::vector<bool>.

It also fix a versioned namespace issue when partially specializing std::hash for debug vector<bool>.

Tested under Linux x86_64 normal, debug and versioned namespace modes.

Ok to commit ?

François


[-- Attachment #2: friend_declaration_debug.patch --]
[-- Type: text/x-patch, Size: 5925 bytes --]

diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h
index fbf982f..05e9ff2 100644
--- a/libstdc++-v3/include/bits/stl_bvector.h
+++ b/libstdc++-v3/include/bits/stl_bvector.h
@@ -58,6 +58,7 @@
 
 #if __cplusplus >= 201103L
 #include <initializer_list>
+#include <bits/functional_hash.h>
 #endif
 
 namespace std _GLIBCXX_VISIBILITY(default)
@@ -593,7 +594,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       typedef typename _Base::_Bit_alloc_traits		_Bit_alloc_traits;
 
 #if __cplusplus >= 201103L
-      template<typename> friend struct hash;
+      friend struct std::hash<vector>;
 #endif
 
     public:
@@ -1321,8 +1322,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
 
 #if __cplusplus >= 201103L
 
-#include <bits/functional_hash.h>
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h
index 2632775..78ac087 100644
--- a/libstdc++-v3/include/bits/stl_map.h
+++ b/libstdc++-v3/include/bits/stl_map.h
@@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
 
       template<typename, typename>
-	friend class _Rb_tree_merge_helper;
+	friend class std::_Rb_tree_merge_helper;
 
       template<typename _C2>
 	void
diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h
index 31beb84..371cd43 100644
--- a/libstdc++-v3/include/bits/stl_multimap.h
+++ b/libstdc++-v3/include/bits/stl_multimap.h
@@ -651,7 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
 
       template<typename, typename>
-	friend class _Rb_tree_merge_helper;
+	friend class std::_Rb_tree_merge_helper;
 
       template<typename _C2>
 	void
diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h
index 1bba400..7286df6 100644
--- a/libstdc++-v3/include/bits/stl_multiset.h
+++ b/libstdc++-v3/include/bits/stl_multiset.h
@@ -589,7 +589,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_equal(__hint, std::move(__nh)); }
 
       template<typename, typename>
-	friend class _Rb_tree_merge_helper;
+	friend class std::_Rb_tree_merge_helper;
 
       template<typename _Compare1>
 	void
diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h
index f79ab1c..b6b2fc4f 100644
--- a/libstdc++-v3/include/bits/stl_set.h
+++ b/libstdc++-v3/include/bits/stl_set.h
@@ -604,7 +604,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { return _M_t._M_reinsert_node_hint_unique(__hint, std::move(__nh)); }
 
       template<typename, typename>
-	friend class _Rb_tree_merge_helper;
+	friend class std::_Rb_tree_merge_helper;
 
       template<typename _Compare1>
 	void
diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h
index b757ff2..07aad9e 100644
--- a/libstdc++-v3/include/bits/unordered_map.h
+++ b/libstdc++-v3/include/bits/unordered_map.h
@@ -862,7 +862,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-	friend class _Hash_merge_helper;
+	friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
 	void
@@ -1742,7 +1742,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-	friend class _Hash_merge_helper;
+	friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
 	void
diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h
index 77942a3..c9ac4ad 100644
--- a/libstdc++-v3/include/bits/unordered_set.h
+++ b/libstdc++-v3/include/bits/unordered_set.h
@@ -588,7 +588,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-	friend class _Hash_merge_helper;
+	friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
 	void
@@ -1368,7 +1368,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 
 #if __cplusplus > 201402L
       template<typename, typename, typename>
-	friend class _Hash_merge_helper;
+	friend class std::_Hash_merge_helper;
 
       template<typename _H2, typename _P2>
 	void
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index fa79379..5289265 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -770,6 +770,8 @@ namespace __debug
 } // namespace __debug
 
 #if __cplusplus >= 201103L
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
   // DR 1182.
   /// std::hash specialization for vector<bool>.
   template<typename _Alloc>
@@ -780,6 +782,8 @@ namespace __debug
       operator()(const __debug::vector<bool, _Alloc>& __b) const noexcept
       { return std::hash<_GLIBCXX_STD_C::vector<bool, _Alloc>>()(__b); }
     };
+
+_GLIBCXX_END_NAMESPACE_VERSION
 #endif
 
 } // namespace std
diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset
index 630602d..e598ea3 100644
--- a/libstdc++-v3/include/std/bitset
+++ b/libstdc++-v3/include/std/bitset
@@ -50,6 +50,10 @@
 #include <iosfwd>
 #include <bits/cxxabi_forced.h>
 
+#if __cplusplus >= 201103L
+# include <bits/functional_hash.h>
+#endif
+
 #define _GLIBCXX_BITSET_BITS_PER_WORD  (__CHAR_BIT__ * __SIZEOF_LONG__)
 #define _GLIBCXX_BITSET_WORDS(__n) \
   ((__n) / _GLIBCXX_BITSET_BITS_PER_WORD + \
@@ -779,7 +783,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       }
 
 #if __cplusplus >= 201103L
-      template<typename> friend struct hash;
+      friend struct std::hash<bitset>;
 #endif
 
     public:
@@ -1549,8 +1553,6 @@ _GLIBCXX_END_NAMESPACE_CONTAINER
 
 #if __cplusplus >= 201103L
 
-#include <bits/functional_hash.h>
-
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Results for 8.0.1 20180316 (experimental) [trunk revision 258610] (GCC) libstdc++ testsuite on x86_64-pc-linux-gnu
  2018-03-20 21:03   ` Results for 8.0.1 20180316 (experimental) [trunk revision 258610] (GCC) libstdc++ testsuite on x86_64-pc-linux-gnu François Dumont
@ 2018-03-20 21:44     ` Jonathan Wakely
  2018-03-21 12:33       ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2018-03-20 21:44 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

On 20 March 2018 at 21:02, François Dumont wrote:
> On 20/03/2018 19:20, Jonathan Wakely wrote:
>>
>> On 17 March 2018 at 09:01, Jonathan Wakely wrote:
>>>
>>> Native configuration is x86_64-pc-linux-gnu
>>>
>>>                  === libstdc++ tests ===
>>>
>>>
>>> Running target unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS
>>>
>>>                  === libstdc++ Summary for
>>> unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS ===
>>>
>>> # of expected passes            12330
>>> # of expected failures          71
>>> # of unsupported tests          579
>>>
>>> Running target unix/-std=gnu++11/-D_GLIBCXX_DEBUG
>>> XPASS: 21_strings/basic_string_view/element_access/char/2.cc execution
>>> test
>>> XPASS: 21_strings/basic_string_view/element_access/wchar_t/2.cc execution
>>> test
>>> FAIL: 23_containers/bitset/hash/1.cc (test for excess errors)
>>> UNRESOLVED: 23_containers/bitset/hash/1.cc compilation failed to produce
>>> executable
>>
>> These debug mode failures are regressions, reported as
>> https://gcc.gnu.org/PR84998
>>
>> I think they all have the same root cause (Nathan fixed a bug in G++).
>>
> I had already prepared this patch. Thanks for explaining why we have this
> problem now.

Ah I was just about to commit my own fix.

> Note that I chose to use full specialization with std::hash<> for
> std::bitset and std::vector<bool>.

Great, that's an improvement over my patch.

> It also fix a versioned namespace issue when partially specializing
> std::hash for debug vector<bool>.

Even better.

> Tested under Linux x86_64 normal, debug and versioned namespace modes.
>
> Ok to commit ?

Yes please!

Please be sure to add "PR libstdc++/84998" to the changelog entry so
it updates bugzilla.

Thanks very much.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Results for 8.0.1 20180316 (experimental) [trunk revision 258610] (GCC) libstdc++ testsuite on x86_64-pc-linux-gnu
  2018-03-20 21:44     ` Jonathan Wakely
@ 2018-03-21 12:33       ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2018-03-21 12:33 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]

On 20 March 2018 at 21:06, Jonathan Wakely wrote:
> On 20 March 2018 at 21:02, François Dumont wrote:
>> On 20/03/2018 19:20, Jonathan Wakely wrote:
>>>
>>> On 17 March 2018 at 09:01, Jonathan Wakely wrote:
>>>>
>>>> Native configuration is x86_64-pc-linux-gnu
>>>>
>>>>                  === libstdc++ tests ===
>>>>
>>>>
>>>> Running target unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS
>>>>
>>>>                  === libstdc++ Summary for
>>>> unix/-std=gnu++11/-D_GLIBCXX_ASSERTIONS ===
>>>>
>>>> # of expected passes            12330
>>>> # of expected failures          71
>>>> # of unsupported tests          579
>>>>
>>>> Running target unix/-std=gnu++11/-D_GLIBCXX_DEBUG
>>>> XPASS: 21_strings/basic_string_view/element_access/char/2.cc execution
>>>> test
>>>> XPASS: 21_strings/basic_string_view/element_access/wchar_t/2.cc execution
>>>> test
>>>> FAIL: 23_containers/bitset/hash/1.cc (test for excess errors)
>>>> UNRESOLVED: 23_containers/bitset/hash/1.cc compilation failed to produce
>>>> executable
>>>
>>> These debug mode failures are regressions, reported as
>>> https://gcc.gnu.org/PR84998
>>>
>>> I think they all have the same root cause (Nathan fixed a bug in G++).
>>>
>> I had already prepared this patch. Thanks for explaining why we have this
>> problem now.
>
> Ah I was just about to commit my own fix.
>
>> Note that I chose to use full specialization with std::hash<> for
>> std::bitset and std::vector<bool>.
>
> Great, that's an improvement over my patch.
>
>> It also fix a versioned namespace issue when partially specializing
>> std::hash for debug vector<bool>.
>
> Even better.
>
>> Tested under Linux x86_64 normal, debug and versioned namespace modes.
>>
>> Ok to commit ?
>
> Yes please!
>
> Please be sure to add "PR libstdc++/84998" to the changelog entry so
> it updates bugzilla.
>
> Thanks very much.

This adds a test for the hash specializations in debug mode, and fixes
another failure caused by different line numbers in debug mode.

Committed to trunk.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 4673 bytes --]

commit 347afbec5010ed9edeff70ce18d5e2511a7c27f4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Sun Mar 18 00:01:07 2018 +0000

    Fix some libstdc++ testsuite failures
    
            * testsuite/20_util/function_objects/comparisons_pointer.cc: Use
            VERIFY instead of assert.
            * testsuite/20_util/hash/84998.cc: New test.
            * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: New
            copy of test adjusted for Debug Mode.
            * testsuite/23_containers/vector/cons/destructible_neg.cc: Do not run
            test in Debug Mode.

diff --git a/libstdc++-v3/testsuite/20_util/function_objects/comparisons_pointer.cc b/libstdc++-v3/testsuite/20_util/function_objects/comparisons_pointer.cc
index aad0bc3dd2e..474190cdf81 100644
--- a/libstdc++-v3/testsuite/20_util/function_objects/comparisons_pointer.cc
+++ b/libstdc++-v3/testsuite/20_util/function_objects/comparisons_pointer.cc
@@ -174,7 +174,7 @@ test05()
   int n = 0;
   while (ss >> n)
     sum += n;
-  assert( sum == 1 );
+  VERIFY( sum == 1 );
 
 #if __cplusplus >= 201402L
   static_assert( lt(y, y+1), "constexpr less<const X*>" );
diff --git a/libstdc++-v3/testsuite/20_util/hash/84998.cc b/libstdc++-v3/testsuite/20_util/hash/84998.cc
new file mode 100644
index 00000000000..72bd203cb04
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/hash/84998.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2018 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
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-do compile { target c++11 } }
+
+// PR libstdc++/84998
+
+#include <bitset>
+#include <vector>
+
+std::size_t
+test01()
+{
+  std::bitset<1> b;
+  std::hash<std::bitset<1>> h;
+  return h(b);
+}
+
+std::size_t
+test02()
+{
+  std::vector<bool> b;
+  std::hash<std::vector<bool>> h;
+  return h(b);
+}
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc
new file mode 100644
index 00000000000..5127f5105f4
--- /dev/null
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_debug_neg.cc
@@ -0,0 +1,48 @@
+// Copyright (C) 2017-2018 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
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-D_GLIBCXX_DEBUG" }
+// { dg-do compile { target c++11 } }
+
+#include <vector>
+
+// PR libstdc++/80553
+
+struct DeletedDtor {
+  ~DeletedDtor() = delete;
+};
+
+class PrivateDtor {
+  ~PrivateDtor() { }
+};
+
+void
+test01()
+{
+  std::vector<DeletedDtor> v;
+}
+
+void
+test02()
+{
+  std::vector<PrivateDtor> v;
+}
+
+// { dg-error "value type is destructible" "" { target *-*-* } 0 }
+
+// In Debug Mode the "required from here" errors come from <debug/vector>
+// { dg-error "required from here" "" { target *-*-* } 155 }
diff --git a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc
index fc5e3192c87..06fd0730106 100644
--- a/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/vector/cons/destructible_neg.cc
@@ -16,6 +16,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile { target c++11 } }
+// { dg-require-normal-mode "" }
 
 #include <vector>
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-21 12:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5aacd955.W97SAA9Qc1hoHlKB%jwakely.gcc@gmail.com>
     [not found] ` <CAH6eHdQZr1uB5ADsuj+A688mWbAObBmhuWQ_PQNpsOuA75gjFw@mail.gmail.com>
2018-03-20 21:03   ` Results for 8.0.1 20180316 (experimental) [trunk revision 258610] (GCC) libstdc++ testsuite on x86_64-pc-linux-gnu François Dumont
2018-03-20 21:44     ` Jonathan Wakely
2018-03-21 12:33       ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).