https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107418

            Bug ID: 107418
           Summary: lto-dump -gimple-stats Segmentation Fault
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: volker.weissmann at gmx dot de
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I don't understand what -gimple-stats does, but I don't think it should
segfault:

$ g++ bug.cpp -c -flto && lto-dump bug.o -gimple-stats
during IPA pass: modref
lto-dump: internal compiler error: Segmentation fault
0x1788bc4 internal_error(char const*, ...)
        ???:0
0x6e8ba3 cgraph_node::get_untransformed_body()
        ???:0
0x67ebd7 lto_main()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://bugs.archlinux.org/> for instructions.

bug.cpp:
class MyClass  {
  public:
  MyClass(){}
};
void func() {
  new MyClass();
}

I used the gcc from the Archlinux repository:
$ g++ -v                                                                        
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--with-build-config=bootstrap-lto --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-libstdcxx-backtrace --enable-link-serialization=1
--enable-linker-build-id --enable-lto --enable-multilib --enable-plugin
--enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC) 

If I build gcc myself, I get a backtrace with line numbers:
$ g++ bug.cpp -c -flto && lto-dump bug.o -gimple-stats                          
/home/volker/Documents/localgcc/../gcc/gcc/cgraph.cc:4001:23: runtime error:
member access within null pointer of type 'struct lto_in_decl_state'
during IPA pass: modref
lto-dump: internal compiler error: Segmentation fault
0x2e693dd crash_signal
        /home/volker/Documents/localgcc/../gcc/gcc/toplev.cc:314
0x10203df cgraph_node::get_untransformed_body()
        /home/volker/Documents/localgcc/../gcc/gcc/cgraph.cc:4001
0xbd1cee lto_main()
        /home/volker/Documents/localgcc/../gcc/gcc/lto/lto-dump.cc:350
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Self-build-gcc:
$ g++ -v                                                                        
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/volker/Documents/myroot/libexec/gcc/x86_64-pc-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /home/volker/Documents/localgcc/../gcc/configure
--enable-checking --disable-bootstrap --prefix=/home/volker/Documents/myroot
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.0.0 20221023 (experimental) (GCC)

Reply via email to