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

            Bug ID: 117892
           Summary: ICE on valid code at -O1 and above on
                    x86_64-linux-gnu: in single_succ_edge, at
                    basic-block.h:332
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

It appears to be a recent regression as it doesn't reproduce with 14.2 and
earlier.

Compiler Explorer: https://godbolt.org/z/W8EMazTse

[515] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 20241203 (experimental) (GCC) 
[516] % 
[516] % gcctk -O1 small.c
during GIMPLE pass: local-fnsummary
small.c: In function ‘main’:
small.c:13:1: internal compiler error: in single_succ_edge, at
basic-block.h:332
   13 | }
      | ^
0x26d2285 internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:517
0xa9ff8e fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostic.cc:1696
0x83901a single_succ_edge(basic_block_def const*)
        ../../gcc-trunk/gcc/basic-block.h:332
0x83901a builtin_unreachable_bb_p
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:2708
0x83901a guards_builtin_unreachable
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:2730
0x83901a find_necessary_statements
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:2805
0xf15cc1 analyze_function_body
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:2931
0xf1864a compute_fn_summary(cgraph_node*, bool)
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:3473
0xf18da4 compute_fn_summary_for_current
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:3503
0xf18da4 execute
        ../../gcc-trunk/gcc/ipa-fnsummary.cc:5158
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.
[517] % 
[517] % cat small.c
volatile int a;
void b(int *c) {
  int *d = 0;
  *c = 0;
  *d = 0;
  __builtin_abort();
}
int main() {
  int f;
  if (a)
    b(&f);
  return 0;
}

Reply via email to