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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |redi at gcc dot gnu.org

--- Comment #24 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I see a libstdc++ testsuite FAIL without LTO, which I bisected to
r16-1398-g8154fc95f097a1

make check RUNTESTFLAGS="conformance.exp=std/format/functions/format.cc 
 --target_board=unix/-D_GLIBCXX_USE_CXX11_ABI=0/-D_GLIBCXX_DEBUG"

The resulting executable segfaults in a member function of the COW std::string.

Reduced:

// { dg-options "-std=gnu++20 -O2" }
#define _GLIBCXX_USE_CXX11_ABI 0
#define _GLIBCXX_DEBUG 1
#include <format>
#include <string>
#include <assert.h>

int main()
{
  using namespace std;

  string s = format("{0}-{{", 8); // value of s is "8-{"
  assert( s == "8-{" );

  // align
  {
    char c = 120;
    string sB = format("{:🤡^6}", "x");
    assert( sB == "🤡🤡x🤡🤡🤡" );
    string sC = format("{:*^6}", "🤡🤡🤡");
    assert( sC == "🤡🤡🤡" );
  }
}


The patch in comment 22 does fix it (the real testsuite FAIL and the reduced
version above).

Reply via email to