public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const
@ 2014-07-29  8:19 stuff at trez dot name
  2014-07-29  9:03 ` [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: stuff at trez dot name @ 2014-07-29  8:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

            Bug ID: 61946
           Summary: rope construction, passing allocator referenct without
                    const
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stuff at trez dot name

Include file ext/rope of libstdc++ in revision 124427, there was a change with
passing allocator through in-template functions, in my interest is constructor:

rope(char_producer<_CharT> *, size_t, bool, const allocator_type& )

which calls _S_new_RopeFunction, the change was with adding reference to 4
parameter:

from:
 _S_new_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d,
allocator_type __a

to:
 _S_new_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d,
allocator_type& __a


and it makes problem with compilation of example code:

#include <ext/rope>

class empty_char_prod : public __gnu_cxx::char_producer<char>
{
  public:
    virtual void operator()(size_t start_pos, size_t len, char* buffer)
    {}
};

int main ()
{
    empty_char_prod* ecp = new empty_char_prod;
    __gnu_cxx::crope excrope ( ecp, 10L, true );

    return 0;
}

compilation on gcc version 4.9.1 (Debian 4.9.1-1):
/usr/include/c++/4.9/ext/rope: In instantiation of ‘__gnu_cxx::rope<_CharT,
_Alloc>::rope(__gnu_cxx::char_producer<_CharT>*, std::size_t, bool, const
allocator_type&) [with _CharT = char; _Alloc = std::allocator<char>;
std::size_t = long unsigned int; __gnu_cxx::rope<_CharT,
_Alloc>::allocator_type = std::allocator<char>]’:
./cropy.cc:17:47:   required from here
/usr/include/c++/4.9/ext/rope:1880:57: error: no matching function for call to
‘__gnu_cxx::rope<char>::_S_new_RopeFunction(__gnu_cxx::char_producer<char>*&,
std::size_t&, bool&, const allocator_type&)’
    0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
                                                         ^
/usr/include/c++/4.9/ext/rope:1880:57: note: candidate is:
/usr/include/c++/4.9/ext/rope:1673:7: note: static __gnu_cxx::rope<_CharT,
_Alloc>::_RopeFunction* __gnu_cxx::rope<_CharT,
_Alloc>::_S_new_RopeFunction(__gnu_cxx::char_producer<_CharT>*, std::size_t,
bool, __gnu_cxx::rope<_CharT, _Alloc>::allocator_type&) [with _CharT = char;
_Alloc = std::allocator<char>; __gnu_cxx::rope<_CharT, _Alloc>::_RopeFunction =
__gnu_cxx::_Rope_RopeFunction<char, std::allocator<char> >; std::size_t = long
unsigned int; __gnu_cxx::rope<_CharT, _Alloc>::allocator_type =
std::allocator<char>]
       _S_new_RopeFunction(char_producer<_CharT>* __f,
       ^
/usr/include/c++/4.9/ext/rope:1673:7: note:   no known conversion for argument
4 from ‘const allocator_type {aka const std::allocator<char>}’ to
‘__gnu_cxx::rope<char>::allocator_type& {aka std::allocator<char>&}’


I thing the change should by from copy to const reference, like this:
 _S_new_RopeFunction(char_producer<_CharT>* __f, size_t __size, bool __d, const
allocator_type& __a
>From gcc-bugs-return-457301-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Jul 29 08:31:48 2014
Return-Path: <gcc-bugs-return-457301-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 22313 invoked by alias); 29 Jul 2014 08:31:47 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 22267 invoked by uid 48); 29 Jul 2014 08:31:41 -0000
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/61938] Vectorization not happening .
Date: Tue, 29 Jul 2014 08:31:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rguenth at gcc dot gnu.org
X-Bugzilla-Status: WAITING
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status cf_reconfirmed_on everconfirmed
Message-ID: <bug-61938-4-ajehsafnKa@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-61938-4@http.gcc.gnu.org/bugzilla/>
References: <bug-61938-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-07/txt/msg01892.txt.bz2
Content-length: 668

https://gcc.gnu.org/bugzilla/show_bug.cgi?ida938

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2014-07-29
     Ever confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is the store to result[k] where k is not an affine induction
variable.
This is a "distribute" store (similar to a "gather" load).  I see no sensible
way of vectorizing this, do you?


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
@ 2014-07-29  9:03 ` redi at gcc dot gnu.org
  2014-07-29 17:31 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-29  9:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-07-29
      Known to work|                            |4.2.4
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
            Summary|rope construction, passing  |[4.8/4.9/4.10 Regression]
                   |allocator referenct without |rope construction, passing
                   |const                       |allocator referenct without
                   |                            |const
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The correct fix is to use _M_get_allocator() to pass a non-const reference:

