public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/106540] New: [13 Regression] lto -g ICE in dwarf2out_register_external_die at dwarf2out.cc:6076
@ 2022-08-05 17:53 slyfox at gcc dot gnu.org
  2022-08-08  6:49 ` [Bug lto/106540] " rguenth at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-08-05 17:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106540
           Summary: [13 Regression] lto -g ICE in
                    dwarf2out_register_external_die at dwarf2out.cc:6076
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org, rguenth at gcc dot gnu.org
  Target Milestone: ---

It's a very similar form of https://gcc.gnu.org/PR106334 where nix-2.10.3
package enabled -flto recently and started ICEing gcc.

This time I got the following 3-file reproducer:

  // $ cat eval.hh
    struct Value {
      auto listItems() {
        struct ListIterable {
          typedef int *iterator;
          iterator _begin, _end;
          iterator begin() { return _begin; }
          iterator end() { return _end; }
        };
        return ListIterable{};
      }
    };

  // $ cat eval-cache.cc
    #include "eval.hh"

    void AttrCursorgetListOfStrings(Value & v) {
      for (auto elem : v.listItems())
        ;
    }

  // $ cat eval.cc
    #include "eval.hh"
    template <typename T> auto enumerate(T) {
      struct iterator {
        int iter;
        bool operator!=(iterator) { return iter; }
        void operator++() {}
        auto operator*() { return 0; }
      };
      struct iterable_wrapper {
        auto begin() { return iterator{}; }
        auto end() { return iterator{}; }
      };
      return iterable_wrapper{};
    }
    void coerceToString(Value & v) {
      for (auto elem : enumerate(v.listItems()))
        ;
    }

Crashing:

$ g++ -O0 -flto -flto-partition=none -g1 -fPIC -I. -Wall -o eval.o -c eval.cc
eval.cc: In function 'void coerceToString(Value&)':
eval.cc:16:13: warning: unused variable 'elem' [-Wunused-variable]
   16 |   for (auto elem : enumerate(v.listItems()))
      |             ^~~~

$ g++ -O0 -flto -flto-partition=none -g1 -fPIC -I. -Wall -o eval-cache.o -c
eval-cache.cc
eval-cache.cc: In function 'void AttrCursorgetListOfStrings(Value&)':
eval-cache.cc:4:13: warning: unused variable 'elem' [-Wunused-variable]
    4 |   for (auto elem : v.listItems())
      |             ^~~~

$ g++ -O0 -flto -flto-partition=none -g1 -fPIC -I. -Wall -o libbug.so -shared
eval-cache.o eval.o

lto1: internal compiler error: in dwarf2out_register_external_die, at
dwarf2out.cc:6076
0xa093ff dwarf2out_register_external_die
        ../../gcc-13-20220731/gcc/dwarf2out.cc:6076
0x90743d lto_read_decls
        ../../gcc-13-20220731/gcc/lto/lto-common.cc:1952
0x908193 lto_file_finalize
        ../../gcc-13-20220731/gcc/lto/lto-common.cc:2271
0x908193 lto_create_files_from_ids
        ../../gcc-13-20220731/gcc/lto/lto-common.cc:2281
0x908193 lto_file_read
        ../../gcc-13-20220731/gcc/lto/lto-common.cc:2336
0x908193 read_cgraph_and_symbols(unsigned int, char const**)
        ../../gcc-13-20220731/gcc/lto/lto-common.cc:2784
0x8f0132 lto_main()
        ../../gcc-13-20220731/gcc/lto/lto.cc:626
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.

It is a this week's gcc with
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=bc7526f6fca0e6ac3bd462ae54170fa464539148
applied.

$ g++ -v |& unnix
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-13.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20220731 (experimental) (GCC)

I suspect this crash has something to do with auto-inferred types that are
defined within a function.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-10-14 10:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 17:53 [Bug lto/106540] New: [13 Regression] lto -g ICE in dwarf2out_register_external_die at dwarf2out.cc:6076 slyfox at gcc dot gnu.org
2022-08-08  6:49 ` [Bug lto/106540] " rguenth at gcc dot gnu.org
2022-08-08  7:53 ` rguenth at gcc dot gnu.org
2022-08-08  8:08 ` rguenth at gcc dot gnu.org
2022-08-08  9:13 ` cvs-commit at gcc dot gnu.org
2022-08-08  9:14 ` [Bug lto/106540] [10/11/12 " rguenth at gcc dot gnu.org
2022-08-10 14:30 ` cvs-commit at gcc dot gnu.org
2022-10-11 13:04 ` [Bug lto/106540] [10/11 " cvs-commit at gcc dot gnu.org
2022-10-14 10:47 ` [Bug lto/106540] [10 " cvs-commit at gcc dot gnu.org
2022-10-14 10:49 ` 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).