This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/51965] Redundant move constructions in heap algorithms


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51965

Chris Jefferson <chris at bubblescope dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chris at bubblescope dot
                   |                            |net

--- Comment #2 from Chris Jefferson <chris at bubblescope dot net> 2012-01-23 14:04:43 UTC ---
>From my memory of originally writing this, from the old non-moving version,
these moves were originally copies.

The reason I believe those moves are there is because in some cases the
original location is written over. For example trace the behaviour of push_heap
/ __push_heap.

I'm not saying your patch is wrong, and I can't currently compile a g++ svn
head to check, but have you run the tester with your patch, and have you
checked the logic carefully to make sure you can't scribble over the value in
the algorithm?

There may will still be a way of reducing the work to just one move of course,
at the start of the algorithm.

Sorry if you have already considered this, but I remember bits of this being
subtle.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]