https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123813
Bug ID: 123813
Summary: Terminate being called when using -mcmodel=large flag
with MSYS2
Product: gcc
Version: 15.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jlame646 at gmail dot com
Target Milestone: ---
Consider the following program which works correctly without the
`-mcmodel=large` flag.
```
#include <iostream>
#include <exception>
#include <stdexcept>
int main()
{
std::cout << "HW\n";
try {
std::cout << "Block\n";
throw std::runtime_error("Point 1");
std::cout << "Block Done\n";
}
catch (std::exception const& e) {
std::cout << "E: " << e.what() << "\n";
}
catch (...) {
std::cout << "E: Unknown\n";
}
std::cout << "Done\n";
}
```
As expected the output of the above program with the `-mcmodel=large` flag is:
```
> g++ main.cpp
> # ./a.exe
HW
Block
E: Point 1
Done
```
But when `-mcmodel=large` flag is used the output is changed to:
```
> g++ -mcmodel=large main.cpp
> ./a.exe
HW
Block
terminate called after throwing an instance of 'std::runtime_error'
what(): Point 1
```
Any way to fix this given that I have installed the following packages:
```
autoconf
automake
make
git
gperf
coreutils
vim
mingw-w64-x86_64-jq
mingw-w64-x86_64-gcc
mingw-w64-x86_64-gdb
mingw-w64-x86_64-libyaml
mingw-w64-x86_64-dlfcn
mingw-w64-x86_64-snappy
mingw-w64-x86_64-libevent
mingw-w64-x86_64-boost
cmake
ninja
```