public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libstdc++ new deque failures
@ 2014-11-05 14:14 David Edelsohn
  2014-11-05 17:49 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: David Edelsohn @ 2014-11-05 14:14 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: GCC Patches, libstdc++

Jonathan,

I still am seeing new failures in the libstdc++ deque testsuite as of
last night.  I don't know if you still are working through the fallout
from the earlier patches, but I wanted to make you aware.

AIX defaults to 32 bit. A template was not initialized for int?

FAIL: 23_containers/deque/requirements/dr438/insert_neg.cc  (test for
errors, line 1943)
FAIL: 23_containers/deque/requirements/dr438/insert_neg.cc (test for
excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/bits/stl_deque.h:1931:25:
error: no matching function for call to
'std::deque<A>::_M_fill_insert(std::deque<A>::iterator&, int&, int&)'

FAIL: 23_containers/deque/requirements/dr438/assign_neg.cc  (test for
errors, line 1859)
FAIL: 23_containers/deque/requirements/dr438/assign_neg.cc (test for
excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/bits/stl_deque.h:1847:25:
error: no matching function for call to
'std::deque<A>::_M_fill_assign(int&, int&)'

FAIL: 23_containers/deque/requirements/dr438/constructor_1_neg.cc
(test for errors, line 1792)
FAIL: 23_containers/deque/requirements/dr438/constructor_1_neg.cc
(test for excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/bits/stl_deque.h:1780:22:
error: no matching function for call to 'std::deque<std::deque<int>
>::_M_fill_initialize(int&)'

FAIL: 23_containers/deque/requirements/dr438/constructor_2_neg.cc
(test for errors, line 1792)
FAIL: 23_containers/deque/requirements/dr438/constructor_2_neg.cc
(test for excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/bits/stl_deque.h:1780:22:
error: no matching function for call to
'std::deque<std::deque<std::pair<char, char> >
::_M_fill_initialize(char&)'


And these are not related to deque, but appear to be additional issues
in the libstdc++ implementation:

FAIL: 20_util/tuple/comparison_operators/overloaded.cc (test for excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/tuple:102:12:
error: 'constexpr std::_Head_base<_Idx, _Head,
false>::_Head_base(const std::_Head_base<_Idx, _Head, false>&) [with
long unsigned int _Idx = 0ul; _Head = std::nullptr_t]' conflicts with
a previous declaration
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/tuple:102:12:
error: 'constexpr std::_Head_base<_Idx, _Head,
false>::_Head_base(const std::_Head_base<_Idx, _Head, false>&) [with
long unsigned int _Idx = 0ul; _Head = std::nullptr_t]' conflicts with
a previous declaration

FAIL: 20_util/tuple/creation_functions/tuple_cat.cc (test for excess errors)
Excess errors:
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/tuple:102:12:
error: 'constexpr std::_Head_base<_Idx, _Head,
false>::_Head_base(const std::_Head_base<_Idx, _Head, false>&) [with
long unsigned int _Idx = 6ul; _Head = std::nullptr_t]' conflicts with
a previous declaration
/tmp/20141104/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/tuple:102:12:
error: 'constexpr std::_Head_base<_Idx, _Head,
false>::_Head_base(const std::_Head_base<_Idx, _Head, false>&) [with
long unsigned int _Idx = 6ul; _Head = std::nullptr_t]' conflicts with
a previous declaration

If you would prefer that I open Bugzilla issues, let me know.

Thanks, David

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

* Re: libstdc++ new deque failures
  2014-11-05 14:14 libstdc++ new deque failures David Edelsohn
@ 2014-11-05 17:49 ` Jonathan Wakely
  2014-11-10 23:11   ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2014-11-05 17:49 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Jonathan Wakely, GCC Patches, libstdc++

On 5 November 2014 14:14, David Edelsohn wrote:
> Jonathan,
>
> I still am seeing new failures in the libstdc++ deque testsuite as of
> last night.  I don't know if you still are working through the fallout
> from the earlier patches, but I wanted to make you aware.

Yes, those tests are meant to fail but I need to adjust the dg-error
line numbers after one of my earlier patches.

I'm working on a patch (I might make other changes to std::deque,
which would require changing the dg-error line numbers yet agan, so
I'm holding off until the other changes are ready ... or I decide not
to make them and just fix the tests.)

Sorry for the noise in the testresults.

>
>
> And these are not related to deque, but appear to be additional issues
> in the libstdc++ implementation:

I hadn't seen these ones, I'll take a look, thanks.

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

* Re: libstdc++ new deque failures
  2014-11-05 17:49 ` Jonathan Wakely
@ 2014-11-10 23:11   ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2014-11-10 23:11 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: David Edelsohn, GCC Patches, libstdc++

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

On 05/11/14 17:49 +0000, Jonathan Wakely wrote:
>On 5 November 2014 14:14, David Edelsohn wrote:
>> Jonathan,
>>
>> I still am seeing new failures in the libstdc++ deque testsuite as of
>> last night.  I don't know if you still are working through the fallout
>> from the earlier patches, but I wanted to make you aware.
>
>Yes, those tests are meant to fail but I need to adjust the dg-error
>line numbers after one of my earlier patches.
>
>I'm working on a patch (I might make other changes to std::deque,
>which would require changing the dg-error line numbers yet agan, so
>I'm holding off until the other changes are ready ... or I decide not
>to make them and just fix the tests.)
>
>Sorry for the noise in the testresults.

Fixed with the attached patch.

The moved-from deque needs to allocate memory for its empty state, but
we don't want to modify the deque until after we know whether that
allocation throws or not. My solution is to make a copy of the
allocator and put that in the moved-from state, then use it to
allocate memory. If that succeeds put the object's own allocator into
the same state and exchange the pointers to transfer ownership.

>> And these are not related to deque, but appear to be additional issues
>> in the libstdc++ implementation:
>
>I hadn't seen these ones, I'll take a look, thanks.

I haven't looked at these yet.


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

commit d3ffebcebad97c71887057f8155f4dbd914f2933
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Nov 10 19:44:23 2014 +0000

    Fix std::deque move construction with non-equal allocators.
    
    	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)):
    	Dispatch according to whether allocators are always equal.
    	(_Deque_base::_M_move_impl()): Implement move-from state.
    	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Fix
    	dg-error line number.
    	* testsuite/23_containers/deque/requirements/dr438/
    	constructor_1_neg.cc: Likewise.
    	* testsuite/23_containers/deque/requirements/dr438/
    	constructor_2_neg.cc: Likewise.
    	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
    	Likewise.

diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index d50d3c90..c0052b3 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -502,14 +502,23 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       { /* Caller must initialize map. */ }
 
 #if __cplusplus >= 201103L
-      _Deque_base(_Deque_base&& __x)
-      : _M_impl(__x._M_get_Tp_allocator())
+      _Deque_base(_Deque_base&& __x, false_type)
+      : _M_impl(__x._M_move_impl())
+      { }
+
+      _Deque_base(_Deque_base&& __x, true_type)
+      : _M_impl(std::move(__x._M_get_Tp_allocator()))
       {
 	_M_initialize_map(0);
 	if (__x._M_impl._M_map)
 	  this->_M_impl._M_swap_data(__x._M_impl);
       }
 
+      _Deque_base(_Deque_base&& __x)
+      : _Deque_base(std::move(__x),
+		    __gnu_cxx::__allocator_always_compares_equal<_Alloc>{})
+      { }
+
       _Deque_base(_Deque_base&& __x, const allocator_type& __a, size_type __n)
       : _M_impl(__a)
       {
@@ -555,18 +564,21 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	{ }
 
 #if __cplusplus >= 201103L
-	_Deque_impl(_Tp_alloc_type&& __a) _GLIBCXX_NOEXCEPT
+	_Deque_impl(_Deque_impl&&) = default;
+
+	_Deque_impl(_Tp_alloc_type&& __a) noexcept
 	: _Tp_alloc_type(std::move(__a)), _M_map(), _M_map_size(0),
 	  _M_start(), _M_finish()
 	{ }
 #endif
 
-	void _M_swap_data(_Deque_impl& __x)
+	void _M_swap_data(_Deque_impl& __x) _GLIBCXX_NOEXCEPT
 	{
-	  std::swap(this->_M_start, __x._M_start);
-	  std::swap(this->_M_finish, __x._M_finish);
-	  std::swap(this->_M_map, __x._M_map);
-	  std::swap(this->_M_map_size, __x._M_map_size);
+	  using std::swap;
+	  swap(this->_M_start, __x._M_start);
+	  swap(this->_M_finish, __x._M_finish);
+	  swap(this->_M_map, __x._M_map);
+	  swap(this->_M_map_size, __x._M_map_size);
 	}
       };
 
@@ -618,6 +630,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
       enum { _S_initial_map_size = 8 };
 
       _Deque_impl _M_impl;
+
+#if __cplusplus >= 201103L
+    private:
+      _Deque_impl
+      _M_move_impl()
+      {
+	if (!_M_impl._M_map)
+	  return std::move(_M_impl);
+
+	// Create a copy of the current allocator.
+	_Tp_alloc_type __alloc{_M_get_Tp_allocator()};
+	// Put that copy in a moved-from state.
+	_Tp_alloc_type __unused __attribute((__unused__)) {std::move(__alloc)};
+	// Create an empty map that allocates using the moved-from allocator.
+	_Deque_base __empty{__alloc};
+	// Now safe to modify current allocator and perform non-throwing swaps.
+	_Deque_impl __ret{std::move(_M_get_Tp_allocator())};
+	_M_impl._M_swap_data(__ret);
+	_M_impl._M_swap_data(__empty._M_impl);
+	return __ret;
+      }
+#endif
     };
 
   template<typename _Tp, typename _Alloc>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
index 8092ead..b38f3ae 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1859 }
+// { dg-error "no matching" "" { target *-*-* } 1881 }
 
 #include <deque>
 
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
index 4abdf46..a30029a 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1792 }
+// { dg-error "no matching" "" { target *-*-* } 1814 }
 
 #include <deque>
 
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
index 61bce4e..02eba79 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1792 }
+// { dg-error "no matching" "" { target *-*-* } 1814 }
 
 #include <deque>
 #include <utility>
diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
index a0ca00c..8c1dd2e 100644
--- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile }
-// { dg-error "no matching" "" { target *-*-* } 1943 }
+// { dg-error "no matching" "" { target *-*-* } 1965 }
 
 #include <deque>
 

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

* Re: libstdc++ new deque failures
  2014-11-11 10:23 FX
@ 2014-11-11 10:43 ` Jonathan Wakely
  0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Wakely @ 2014-11-11 10:43 UTC (permalink / raw)
  To: FX; +Cc: GCC Patches, Jonathan Wakely, dje.gcc, libstdc++

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

On 11/11/14 10:49 +0100, FX wrote:
>The patch below break bootstrap on darwin (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63811):
>
>> Fix std::deque move construction with non-equal allocators.
>>
>> 	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)):
>> 	Dispatch according to whether allocators are always equal.
>> 	(_Deque_base::_M_move_impl()): Implement move-from state.
>
>
>In file included from /Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/deque:64:0,
>                 from /Users/fx/devel/gcc/trunk2/libstdc++-v3/include/precompiled/stdc++.h:67:
>/Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/bits/stl_deque.h: In member function ‘std::_Deque_base<_Tp, _Alloc>::_Deque_impl std::_Deque_base<_Tp, _Alloc>::_M_move_impl()’:
>/Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/bits/stl_deque.h:645:17: error: expected primary-expression before ‘__attribute’
>  _Tp_alloc_type __attribute((__unused__)) {std::move(__alloc)};
>                 ^
>make[2]: *** [x86_64-apple-darwin14.0.0/bits/stdc++.h.gch/O2ggnu++0x.gch] Error 1

Should be fixed with this renaming.

Tested x86_64-linux, committed to trunk.


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

commit 3a81c243672bd721f15bc6320fc7a82e850fc3d8
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 11 10:11:09 2014 +0000

    	PR libstdc++/63811
    	* include/bits/stl_deque.h (_Deque_base::_M_move_impl()): Avoid using
    	badname.

diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h
index c0052b3..3a1c85d 100644
--- a/libstdc++-v3/include/bits/stl_deque.h
+++ b/libstdc++-v3/include/bits/stl_deque.h
@@ -642,7 +642,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
 	// Create a copy of the current allocator.
 	_Tp_alloc_type __alloc{_M_get_Tp_allocator()};
 	// Put that copy in a moved-from state.
-	_Tp_alloc_type __unused __attribute((__unused__)) {std::move(__alloc)};
+	_Tp_alloc_type __sink __attribute((__unused__)) {std::move(__alloc)};
 	// Create an empty map that allocates using the moved-from allocator.
 	_Deque_base __empty{__alloc};
 	// Now safe to modify current allocator and perform non-throwing swaps.

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

* Re: libstdc++ new deque failures
@ 2014-11-11 10:23 FX
  2014-11-11 10:43 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: FX @ 2014-11-11 10:23 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jonathan Wakely, dje.gcc, libstdc++

The patch below break bootstrap on darwin (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63811):

> Fix std::deque move construction with non-equal allocators.
> 
> 	* include/bits/stl_deque.h (_Deque_base::_Deque_base(_Deque_base&&)):
> 	Dispatch according to whether allocators are always equal.
> 	(_Deque_base::_M_move_impl()): Implement move-from state.


In file included from /Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/deque:64:0,
                 from /Users/fx/devel/gcc/trunk2/libstdc++-v3/include/precompiled/stdc++.h:67:
/Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/bits/stl_deque.h: In member function ‘std::_Deque_base<_Tp, _Alloc>::_Deque_impl std::_Deque_base<_Tp, _Alloc>::_M_move_impl()’:
/Users/fx/devel/gcc/ibin2/x86_64-apple-darwin14.0.0/libstdc++-v3/include/bits/stl_deque.h:645:17: error: expected primary-expression before ‘__attribute’
  _Tp_alloc_type __attribute((__unused__)) {std::move(__alloc)};
                 ^
make[2]: *** [x86_64-apple-darwin14.0.0/bits/stdc++.h.gch/O2ggnu++0x.gch] Error 1

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

end of thread, other threads:[~2014-11-11 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-05 14:14 libstdc++ new deque failures David Edelsohn
2014-11-05 17:49 ` Jonathan Wakely
2014-11-10 23:11   ` Jonathan Wakely
2014-11-11 10:23 FX
2014-11-11 10:43 ` 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).