--- a/libstdc++-v3/include/ext/rope
+++ b/libstdc++-v3/include/ext/rope
@@ -1876,8 +1876,9 @@ protected:
           const allocator_type& __a = allocator_type())
       : _Base(__a)
       {
-       this->_M_tree_ptr = (0 == __len) ?
-         0 : _S_new_RopeFunction(__fn, __len, __delete_fn, __a);
+       this->_M_tree_ptr = (0 == __len)
+         ? 0
+         : _S_new_RopeFunction(__fn, __len, __delete_fn, _M_get_allocator());
       }

       rope(const rope& __x, const allocator_type& __a = allocator_type())


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
  2014-07-29  9:03 ` [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] " redi at gcc dot gnu.org
@ 2014-07-29 17:31 ` redi at gcc dot gnu.org
  2014-07-29 17:38 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-29 17:31 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Tue Jul 29 17:30:25 2014
New Revision: 213220

URL: https://gcc.gnu.org/viewcvs?rev=213220&root=gcc&view=rev
Log:
    PR libstdc++/61946
    * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
    const allocator_type&)): Pass non-const allocator to
    _S_new_RopeFunction.
    * testsuite/ext/rope/61946.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/ext/rope/61946.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/ext/rope


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
  2014-07-29  9:03 ` [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] " redi at gcc dot gnu.org
  2014-07-29 17:31 ` redi at gcc dot gnu.org
@ 2014-07-29 17:38 ` redi at gcc dot gnu.org
  2014-08-04 22:17 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-07-29 17:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed on trunk so far


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
                   ` (2 preceding siblings ...)
  2014-07-29 17:38 ` redi at gcc dot gnu.org
@ 2014-08-04 22:17 ` redi at gcc dot gnu.org
  2014-08-04 22:32 ` redi at gcc dot gnu.org
  2014-08-04 22:34 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 22:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Aug  4 22:16:44 2014
New Revision: 213611

URL: https://gcc.gnu.org/viewcvs?rev=213611&root=gcc&view=rev
Log:
Backported from mainline
2014-07-29  Jonathan Wakely  <jwakely@redhat.com>

    PR libstdc++/61946
    * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
    const allocator_type&)): Pass non-const allocator to
    _S_new_RopeFunction.
    * testsuite/ext/rope/61946.cc: New.

Added:
    branches/gcc-4_8-branch/libstdc++-v3/testsuite/ext/rope/61946.cc
Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/include/ext/rope


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
                   ` (3 preceding siblings ...)
  2014-08-04 22:17 ` redi at gcc dot gnu.org
@ 2014-08-04 22:32 ` redi at gcc dot gnu.org
  2014-08-04 22:34 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 22:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Author: redi
Date: Mon Aug  4 22:31:51 2014
New Revision: 213612

URL: https://gcc.gnu.org/viewcvs?rev=213612&root=gcc&view=rev
Log:
Backported from mainline
2014-07-29  Jonathan Wakely  <jwakely@redhat.com>

    PR libstdc++/61946
    * include/ext/rope (rope::rope(char_producer<_CharT>*, size_t, bool,
    const allocator_type&)): Pass non-const allocator to
    _S_new_RopeFunction.
    * testsuite/ext/rope/61946.cc: New.

Added:
    branches/gcc-4_9-branch/libstdc++-v3/testsuite/ext/rope/61946.cc
Modified:
    branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_9-branch/libstdc++-v3/include/ext/rope


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

* [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] rope construction, passing allocator referenct without const
  2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
                   ` (4 preceding siblings ...)
  2014-08-04 22:32 ` redi at gcc dot gnu.org
@ 2014-08-04 22:34 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-08-04 22:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61946

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.8.4
      Known to fail|                            |4.3.0, 4.8.3, 4.9.1

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
fixed for 4.8.4


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

end of thread, other threads:[~2014-08-04 22:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-29  8:19 [Bug libstdc++/61946] New: rope construction, passing allocator referenct without const stuff at trez dot name
2014-07-29  9:03 ` [Bug libstdc++/61946] [4.8/4.9/4.10 Regression] " redi at gcc dot gnu.org
2014-07-29 17:31 ` redi at gcc dot gnu.org
2014-07-29 17:38 ` redi at gcc dot gnu.org
2014-08-04 22:17 ` redi at gcc dot gnu.org
2014-08-04 22:32 ` redi at gcc dot gnu.org
2014-08-04 22:34 ` redi at gcc dot gnu.org

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).