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

            Bug ID: 83532
           Summary: [8 Regression] ICE in apply_scale, at
                    profile-count.h:955
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org, marxin at gcc dot gnu.org
  Target Milestone: ---

Can be seen during building of Python with PGO. One can debug that on x86_64
with r255776:

$ gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -fmessage-length=0
-grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong
-funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection
-DOPENSSL_LOAD_CONF  -fmessage-length=0 -grecord-gcc-switches -O2 -Wall
-D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -fmessage-length=0
-grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong
-funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection  -std=c99
-Wextra -Wno-unused-result -Wno-unused-parameter
-Wno-missing-field-initializers -fmessage-length=0 -grecord-gcc-switches -O2
-Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables
-fasynchronous-unwind-tables -fstack-clash-protection -fprofile-use
-fprofile-correction   -I. -I./Include   -fPIC -DPy_BUILD_CORE abstract.i
during GIMPLE pass: feedback_fnsplit
Objects/abstract.c: In function ‘_Py_CheckFunctionResult.part.11’:
Objects/abstract.c:3246:1: internal compiler error: in apply_scale, at
profile-count.h:955
0xc1970d profile_count::apply_scale(profile_count, profile_count) const
        ../../gcc/profile-count.h:955
0xc520be copy_edges_for_bb
        ../../gcc/tree-inline.c:2231
0xc53c23 copy_cfg_body
        ../../gcc/tree-inline.c:2752
0xc54634 copy_body
        ../../gcc/tree-inline.c:2971
0xc5dd5b tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*,
va_gc, vl_embed>*, bool, bitmap_head*, bool, bitmap_head*, basic_block_def*)
        ../../gcc/tree-inline.c:6038
0x79deda cgraph_node::create_version_clone_with_body(vec<cgraph_edge*, va_heap,
vl_ptr>, vec<ipa_replace_map*, va_gc, vl_embed>*, bitmap_head*, bool,
bitmap_head*, basic_block_def*, char const*)
        ../../gcc/cgraphclones.c:984
0x13e7dbf split_function
        ../../gcc/ipa-split.c:1368
0x13ed920 execute_split_functions
        ../../gcc/ipa-split.c:1896
0x13edda8 execute_feedback_split_functions
        ../../gcc/ipa-split.c:1959
0x13edda8 execute
        ../../gcc/ipa-split.c:1991

Problem is that we do:

(gdb) p old_edge->count.debug()
Attempt to extract a component of a value that is not a struct or union
(gdb) p old_edge->count().debug()
1
$1 = void
(gdb) p num.debug()
1 (adjusted)
$2 = void
(gdb) p den.debug()
0

Thus a division by zero happens.

Reply via email to