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

            Bug ID: 105446
           Summary: [modules] Partitions: Segfault
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: deco33000 at yandex dot com
  Target Milestone: ---

Hi,
I have a segfault at runtime with no compilation issue, even without calling
the function in the partition:

-----------
mod.cxx:

module;

#include <iostream>
#include <string_view>
#include <string>
export module hello;
export import :sub_mod;

namespace X {

        inline unsigned gv = 52;

        void greeter2 ( std::string_view const &name ){
                std::string h = "non exported greeter";


                std::cout << "Bye" << name << "!" << h << "\n";

               // Y::g();
        }

}

export {

        namespace X {

                void greeter ( std::string_view const &name ){
                        std::string h = "exported greeter";

                        std::cout << "Hello " << name << "!" << h << "\n";

                        greeter2("greet2");
                }

        }
}

-----------
mod_sub.cxx:
module;

#include <iostream>
export module hello:sub_mod;

namespace Y {

        auto g (){

                std::cout << "in out" << std::endl;

        }

}

-----------
main.cpp
import hello;

int main ( void ){

        X::greeter( "world" );

        return 0;
}
-----------
compilation:
/path/custom/g++ g++ -std=gnu++20 -fmodules-ts mod_sub.cxx mod.cxx main.cpp

Result: Segfault at runtime. 

Thanks,

Reply via email to