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

            Bug ID: 90920
           Summary: [9/10 Regression] ABI incompatibility in std::rotate
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: fdumont at gcc dot gnu.org
  Target Milestone: ---

r263433 moved some checking from std::__rotate to its caller, std::rotate. It's
no longer safe to combine code compiled before and after that change:

tmp$ cat rot1.cc
#include <algorithm>

namespace std {
// explicit instantiation definition to simulate the linker choosing the
// definition from this file.
template int* __rotate(int*, int*, int*, random_access_iterator_tag);
}
tmp$ cat rot2.cc
#include <algorithm>

namespace std {
// explicit instantiation definition to simulate the linker choosing a
// definition from another file.
extern template int* __rotate(int*, int*, int*, random_access_iterator_tag);
}
int main()
{
  int i = 0;
  std::rotate(&i, &i, &i+1);
}
tmp$ /home/jwakely/gcc/9.1.0/bin/g++ -c rot1.cc
tmp$ /home/jwakely/gcc/8.3.0/bin/g++ -c rot2.cc
tmp$ /home/jwakely/gcc/9.1.0/bin/g++ rot1.o rot2.o
tmp$ ./a.out
Floating point exception (core dumped)

Reply via email to