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

            Bug ID: 96394
           Summary: internal compiler error: in add_new_edges_to_heap, at
                    ipa-inline.c:1746 (-O3 PGO)
           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: ---

It's a forward of https://bugs.gentoo.org/734006 where Ștefan Talpalaru found
an ICE when gcc tries to build PGO-optimised variant of python tauthon-2.8.2.

I can consistently reproduce the crash on gcc-10.2.0 and was able to extract
the backtrace from -O0 ggdb3 gcc:

$ ${HOME}/dev/git/gcc-10-build/gcc/xgcc -B${HOME}/dev/git/gcc-10-build/gcc 
-pthread -fPIC -fno-strict-aliasing -O3 -frecord-gcc-switches -fwrapv -DNDEBUG
-fprofile-use -fprofile-correction -I.
-I/tmp/portage/dev-lang/tauthon-2.8.2/work/tauthon-2.8.2/Include
-I/tmp/portage/dev-lang/tauthon-2.8.2/work/x86_64-pc-linux-gnu -c
/tmp/portage/dev-lang/tauthon-2.8.2/work/tauthon-2.8.2/Modules/parsermodule.c
-o
build/temp.linux-x86_64-2.8/tmp/portage/dev-lang/tauthon-2.8.2/work/tauthon-2.8.2/Modules/parsermodule.o
-v -fdump-ipa-all-slim

Breakpoint 2, internal_error (gmsgid=0x297d49f "in %s, at %s:%d") at
../../gcc-10/gcc/diagnostic.c:1706
1706    {
(gdb) bt
#0  internal_error (gmsgid=0x297d49f "in %s, at %s:%d") at
../../gcc-10/gcc/diagnostic.c:1706
#1  0x0000000002063d64 in fancy_abort (file=0x2912678
"../../gcc-10/gcc/ipa-inline.c", line=1746, function=0x2912cd4
"add_new_edges_to_heap") at ../../gcc-10/gcc/diagnostic.c:1778
#2  0x0000000001f3fb12 in add_new_edges_to_heap (heap=0x7fffffffce90,
new_edges=...) at ../../gcc-10/gcc/ipa-inline.c:1746
#3  0x0000000001f412e0 in inline_small_functions () at
../../gcc-10/gcc/ipa-inline.c:2210
#4  0x0000000001f43074 in ipa_inline () at ../../gcc-10/gcc/ipa-inline.c:2689
#5  0x0000000001f43eb1 in (anonymous namespace)::pass_ipa_inline::execute
(this=0x2f03ce0) at ../../gcc-10/gcc/ipa-inline.c:3091
#6  0x0000000000fd326c in execute_one_pass (pass=0x2f03ce0) at
../../gcc-10/gcc/passes.c:2502
#7  0x0000000000fd41c9 in execute_ipa_pass_list (pass=0x2f03ce0) at
../../gcc-10/gcc/passes.c:2929
#8  0x0000000000adbb78 in ipa_passes () at ../../gcc-10/gcc/cgraphunit.c:2678
#9  0x0000000000adbd95 in symbol_table::compile (this=0x7ffff7865100) at
../../gcc-10/gcc/cgraphunit.c:2755
#10 0x0000000000adc33d in symbol_table::finalize_compilation_unit
(this=0x7ffff7865100) at ../../gcc-10/gcc/cgraphunit.c:3002
#11 0x00000000011332a9 in compile_file () at ../../gcc-10/gcc/toplev.c:483
#12 0x00000000011364aa in do_compile () at ../../gcc-10/gcc/toplev.c:2298
#13 0x00000000011367b6 in toplev::main (this=0x7fffffffd266, argc=37,
argv=0x7fffffffd378) at ../../gcc-10/gcc/toplev.c:2437
#14 0x0000000002035d42 in main (argc=37, argv=0x7fffffffd378) at
../../gcc-10/gcc/main.c:39
(gdb) fr 2
#2  0x0000000001f3fb12 in add_new_edges_to_heap (heap=0x7fffffffce90,
new_edges=...) at ../../gcc-10/gcc/ipa-inline.c:1746
1746          gcc_assert (!edge->aux);
(gdb) list
1741    {
1742      while (new_edges.length () > 0)
1743        {
1744          struct cgraph_edge *edge = new_edges.pop ();
1745
1746          gcc_assert (!edge->aux);
1747          gcc_assert (edge->callee);
1748          if (edge->inline_failed
1749              && can_inline_edge_p (edge, true)
1750              && want_inline_small_function_p (edge, true)

Dumping the edge: validate_chain_two_ops/133 -> validate_arith_expr/135

(gdb) call edge->caller->dump(stdout)
validate_chain_two_ops/133 (validate_chain_two_ops) @0x7ffff6efc708
  Type: function definition analyzed
  Visibility: prevailing_def_ironly
  previous sharing asm name: 430
  References: parser_error/46 (read)
  Referring:
  Function validate_chain_two_ops/133 is inline copy in validate_shift_expr/134
  Availability: local
  Profile id: 607042219
  Function flags: count:395 (estimated locally, globally 0) first_run:27 body
local unlikely_executed
  Called by: validate_shift_expr/134 (inlined) (395 (estimated locally,
globally 0),1.00 per call)
  Calls: validate_arith_expr/135 (indirect_inlining) (9 (estimated locally,
globally 0 adjusted),0.02 per call) validate_arith_expr/135 (indirect_inlining)
(394 (estimated locally, globally 0 adjusted),1.00 per call) PyErr_Format/202
(0 (precise),0.00 per call)

(gdb) call edge->callee->dump(stdout)
validate_arith_expr/135 (validate_arith_expr) @0x7ffff6efc9d8
  Type: function definition analyzed
  Visibility: prevailing_def_ironly
  previous sharing asm name: 435
  Address is taken.
  References: parser_error/46 (read)
  Referring:
  Availability: available
  Profile id: 829576279
  Function flags: count:1 (adjusted) first_run:28 body hot
  Called by: validate_chain_two_ops/133 (indirect_inlining) (9 (estimated
locally, globally 0 adjusted),0.02 per call) validate_chain_two_ops/491
(indirect_inlining) (9 (adjusted),0.02 per call) validate_chain_two_ops/431
(indirect_inlining) (9 (estimated locally, globally 0 adjusted),0.02 per call)
validate_chain_two_ops/133 (indirect_inlining) (394 (estimated locally,
globally 0 adjusted),1.00 per call) validate_node/162 (0 (precise),0.00 per
call)
  Calls: PyErr_Format/202 (0 (precise),0.00 per call)
validate_chain_two_ops/430 (inlined) (1 (adjusted),1.00 per call)

If I understand the assert correctly edge was added twice in the heap (or
similar?).

Reply via email to