public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nerixdev at outlook dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/114501] New: ICE during modref with LTO
Date: Wed, 27 Mar 2024 20:55:31 +0000	[thread overview]
Message-ID: <bug-114501-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 114501
           Summary: ICE during modref with LTO
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nerixdev at outlook dot de
  Target Milestone: ---

Created attachment 57822
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57822&action=edit
Preprocessed source

The following C++ 20 code causes an ICE when compiled with -flto:

#include <string_view>
#include <array>

inline constexpr auto make_it()
{
    constexpr std::string_view view{"", 0};
    std::array<char, 1> arr;
    arr[view.size()] = 'a'; // using 0 here won't cause an ICE
    return arr;
}

inline constexpr auto foo = make_it();
auto bar = foo;

---

The same bug happens from GCC 10 to the current version listed as (trunc) on
compiler-explorer: https://godbolt.org/z/xve6h5qhh. I'm using GCC 13.2.0 below.

I've included the .ii file as the attachment.

The code was compiled with g++ -std=c++20 foo.cpp -o foo.o -c -flto.
Output of gcc -v -save-temps <all-your-options> <source-file>:

Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-linux-gnu
Configured with: /usr/src/gcc/configure --build=x86_64-linux-gnu
--disable-multilib --enable-languages=c,c++,fortran,go
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.2.0 (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-c' '-flto' '-freport-bug'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-linux-gnu/13.2.0/cc1plus -E -quiet -v
-imultiarch x86_64-linux-gnu -D_GNU_SOURCE foo.cpp -mtune=generic -march=x86-64
-std=c++20 -flto -freport-bug -fpch-preprocess -o foo.ii
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/include-fixed/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0

/usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/x86_64-linux-gnu

/usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/../../../../include/c++/13.2.0/backward
 /usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/include
 /usr/local/include
 /usr/local/lib/gcc/x86_64-linux-gnu/13.2.0/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++20' '-c' '-flto' '-freport-bug'
'-mtune=generic' '-march=x86-64'
 /usr/local/libexec/gcc/x86_64-linux-gnu/13.2.0/cc1plus -fpreprocessed foo.ii
-quiet -dumpbase foo.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64
-std=c++20 -version -flto -freport-bug -o foo.s
GNU C++20 (GCC) version 13.2.0 (x86_64-linux-gnu)
        compiled by GNU C version 13.2.0, GMP version 6.2.1, MPFR version
4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 4919020133b793ebcf160ec1288a96cd
during IPA pass: modref
foo.cpp:13:15: internal compiler error: in streamer_write_chain, at
tree-streamer-out.cc:543
   13 | auto bar = foo;
      |               ^
0x1c989f6 internal_error(char const*, ...)
        ???:0
0x75eba6 fancy_abort(char const*, int, char const*)
        ???:0
0x106eece streamer_write_tree_body(output_block*, tree_node*)
        ???:0
0xd18d4d DFS::DFS(output_block*, tree_node*, bool, bool, bool)
        ???:0
0xd1a1f9 lto_output_tree(output_block*, tree_node*, bool, bool)
        ???:0
0xd1cc43 produce_asm_for_decls()
        ???:0
0xd9c852 ipa_write_summaries()
        ???:0
0xa67be7 symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
The bug is not reproducible, so it is likely a hardware or OS problem.

             reply	other threads:[~2024-03-27 20:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 20:55 nerixdev at outlook dot de [this message]
2024-03-28  1:55 ` [Bug ipa/114501] " pinskia at gcc dot gnu.org
2024-03-28  2:29 ` pinskia at gcc dot gnu.org
2024-03-28  2:56 ` pinskia at gcc dot gnu.org
2024-03-28  2:58 ` [Bug ipa/114501] [11/12/13/14 Regression] " pinskia at gcc dot gnu.org
2024-03-28  3:03 ` pinskia at gcc dot gnu.org
2024-03-28  3:05 ` pinskia at gcc dot gnu.org
2024-03-28  8:06 ` rguenth at gcc dot gnu.org
2024-03-29 23:48 ` law at gcc dot gnu.org
2024-04-08  9:44 ` sjames at gcc dot gnu.org
2024-04-08  9:50 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-114501-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).