public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/115359] New: ICE in warn_types_mismatch: lto1: internal compiler error: Segmentation fault
@ 2024-06-05 14:46 a.horodniceanu at proton dot me
2024-06-06 6:35 ` [Bug lto/115359] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: a.horodniceanu at proton dot me @ 2024-06-05 14:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115359
Bug ID: 115359
Summary: ICE in warn_types_mismatch: lto1: internal compiler
error: Segmentation fault
Product: gcc
Version: 14.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: a.horodniceanu at proton dot me
Target Milestone: ---
Given the two source files:
a.cpp:
-----
struct Foo { };
void bar(Foo foo);
int main() {
bar({});
}
----
a.d:
----
extern(C++):
struct Foo { }
void bar(Foo foo) { }
----
Compile them with: `g++ a.d a.cpp -flto -freport-bug`:
----
a.cpp:2:6: warning: ‘bar’ violates the C++ One Definition Rule [-Wodr]
2 | void bar(Foo foo);
| ^
a.d:3:6: note: type mismatch in parameter 1
3 | void bar(Foo foo) { }
| ^
lto1: internal compiler error: Segmentation fault
0x5654dba30e94 internal_error(char const*, ...)
???:0
0x5654dbaccbd1 xstrdup
???:0
0x5654da59f465 warn_types_mismatch(tree_node*, tree_node*, unsigned int,
unsigned int)
???:0
0x5654da30d1e1 lto_symtab_merge_decls()
???:0
0x5654da3154a2 read_cgraph_and_symbols(unsigned int, char const**)
???:0
0x5654da2fdce6 lto_main()
???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld:
error: lto-wrapper failed
collect2: error: ld returned 1 exit status
----
g++ --version:
----
g++ (Gentoo Hardened 14.1.1_p20240518 p1) 14.1.1 20240516
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
----
I think this can be fixed with:
----
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index a7ce434bf..efeb3766c 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -1084,7 +1084,9 @@ warn_types_mismatch (tree t1, tree t2, location_t loc1,
location_t loc2)
if (odr1 != NULL && odr2 != NULL && odr1 != odr2)
{
const int opts = DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES;
- char *name1 = xstrdup (cplus_demangle (odr1, opts));
+ char *name1 = cplus_demangle (odr1, opts);
+ if (name1)
+ name1 = xstrdup(name1);
char *name2 = cplus_demangle (odr2, opts);
if (name1 && name2 && strcmp (name1, name2))
{
----
but I'm not sure if cplus_demangle failing to demangle the D symbol is the real
problem.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug lto/115359] ICE in warn_types_mismatch: lto1: internal compiler error: Segmentation fault
2024-06-05 14:46 [Bug lto/115359] New: ICE in warn_types_mismatch: lto1: internal compiler error: Segmentation fault a.horodniceanu at proton dot me
@ 2024-06-06 6:35 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-06 6:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115359
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |hubicka at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is probably get_odr_name_for_type returning sth non-NULL for both.
But yeah, duping before copying looks wrong since we seem to expect
NULL eventually.
if (name1 = cplus_demangle (odr1, opts))
{
name1 = xstrdup (name1);
...
might be even better.
Honza?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-06 6:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-05 14:46 [Bug lto/115359] New: ICE in warn_types_mismatch: lto1: internal compiler error: Segmentation fault a.horodniceanu at proton dot me
2024-06-06 6:35 ` [Bug lto/115359] " rguenth 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).