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

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).