← Back to team overview

leaningtech-dev team mailing list archive

[Bug 1299510] [NEW] std::rotate fails in some cases due to std::memmove

 

Public bug reported:

Testcase attached

I've noticed a weird failure of std::rotate(first, middle, last) that
happens when middle == last - 1, i.e. when trying to rotate_right.

The library has a special case for that: it detects that we are rotating
right and __rotate_right gets called (algorithm:2325)

__rotate_right moves the last element in the first place and then tries
to move all the other elements forwards by one position by calling
move_backward (algorithm:1897)

There are different versions of move_backward: one of them is selected
based on the result of a __unwrap_iter (algorithm:1674).

In this case __move_backward (algorithm:1885) gets called: this version
deals with memory pointers, and calls std::memmove to actually move
objects. This some how fails

One of the possible solutions would probably be to remove __unwrap_iter
that returns a pointer and deal always with iterators.

** Affects: duetto
     Importance: Undecided
         Status: New

** Attachment added: "testrotate.cpp"
   https://bugs.launchpad.net/bugs/1299510/+attachment/4051189/+files/testrotate.cpp

-- 
You received this bug notification because you are a member of
Leaningtech Team, which is subscribed to Duetto.
https://bugs.launchpad.net/bugs/1299510

Title:
  std::rotate fails in some cases due to std::memmove

Status in Duetto: C++ for the Web:
  New

Bug description:
  Testcase attached

  I've noticed a weird failure of std::rotate(first, middle, last) that
  happens when middle == last - 1, i.e. when trying to rotate_right.

  The library has a special case for that: it detects that we are
  rotating right and __rotate_right gets called (algorithm:2325)

  __rotate_right moves the last element in the first place and then
  tries to move all the other elements forwards by one position by
  calling move_backward (algorithm:1897)

  There are different versions of move_backward: one of them is selected
  based on the result of a __unwrap_iter (algorithm:1674).

  In this case __move_backward (algorithm:1885) gets called: this
  version deals with memory pointers, and calls std::memmove to actually
  move objects. This some how fails

  One of the possible solutions would probably be to remove
  __unwrap_iter that returns a pointer and deal always with iterators.

To manage notifications about this bug go to:
https://bugs.launchpad.net/duetto/+bug/1299510/+subscriptions


Follow ups

References