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

            Bug ID: 103133
           Summary: Binary built with -static using std::thread crashes
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: loximann at gmail dot com
  Target Milestone: ---

The following program crashes when built with -static on Fedora 35:

    #include <thread>

    int main(int argc, char *argv[])
    {
        std::thread foo{[](){}};
        foo.join();

        return 0;
    }

Dynamic linking works fine though:

    $ g++ f35_thread_static_broken.cpp
    $ ./a.out 
    $ g++ -static f35_thread_static_broken.cpp
    $ ./a.out
    zsh: segmentation fault (core dumped)  ./a.out

Reply via email to