public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111447] New: Program crashes when an include is present in global module fragment
@ 2023-09-17 19:20 adamstepniak41 at gmail dot com
2023-09-17 19:24 ` [Bug c++/111447] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: adamstepniak41 at gmail dot com @ 2023-09-17 19:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111447
Bug ID: 111447
Summary: Program crashes when an include is present in global
module fragment
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: adamstepniak41 at gmail dot com
Target Milestone: ---
animal.cpp
-----------
module;
#include <string>
export module animal;
export import :sound;
----------
animal_sound.cpp
----------
module;
#include <string> // Comment this to get rid of crash
export module animal:sound;
export std::string makeSound() {
return "Wroooarrh";
}
----------
main.cpp
----------
#include <cstdio>
import animal;
int main() {
auto s = makeSound();
printf("%s", s.c_str());
return 0;
}
----------
Program crashes when compiled with:
----------
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal_sound.cpp -c -o animal_sound.o
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal.cpp -c -o animal.o
g++ -fmodules-ts -g -std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv
animal.o animal_sound.o main.cpp -o main.exe
----------
Call stack:
Program received signal SIGSEGV, Segmentation fault.
0x000055555555667c in std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_M_data (this=0x8fa71c45df267600) at
/usr/include/c++/13/bits/basic_string.h:223
223 { return _M_dataplus._M_p; }
(gdb) bt
#0 0x000055555555667c in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::_M_data (this=0x0) at
/usr/include/c++/13/bits/basic_string.h:223
#1 0x0000555555556ef4 in std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >::c_str (this=0x7fffffffda60) at
/usr/include/c++/13/bits/basic_string.h:2584
#2 0x0000555555556e60 in main () at main.cpp:7
Compiler version:
g++ --version
g++ (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-17 19:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-17 19:20 [Bug c++/111447] New: Program crashes when an include is present in global module fragment adamstepniak41 at gmail dot com
2023-09-17 19:24 ` [Bug c++/111447] " pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).