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

            Bug ID: 123634
           Summary: ICE in cancel_negative_cycle on aarch64
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: gcov-profile
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 63361
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63361&action=edit
Modules/_opcode.i.xz

Python-3.15.0a5 FAILs to build on aarch64 with PGO.
I can reproduce even in a cross from x86_64-linux to aarch64-linux.
./cc1 -fpreprocessed Modules/_opcode.i -quiet -dumpdir Modules/ -dumpbase
_opcode.c -dumpbase-ext .c -mbranch-protection=standard
-mbranch-protection=standard -mbranch-protection=standard
-mbranch-protection=standard -mbranch-protection=standard
-mno-omit-leaf-frame-pointer -mlittle-endian -mabi=lp64 -g -O3 -std=c11
-version -fno-strict-overflow -fstack-protector-strong
-fno-semantic-interposition -fvisibility=hidden -fexceptions
-fstack-protector-strong -fasynchronous-unwind-tables -fstack-clash-protection
-fno-omit-frame-pointer -fwrapv -fprofile-use -fprofile-correction -fPIC -o
Modules/_opcode.s
GNU C11 (GCC) version 16.0.1 20260116 (experimental) (aarch64-linux)
        compiled by GNU C version 15.2.1 20251022 (Red Hat 15.2.1-3), GMP
version 6.3.0, MPFR version 4.2.2, MPC version 1.3.1, isl version none
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: c10ff810dfd33e2eb4ceb257895e3dd0
during IPA pass: profile
/builddir/build/BUILD/python3.15-3.15.0_a5-build/Python-3.15.0a5/Modules/_opcode.c:
In function ‘_opcode_has_arg’:
/builddir/build/BUILD/python3.15-3.15.0_a5-build/Python-3.15.0a5/Modules/_opcode.c:452:1:
internal compiler error: Segmentation fault
0x2c58446 internal_error(char const*, ...)
        ../../gcc/diagnostic-global-context.cc:787
0xec9480 crash_signal
        ../../gcc/toplev.cc:325
0x2a63c25 cancel_negative_cycle
        ../../gcc/mcf.cc:890
0x2a64ec5 find_minimum_cost_flow
        ../../gcc/mcf.cc:1332
0x2a64fde mcf_smooth_cfg()
        ../../gcc/mcf.cc:1381
0xd78b17 compute_branch_probabilities
        ../../gcc/profile.cc:663
0xd7b63f branch_prob(bool)
        ../../gcc/profile.cc:1605
0x1024885 tree_profiling
        ../../gcc/tree-profile.cc:1945
0x1024f22 execute
        ../../gcc/tree-profile.cc:2075
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

This is in
887       for (k = cycle_start; k < cycle_end; k++)
888         {
889           pfedge = find_fixup_edge (fixup_graph, cycle[k + 1], cycle[k]);
890           cycle_flow = MIN (cycle_flow, pfedge->rflow);
891           sum_cost += pfedge->cost;
892           if (dump_file)
893             fprintf (dump_file, "%d ", cycle[k]);
where pfedge is NULL and line 890 dereferences it.
cycle_start is 4, cycle_end is 5, cycle[k + 1] is 0, cycle[k] is also 0.

To reproduce, both the _opcode.i and _opcode.gcda need to be in Modules/
subdirectory of the current dir.

Reply via email to