public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/97565] New: -flto -ipa-pta ICE: at cgraph_node::get_untransformed_body()
Date: Sat, 24 Oct 2020 19:26:40 +0000	[thread overview]
Message-ID: <bug-97565-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 97565
           Summary: -flto -ipa-pta ICE: at
                    cgraph_node::get_untransformed_body()
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

This is a forward of https://bugs.gentoo.org/750473 ICE where
spidermonkey-78.4.0 fails when built with -O1 flto -fipa-pta.

Here is the "minimal" 2-file reproducer:

  // cat abort.cpp
  extern "C" void abort(void) {
    abort();
  }

  // cat main.cpp
  extern "C" void abort(void);

  int main(int argc, char * argv[]) {
    abort();
  }

To crash it reliably on a small example I had to for LTO partitions to smallest
sizes:

$ x86_64-pc-linux-gnu-g++ -o abort.o -flto -O1 -fipa-pta
--param=lto-min-partition=1 -flto-partition=max -c abort.cpp
$ x86_64-pc-linux-gnu-g++ -o main.o -flto -O1 -fipa-pta
--param=lto-min-partition=1 -flto-partition=max -c main.cpp
$ x86_64-pc-linux-gnu-g++ -o o -flto -O1 -fipa-pta --param=lto-min-partition=1
-flto-partition=max main.o abort.o

during IPA pass: pta
lto1: internal compiler error: Segmentation fault
0xa798ba crash_signal
       
/usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/toplev.c:330
0x7fe1b23d4eef ???
       
/usr/src/debug/sys-libs/glibc-2.32-r2/glibc-2.32/signal/../sysdeps/unix/sysv/linux/x86_64/sigaction.c:0
0x6ab959 cgraph_node::get_untransformed_body()
       
/usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/cgraph.c:3934
0x6aba89 cgraph_node::get_body()
       
/usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/cgraph.c:3967
0xc2e433 ipa_pta_execute
       
/usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-ssa-structalias.c:8150
0xc2e433 execute
       
/usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-ssa-structalias.c:8569
Please submit a full bug report,

It does not seem to be a regression. I see the same crash on g++-6.5.0  
g++-7.5.0   g++-8.4.0   g++-9.3.0 g++-10.2.0  g++-11.0.0.

It seems to have to do with a abort() symbol type. During LTO partition it's
not consider either external or internal during partitioning:

  $ cat o.res
  2
  main.o 1
  203 af1adcfd998498c1 PREVAILING_DEF main
  abort.o 1
  201 8749e101441c301e PREVAILING_DEF_IRONLY_EXP abort

I think we expect something like 'RESOLVED_IR abort' (or some form of external
symbol?) for first 'main.o' partition.

Otherwise crash happens when attempt to use the information around the symbol:

Program received signal SIGSEGV, Segmentation fault.
0x000000000056f52a in cgraph_node::get_untransformed_body (this=0x7ffff744e2a0)
at ../../gcc/gcc/cgraph.c:3920
3920                                   decl_state->compressed);
(gdb) bt
#0  0x000000000056f52a in cgraph_node::get_untransformed_body
(this=0x7ffff744e2a0) at ../../gcc/gcc/cgraph.c:3920
#1  0x000000000056f6b8 in cgraph_node::get_body (this=0x7ffff744e2a0) at
../../gcc/gcc/cgraph.c:3951
#2  0x000000000101903a in ipa_pta_execute () at
../../gcc/gcc/tree-ssa-structalias.c:8154
#3  0x000000000101a6df in (anonymous namespace)::pass_ipa_pta::execute
(this=0x2f09810) at ../../gcc/gcc/tree-ssa-structalias.c:8573
#4  0x0000000000b346b4 in execute_one_pass (pass=0x2f09810) at
../../gcc/gcc/passes.c:2517
#5  0x0000000000b35635 in execute_ipa_pass_list (pass=0x2f09810) at
../../gcc/gcc/passes.c:2944
#6  0x0000000000582fc4 in symbol_table::compile (this=0x7ffff7646100) at
../../gcc/gcc/cgraphunit.c:2805
#7  0x000000000043ba1b in lto_main () at ../../gcc/gcc/lto/lto.c:653
#8  0x0000000000cbd763 in compile_file () at ../../gcc/gcc/toplev.c:460
#9  0x0000000000cc0b25 in do_compile () at ../../gcc/gcc/toplev.c:2321
#10 0x0000000000cc0e3e in toplev::main (this=0x7fffffffd4a6, argc=20,
argv=0x2ee3a10) at ../../gcc/gcc/toplev.c:2460
#11 0x0000000001f614e3 in main (argc=20, argv=0x7fffffffd5b8) at
../../gcc/gcc/main.c:39
(gdb) list
3915        origin = origin->clone_of;
3916
3917      int stream_order = origin->order - file_data->order_base;
3918      data = lto_get_section_data (file_data, LTO_section_function_body,
3919                                   name, stream_order, &len,
3920                                   decl_state->compressed);
3921      if (!data)
3922        fatal_error (input_location, "%s: section %s.%d is missing",
3923                     file_data->file_name, name, stream_order);
3924
(gdb) print decl_state
$1 = (lto_in_decl_state *) 0x0

             reply	other threads:[~2020-10-24 19:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 19:26 slyfox at gcc dot gnu.org [this message]
2020-10-24 20:06 ` [Bug ipa/97565] " slyfox at gcc dot gnu.org
2020-10-26  8:14 ` rguenth at gcc dot gnu.org
2020-11-09 15:25 ` rguenth at gcc dot gnu.org
2021-07-12 19:35 ` xry111 at mengyan1223 dot wang
2021-07-13  6:57 ` rguenth at gcc dot gnu.org
2021-08-23 12:08 ` hubicka at gcc dot gnu.org
2021-08-23 14:30 ` cvs-commit at gcc dot gnu.org
2021-08-23 14:31 ` rguenth at gcc dot gnu.org
2021-08-23 18:16 ` slyfox at gcc dot gnu.org
2021-08-24  7:58 ` cvs-commit at gcc dot gnu.org
2021-08-24  9:17 ` cvs-commit at gcc dot gnu.org
2021-08-24  9:18 ` 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-97565-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).