public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/106334] New: [13 Regression] lto -g ICE in dwarf2out_register_external_die at dwarf2out.cc:6072
@ 2022-07-17 17:34 slyfox at gcc dot gnu.org
  2022-07-17 18:48 ` [Bug lto/106334] " pinskia at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-07-17 17:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106334
           Summary: [13 Regression] lto -g ICE in
                    dwarf2out_register_external_die at dwarf2out.cc:6072
           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
  Target Milestone: ---

Noticed ICE on nix-2.10.3 project. It started using LTO recently.

I extracted something that looks like a reproducer, needs 3 files:

// $ cat eval.hh
void listElems();

namespace nix {
struct Value {

  auto listItems() {
    struct ListIterable {
      typedef int* iterator;
      iterator begin() __attribute__((noipa)) { return 0; }
      iterator end() __attribute__((noipa)) { return 0; }
    };
    listElems();
    return ListIterable{};
  }
};
}

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

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

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

struct iterator {
  bool operator!=(iterator);
  void operator++();
  int operator*() { return 0; }
};
template <typename T> auto enumerate(T) {
  struct iterable_wrapper {
    auto begin() { return iterator{}; }
    auto end() { return iterator{}; }
  };
  return iterable_wrapper{};
}
void EvalStatecoerceToString(nix::Value & v) {
  for (auto v : enumerate(v.listItems()))
    ;
}

Triggering the crash:

$ g++ -Werror=return-type -O1 -flto -fPIC -g -I. -o eval-cache.o -c
eval-cache.cc
$ g++ -Werror=return-type -O1 -flto -fPIC -g -I. -o eval.o -c eval.cc
$ g++ -Werror=return-type -O1 -flto -fPIC -g -I. -o libnixexpr.so -shared
eval-cache.o eval.o
lto1: internal compiler error: in dwarf2out_register_external_die, at
dwarf2out.cc:6072
0xa059db dwarf2out_register_external_die
        ../../gcc-13-20220710/gcc/dwarf2out.cc:6072
0x903d0d lto_read_decls
        ../../gcc-13-20220710/gcc/lto/lto-common.cc:1952
0x904a7a lto_file_finalize
        ../../gcc-13-20220710/gcc/lto/lto-common.cc:2271
0x904a7a lto_create_files_from_ids
        ../../gcc-13-20220710/gcc/lto/lto-common.cc:2281
0x904a7a lto_file_read
        ../../gcc-13-20220710/gcc/lto/lto-common.cc:2336
0x904a7a read_cgraph_and_symbols(unsigned int, char const**)
        ../../gcc-13-20220710/gcc/lto/lto-common.cc:2784
0x8eca42 lto_main()
        ../../gcc-13-20220710/gcc/lto/lto.cc:626

Using '-g0' makes the file compile.

Compiler is this week's gcc-13 snapshot:

$ g++ -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-debug-13.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-debug-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 20220710 (experimental) (GCC)

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

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

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-17 17:34 [Bug lto/106334] New: [13 Regression] lto -g ICE in dwarf2out_register_external_die at dwarf2out.cc:6072 slyfox at gcc dot gnu.org
2022-07-17 18:48 ` [Bug lto/106334] " pinskia at gcc dot gnu.org
2022-07-18  8:26 ` rguenth at gcc dot gnu.org
2022-07-18  9:02 ` marxin at gcc dot gnu.org
2022-07-19  9:17 ` cvs-commit at gcc dot gnu.org
2022-07-19  9:18 ` rguenth at gcc dot gnu.org
2022-07-31  7:36 ` slyfox at gcc dot gnu.org
2022-08-01  8:05 ` rguenth at gcc dot gnu.org
2022-08-02  6:35 ` cvs-commit at gcc dot gnu.org
2022-08-02  6:36 ` rguenth at gcc dot gnu.org
2022-08-08  9:13 ` cvs-commit at gcc dot gnu.org
2022-08-10 14:30 ` cvs-commit at gcc dot gnu.org
2022-10-11 13:04 ` cvs-commit at gcc dot gnu.org
2022-10-14 10:47 ` cvs-commit 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).