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

--- Comment #6 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Created attachment 61980
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61980&action=edit
partial reduction

OK, my cvise also ended up with something nondeterministic... here's an
in-progress reduction that still deterministically fails, I might try reducing
it again later.

The attached is format.hpp, reduction compared using the following script:

===

#!/bin/bash

set -ex
rm -rf gcm.cache

CXX=g++-15
CXXFLAGS="-fmodules -std=c++20 -w -Wfatal-errors -Werror=template-body"

cat <<eof >mod.hpp
#include "format.hpp"
eof

cat <<eof >test.cpp
#include "format.hpp"
#ifdef MODULES
import "mod.hpp";
#endif
int main() {
  try {
    char data[10];
    double d = 3.14;
    auto _ = std::vformat_to(data, "{:5.1f}", std::make_format_args(d));
  } catch (...) {
    __builtin_printf("exception\n");
    return 0;
  }
  __builtin_printf("ok\n");
}
eof

# no modules still works
$CXX $CXXFLAGS test.cpp -o a.out
./a.out | fgrep 'ok'

# modules fails
$CXX $CXXFLAGS -DMODULES mod.hpp test.cpp -o b.out
./b.out | fgrep 'exception'

Reply via email to