public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104202] New: when defining a std::string in a module implementation file using -O2 g++ segfaults
@ 2022-01-24 10:57 f.b.brokken at rug dot nl
2024-03-06 22:08 ` [Bug c++/104202] " ppalka at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: f.b.brokken at rug dot nl @ 2022-01-24 10:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104202
Bug ID: 104202
Summary: when defining a std::string in a module implementation
file using -O2 g++ segfaults
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: f.b.brokken at rug dot nl
Target Milestone: ---
Created attachment 52274
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52274&action=edit
Output of the compiler (segfaults) when compiling 'mod.cc'
Using the following main file (main.cc):
---------------------------------
#include <iostream>
import mod;
int main()
{
std::cout << modstr << '\n';
}
---------------------------------
defining the module mod interface in a separate file (zfirst.cc):
---------------------------------
module;
#include <string>
export module mod;
export extern std::string modstr;
---------------------------------
and initializing modstr in a separate module implementation file (mod.cc):
-------------------------------
module;
#include <string>
module mod;
std::string modstr{ "hello" };
-------------------------------
compiles OK when using the following compiler options:
--std=c++20 -Wall -Wextra -fno-strict-aliasing -fwrapv -fmodules-ts
but when adding the option -O2 the compiler segfaults (compiler output is
attached). Omitting the -Wextra -fno-strict-aliasing -fwrapv options makes no
difference.
The compilation was performed on a (yesterday) updated Debian testing
distribution using
g++ (Debian 12-20211217-1) 12.0.0 20211217 (experimental) [master
r12-6027-g774269aa4b9]
Copyright (C) 2021 Free Software Foundation, Inc.
If you need any additional information, please let me know.
Kind regards,
Frank.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/104202] when defining a std::string in a module implementation file using -O2 g++ segfaults
2022-01-24 10:57 [Bug c++/104202] New: when defining a std::string in a module implementation file using -O2 g++ segfaults f.b.brokken at rug dot nl
@ 2024-03-06 22:08 ` ppalka at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-03-06 22:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104202
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
CC| |ppalka at gcc dot gnu.org
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This seems fixed for GCC 14 since the fix for PR112588 I suspect.
*** This bug has been marked as a duplicate of bug 112588 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-06 22:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-24 10:57 [Bug c++/104202] New: when defining a std::string in a module implementation file using -O2 g++ segfaults f.b.brokken at rug dot nl
2024-03-06 22:08 ` [Bug c++/104202] " ppalka 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).