public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class
@ 2020-10-11 19:58 public at enkore dot de
2020-10-11 20:00 ` [Bug c++/97372] " public at enkore dot de
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: public at enkore dot de @ 2020-10-11 19:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Bug ID: 97372
Summary: Segmentation fault using Tracy 0.7.3 in template class
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: public at enkore dot de
Target Milestone: ---
Full reproducer attached:
$ g++ gcc_segfault_repro.ii
gcc_segfault_repro.cpp: In instantiation of ‘ThreadTask2<T>::ThreadTask2()
[with T = int]’:
gcc_segfault_repro.cpp:15:22: required from here
gcc_segfault_repro.cpp:7:135: internal compiler error: Segmentation fault
7 | TracyLockable(std::mutex, _state_mutex);
|
^
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.2.0 (GCC)
Offending code looks like this (using Tracy from
https://github.com/wolfpld/tracy):
#include <mutex>
#include <Tracy.hpp>
template<typename T>
class ThreadTask2 {
TracyLockable(std::mutex, _state_mutex);
public:
ThreadTask2() {
}
};
void x() {
ThreadTask2<int> foo;
}
When the template is removed from ThreadTask2, GCC stops segfaulting. In the
actual codebase GCC points out a slightly more specific source location, but
this may be an artifact and unrelated to the bug itself:
Tracy.hpp:141:159: internal compiler error: Segmentation fault
141 | #define TracyLockable( type, varname ) tracy::Lockable<type> varname {
[] () -> const tracy::SourceLocationData* { static constexpr
tracy::SourceLocationData srcloc { nullptr, #type " " #varname, __FILE__,
__LINE__, 0 }; return &srcloc; }() };
|
^~~~~~
common.h:76:13: note: in expansion of macro ‘TracyLockable’
76 | mutable TracyLockable(std::mutex, _state_mutex);
|
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] Segmentation fault using Tracy 0.7.3 in template class
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
@ 2020-10-11 20:00 ` public at enkore dot de
2020-10-11 20:16 ` public at enkore dot de
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: public at enkore dot de @ 2020-10-11 20:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
--- Comment #1 from marian <public at enkore dot de> ---
Created attachment 49342
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49342&action=edit
pre-processed reproducer
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] Segmentation fault using Tracy 0.7.3 in template class
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
2020-10-11 20:00 ` [Bug c++/97372] " public at enkore dot de
@ 2020-10-11 20:16 ` public at enkore dot de
2020-10-11 20:25 ` public at enkore dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: public at enkore dot de @ 2020-10-11 20:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
--- Comment #2 from marian <public at enkore dot de> ---
Created attachment 49343
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49343&action=edit
CVise reduced reproducer (possibly a different bug)
Attached testcase.ii was produced with CVise from the original reproducer. It
also triggers an ICE, but I suspect it's an entirely different ICE (testcase.ii
is not even syntactically valid C++):
testcase.ii:2:24: internal compiler error: in splice_late_return_type, at
cp/pt.c:29152
2 | template <class b[]()->a
| ^
$ cat testcase.ii
struct a;
template <class b[]()->a
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] Segmentation fault using Tracy 0.7.3 in template class
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
2020-10-11 20:00 ` [Bug c++/97372] " public at enkore dot de
2020-10-11 20:16 ` public at enkore dot de
@ 2020-10-11 20:25 ` public at enkore dot de
2020-10-11 20:30 ` public at enkore dot de
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: public at enkore dot de @ 2020-10-11 20:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
--- Comment #3 from marian <public at enkore dot de> ---
Created attachment 49344
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49344&action=edit
CVise differently reduced reproducer (possibly a different bug as well)
Attached automatically reduced reproducer does retain more of the structure of
the original test case, but also strikes me as suspiciously invalid C++, so
probably is another bug still.
$ g++ testcase_proper.ii
testcase_proper.ii: In instantiation of ‘a< <template-parameter-1-1> >::a()
[with <template-parameter-1-1> = int]’:
testcase_proper.ii:6:19: required from here
testcase_proper.ii:2:25: internal compiler error: Segmentation fault
2 | int b{[] { static int c; }};
| ^
$ cat testcase_proper.ii
template <typename> class a {
int b{[] { static int c; }};
public:
a() {}
};
void d() { a<int> e; }
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] Segmentation fault using Tracy 0.7.3 in template class
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (2 preceding siblings ...)
2020-10-11 20:25 ` public at enkore dot de
@ 2020-10-11 20:30 ` public at enkore dot de
2020-10-12 6:35 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: public at enkore dot de @ 2020-10-11 20:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
--- Comment #4 from marian <public at enkore dot de> ---
Running gcc under valgrind with the original testcase produces some interesting
output. These binaries of course barely have any symbols at all, but it might
at least provide a hint:
==882380== Invalid read of size 2
==882380== at 0x75DCA1: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x2: ???
==882380== by 0x771307: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x76F4CD: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x76D86E: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x76CFBD: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x76CFBD: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x77206F: tsubst_lambda_expr(tree_node*, tree_node*, int,
tree_node*) (in /usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x7748C3: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x773684: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x774CA4: ??? (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== by 0x6E8EE9: get_nsdmi(tree_node*, bool, int) (in
/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/cc1plus)
==882380== Address 0x0 is not stack'd, malloc'd or (recently) free'd
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] Segmentation fault using Tracy 0.7.3 in template class
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (3 preceding siblings ...)
2020-10-11 20:30 ` public at enkore dot de
@ 2020-10-12 6:35 ` rguenth at gcc dot gnu.org
2020-10-12 7:40 ` [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b marxin at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 6:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-10-12
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Known to fail| |10.2.1, 11.0, 9.3.1
Ever confirmed|0 |1
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed with the reduced testcase.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (4 preceding siblings ...)
2020-10-12 6:35 ` rguenth at gcc dot gnu.org
@ 2020-10-12 7:40 ` marxin at gcc dot gnu.org
2020-10-16 12:19 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-12 7:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Segmentation fault using |[8/9/10/11 Regression] ICE
|Tracy 0.7.3 in template |in Tracy 0.7.3 in template
|class |class since
| |r8-2836-gb54d4018b17c8e7b
CC| |jason at gcc dot gnu.org,
| |marxin at gcc dot gnu.org
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
I'm woried that both reduced code snippets are an invalid code (at least clang
rejects that).
I reduced that to a valid test-case:
$ cat gcc_segfault_repro.ii
class Lockable {
public:
Lockable(int *);
};
template <typename> class ThreadTask2 {
Lockable _state_mutex{[]() -> int * { static int srcloc; return 0; }()};
public:
ThreadTask2() {}
};
void x() { ThreadTask2<int> foo; }
$ g++ gcc_segfault_repro.ii -c
gcc_segfault_repro.ii: In instantiation of ‘ThreadTask2<
<template-parameter-1-1> >::ThreadTask2() [with <template-parameter-1-1> =
int]’:
gcc_segfault_repro.ii:10:29: required from here
gcc_segfault_repro.ii:6:52: internal compiler error: Segmentation fault
6 | Lockable _state_mutex{[]() -> int * { static int srcloc; return 0;
}()};
| ^~~~~~
0x10107ff crash_signal
/home/marxin/Programming/gcc/gcc/toplev.c:330
0x7ffff788e6bf ???
/usr/src/debug/glibc-2.32-1.1.x86_64/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0xa29374 most_general_template(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.c:24621
0xa297a7 enclosing_instantiation_of
/home/marxin/Programming/gcc/gcc/cp/pt.c:14264
0xa43cf7 tsubst_decl
/home/marxin/Programming/gcc/gcc/cp/pt.c:14632
0xa4a54a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18086
0xa483de tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:17992
0xa479d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18309
0xa479d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18309
0xa72876 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:17977
0xa72876 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
/home/marxin/Programming/gcc/gcc/cp/pt.c:19259
0xa3d423 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:20593
0xa3bcfc tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:19925
0xa3b0eb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:20456
0x998191 get_nsdmi(tree_node*, bool, int)
/home/marxin/Programming/gcc/gcc/cp/init.c:605
0x999381 perform_member_init
/home/marxin/Programming/gcc/gcc/cp/init.c:772
0x999381 emit_mem_initializers(tree_node*)
/home/marxin/Programming/gcc/gcc/cp/init.c:1388
0xa4973c tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:17997
0xa479d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:18309
0xa4eca6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
/home/marxin/Programming/gcc/gcc/cp/pt.c:17977
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Started with r8-2836-gb54d4018b17c8e7b.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (5 preceding siblings ...)
2020-10-12 7:40 ` [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b marxin at gcc dot gnu.org
@ 2020-10-16 12:19 ` rguenth at gcc dot gnu.org
2021-01-14 9:24 ` rguenth at gcc dot gnu.org
2021-03-12 0:37 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-16 12:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |8.5
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (6 preceding siblings ...)
2020-10-16 12:19 ` rguenth at gcc dot gnu.org
@ 2021-01-14 9:24 ` rguenth at gcc dot gnu.org
2021-03-12 0:37 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-01-14 9:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
` (7 preceding siblings ...)
2021-01-14 9:24 ` rguenth at gcc dot gnu.org
@ 2021-03-12 0:37 ` mpolacek at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-12 0:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97372
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|NEW |RESOLVED
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Dup.
*** This bug has been marked as a duplicate of bug 95870 ***
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-03-12 0:37 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-11 19:58 [Bug c++/97372] New: Segmentation fault using Tracy 0.7.3 in template class public at enkore dot de
2020-10-11 20:00 ` [Bug c++/97372] " public at enkore dot de
2020-10-11 20:16 ` public at enkore dot de
2020-10-11 20:25 ` public at enkore dot de
2020-10-11 20:30 ` public at enkore dot de
2020-10-12 6:35 ` rguenth at gcc dot gnu.org
2020-10-12 7:40 ` [Bug c++/97372] [8/9/10/11 Regression] ICE in Tracy 0.7.3 in template class since r8-2836-gb54d4018b17c8e7b marxin at gcc dot gnu.org
2020-10-16 12:19 ` rguenth at gcc dot gnu.org
2021-01-14 9:24 ` rguenth at gcc dot gnu.org
2021-03-12 0:37 ` mpolacek 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).