Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-127

std::deque::swap does not swap empty containers correctly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.1.3
    • Fix Version/s: 4.2.0
    • Component/s: 23. Containers
    • Labels:
      None
    • Environment:

      Description

      Copy and paste at prompt:

      $ cat t.xpp
      #include <cstddef>
      #include <deque>

      struct A

      { char tmp [32]; }

      ;

      int main ()
      {
      A a [32];

      std::deque<A> lhs (a, a + 0);
      std::deque<A> rhs (a, a + 1);

      lhs.swap (rhs);

      return 0;
      }

      Building and running the example leads to a SIGSEGV:

      $ make SRCS=t.cpp && ./t
      gcc -c -I/build/nicoara/stdcxx/include/ansi -D_RWSTDDEBUG -pthread -D_RWSTD_USE_CONFIG -I/build/nicoara/15s-stdcxx/include -I/build/nicoara/stdcxx/include -I/build/nicoara/stdcxx/../rwtest -I/build/nicoara/stdcxx/../rwtest/include -I/build/nicoara/stdcxx/tests/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align /build/nicoara/stdcxx/tests/containers/t.cpp
      gcc t.o -o t -L/build/nicoara/15s-stdcxx/rwtest -lrwtest15s -pthread -L/build/nicoara/15s-stdcxx/lib -lstd15s -lsupc++ -lm
      Segmentation fault

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                farid Farid Zaripov
                Reporter:
                lnicoara Liviu Nicoara
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: