public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113708] New: [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module
@ 2024-02-01 18:00 ppalka at gcc dot gnu.org
2024-02-14 19:08 ` [Bug c++/113708] " cvs-commit at gcc dot gnu.org
2024-02-14 19:09 ` nshead at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-02-01 18:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113708
Bug ID: 113708
Summary: [modules] ICE in import_export_decl with non-trivially
initialized inline variable in header module
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ppalka at gcc dot gnu.org
Target Milestone: ---
$ cat header.H
inline int f() { return 42; }
inline int a = f();
$ cat testcase.C
import "header.H";
int main() {
a;
}
$ g++ -fmodules-ts header.H testcase.C
testcase.C:5:1: internal compiler error: in import_export_decl, at
cp/decl2.cc:3385
5 | }
| ^
Doesn't seem to be a regression.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/113708] [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module
2024-02-01 18:00 [Bug c++/113708] New: [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module ppalka at gcc dot gnu.org
@ 2024-02-14 19:08 ` cvs-commit at gcc dot gnu.org
2024-02-14 19:09 ` nshead at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-14 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113708
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:
https://gcc.gnu.org/g:dd9d14f7d53de07beff06004922a2bff20ece671
commit r14-8987-gdd9d14f7d53de07beff06004922a2bff20ece671
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date: Wed Feb 14 12:26:03 2024 +1100
c++: Defer emitting inline variables [PR113708]
Inline variables are vague-linkage, and may or may not need to be
emitted in any TU that they are part of, similarly to e.g. template
instantiations.
Currently 'import_export_decl' assumes that inline variables have
already been emitted when it comes to end-of-TU processing, and so
crashes when importing non-trivially-initialised variables from a
module, as they have not yet been finalised.
This patch fixes this by ensuring that inline variables are always
deferred till end-of-TU processing, unifying the behaviour for module
and non-module code.
PR c++/113708
gcc/cp/ChangeLog:
* decl.cc (make_rtl_for_nonlocal_decl): Defer inline variables.
* decl2.cc (import_export_decl): Support inline variables.
gcc/testsuite/ChangeLog:
* g++.dg/debug/dwarf2/inline-var-1.C: Reference 'a' to ensure it
is emitted.
* g++.dg/debug/dwarf2/inline-var-3.C: Likewise.
* g++.dg/modules/init-7_a.H: New test.
* g++.dg/modules/init-7_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/113708] [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module
2024-02-01 18:00 [Bug c++/113708] New: [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module ppalka at gcc dot gnu.org
2024-02-14 19:08 ` [Bug c++/113708] " cvs-commit at gcc dot gnu.org
@ 2024-02-14 19:09 ` nshead at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: nshead at gcc dot gnu.org @ 2024-02-14 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113708
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
CC| |nshead at gcc dot gnu.org
Target Milestone|--- |14.0
Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org
--- Comment #2 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Fixed for GCC 14.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-14 19:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 18:00 [Bug c++/113708] New: [modules] ICE in import_export_decl with non-trivially initialized inline variable in header module ppalka at gcc dot gnu.org
2024-02-14 19:08 ` [Bug c++/113708] " cvs-commit at gcc dot gnu.org
2024-02-14 19:09 ` nshead 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).