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

            Bug ID: 125699
           Summary: ICE (nondeterministic) on valid code at -O3 with -g on
                    x86_64-linux-gnu: in get_expr_operands, at
                    tree-ssa-operands.cc:943
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

Note:
- fails: trunk
- nondetermistic crash

[537] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.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 17.0.0 20260609 (experimental) (GCC) 
[538] % 
[538] % for i in $(seq 1 10); do echo $i; gcctk -O3 -g small.c; done
1
2
3
4
5
6
7
8
9
10
[539] % for i in $(seq 1 10); do echo $i; gcctk -O3 -g small.c; done
1
unhandled expression in get_expr_operands():
 <<invalid tree code> 0x7f706c094ce0>

during IPA pass: inline
In function ‘e.constprop.isra’:
cc1: internal compiler error: in get_expr_operands, at tree-ssa-operands.cc:943
0x265e5ab internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa2f89c fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x13effbd operands_scanner::get_expr_operands(tree_node**, int)
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:943
0x13f146f operands_scanner::build_ssa_operands()
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:1014
0x13f1594 update_stmt_operands(function*, gimple*)
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:1156
0xdec63f update_stmt_if_modified(gimple*)
        ../../gcc-trunk/gcc/gimple-ssa.h:187
0xdec63f update_stmt_if_modified(gimple*)
        ../../gcc-trunk/gcc/gimple-ssa.h:184
0xdec63f update_modified_stmt
        ../../gcc-trunk/gcc/gimple-iterator.cc:53
0xdec63f gsi_insert_after(gimple_stmt_iterator*, gimple*, gsi_iterator_update)
        ../../gcc-trunk/gcc/gimple-iterator.cc:555
0x1292f8e copy_bb
        ../../gcc-trunk/gcc/tree-inline.cc:2131
0x12948ff copy_cfg_body
        ../../gcc-trunk/gcc/tree-inline.cc:3154
0x12948ff copy_body
        ../../gcc-trunk/gcc/tree-inline.cc:3409
0x129750b tree_function_versioning(tree_node*, tree_node*,
vec<ipa_replace_map*, va_gc, vl_embed>*, ipa_param_adjustments*, bool,
bitmap_head*, basic_block_def*)
        ../../gcc-trunk/gcc/tree-inline.cc:6521
0xc686cd cgraph_node::materialize_clone()
        ../../gcc-trunk/gcc/cgraphclones.cc:1249
0xc550fd cgraph_node::get_untransformed_body()
        ../../gcc-trunk/gcc/cgraph.cc:4601
0xf25065 maybe_materialize_called_clones
        ../../gcc-trunk/gcc/ipa-inline-transform.cc:790
0xf26d3e inline_transform(cgraph_node*)
        ../../gcc-trunk/gcc/ipa-inline-transform.cc:848
0x10bc4ee execute_one_ipa_transform_pass
        ../../gcc-trunk/gcc/passes.cc:2327
0x10bc4ee execute_all_ipa_transforms(bool)
        ../../gcc-trunk/gcc/passes.cc:2390
0xc62360 cgraph_node::expand()
        ../../gcc-trunk/gcc/cgraphunit.cc:1867
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpdir a- -dumpbase small.c -dumpbase-ext .c -mtune=generic
-march=x86-64 -g -O3 -o /tmp/ccWhfYC9.s
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.
2
3
4
5
6
7
8
9
unhandled expression in get_expr_operands():
 <<invalid tree code> 0x7fcfb3264ce0>

during IPA pass: inline
In function ‘e.constprop.isra’:
cc1: internal compiler error: in get_expr_operands, at tree-ssa-operands.cc:943
0x265e5ab internal_error(char const*, ...)
        ../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa2f89c fancy_abort(char const*, int, char const*)
        ../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x13effbd operands_scanner::get_expr_operands(tree_node**, int)
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:943
0x13f146f operands_scanner::build_ssa_operands()
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:1014
0x13f1594 update_stmt_operands(function*, gimple*)
        ../../gcc-trunk/gcc/tree-ssa-operands.cc:1156
0xdec63f update_stmt_if_modified(gimple*)
        ../../gcc-trunk/gcc/gimple-ssa.h:187
0xdec63f update_stmt_if_modified(gimple*)
        ../../gcc-trunk/gcc/gimple-ssa.h:184
0xdec63f update_modified_stmt
        ../../gcc-trunk/gcc/gimple-iterator.cc:53
0xdec63f gsi_insert_after(gimple_stmt_iterator*, gimple*, gsi_iterator_update)
        ../../gcc-trunk/gcc/gimple-iterator.cc:555
0x1292f8e copy_bb
        ../../gcc-trunk/gcc/tree-inline.cc:2131
0x12948ff copy_cfg_body
        ../../gcc-trunk/gcc/tree-inline.cc:3154
0x12948ff copy_body
        ../../gcc-trunk/gcc/tree-inline.cc:3409
0x129750b tree_function_versioning(tree_node*, tree_node*,
vec<ipa_replace_map*, va_gc, vl_embed>*, ipa_param_adjustments*, bool,
bitmap_head*, basic_block_def*)
        ../../gcc-trunk/gcc/tree-inline.cc:6521
0xc686cd cgraph_node::materialize_clone()
        ../../gcc-trunk/gcc/cgraphclones.cc:1249
0xc550fd cgraph_node::get_untransformed_body()
        ../../gcc-trunk/gcc/cgraph.cc:4601
0xf25065 maybe_materialize_called_clones
        ../../gcc-trunk/gcc/ipa-inline-transform.cc:790
0xf26d3e inline_transform(cgraph_node*)
        ../../gcc-trunk/gcc/ipa-inline-transform.cc:848
0x10bc4ee execute_one_ipa_transform_pass
        ../../gcc-trunk/gcc/passes.cc:2327
0x10bc4ee execute_all_ipa_transforms(bool)
        ../../gcc-trunk/gcc/passes.cc:2390
0xc62360 cgraph_node::expand()
        ../../gcc-trunk/gcc/cgraphunit.cc:1867
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpdir a- -dumpbase small.c -dumpbase-ext .c -mtune=generic
-march=x86-64 -g -O3 -o /tmp/ccBaVw2z.s
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.
10
[540] % cat small.c
struct a {
  char b[1];
};
long c, q;
int d, n;
char k;
int e(char f, int g, char h) {
  char i;
  struct a j;
  int r;
l:
  i = 2 + f - g;
  if (d)
    goto m;
  if (h * f)
    q = c;
  if (c)
    goto l;
m:
  j.b[2] = -g;
  r = i + 8 + k + r;
  r = j.b[2] + r;
  return r;
}
int main() {
  int p = 1;
  e(p, n, 0);
  return 0;
}

Reply via email to