Why does std::print segfaults when using a string parameter?
08:51 11 Jan 2026

Consider the following code:

#include 

int main() {
    std::println("hello from {}", "me");
    return 0;
}

On x86-64 this outputs hello from me. But on ARM64 it segfaults.

ASM generation compiler returned: 0
Execution build compiler returned: 0
Program returned: 135
Program terminated with signal: SIGBUS

If I make the string parameter permanent by putting it in a constexpr, the same error happens:

#include 

int main() {
    static constexpr auto name = "me";
    std::println("hello from {}", name);
    return 0;
}

I'm using ARM64 gcc trunk with --std=c++23. The godbolt link to reproduce is here: https://godbolt.org/z/ss7xq87rG

How do I pass strings as parameters to the std::print function without errors? Is this some sort of undefined behavior, or is it a bug in this particular compiler?

c++ printing c++23