C++ iostreams cause a segmentation fault Inserting into std::cout or std::cerr causes a segmentation fault. The following program segfaults when compiled for x86_64 using either gcc 12.1.0 or clang 13.0.1 and run under box64 on both AArch64 and x86_64: ``` #include int main(int argc, char* argv[]) { std::cout << "broken\n"; return 0; } ``` ``` 6407|SIGSEGV @0x64941284 (???(box64+0x64941284)) (x64pc=0x7feadb4a05fe/libstdc++.so.6:"libstdc++.so.6/_ZNSo6sentryC2ERSo + 30", rsp=0x7feadad7c450), for accessing 0xffffffffffffffe8 (code=1) ``` Comparing the trace with native execution, it appears that at the time of the segfault, RSI contains the address of std::cout, but there are two addresses at std::cout when executed natively and a bunch of zeroes at std::cout under box64, so RAX gets loaded with a null pointer. printf does not suffer from this issue.