| Summary: | ICE: in decompose, at wide-int.h:984 | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Chengnian Sun <cnsun> |
| Component: | c | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | NEW --- | ||
| Severity: | minor | CC: | asolokha, dcb314, glisse, gscfq, marxin, pinskia |
| Priority: | P3 | Keywords: | error-recovery, ice-checking, ice-on-invalid-code, needs-bisection |
| Version: | unknown | ||
| Target Milestone: | --- | ||
| See Also: |
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99911 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107320 |
||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2021-10-15 00:00:00 | |
There is a types which are not the same issue.
(gdb) p debug_tree(*expr_p)
<init_expr 0x7ffff737de88
type <integer_type 0x7ffff725f5e8 int public SI
size <integer_cst 0x7ffff7244f78 constant 32>
unit-size <integer_cst 0x7ffff7244f90 constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff725f5e8 precision:32 min <integer_cst 0x7ffff7244f30 -2147483648> max <integer_cst 0x7ffff7244f48 2147483647>
pointer_to_this <pointer_type 0x7ffff7267a80>>
side-effects
arg:0 <ssa_name 0x7ffff724fe10 type <integer_type 0x7ffff725f5e8 int>
def_stmt _2 = _1 & -128;
version:2>
arg:1 <bit_and_expr 0x7ffff737de60 type <integer_type 0x7ffff725f5e8 int>
arg:0 <ssa_name 0x7ffff724fdc8 type <integer_type 0x7ffff725f3f0 char>
def_stmt _1 = *type;
version:1>
arg:1 <integer_cst 0x7ffff7263420 constant -128>>
t.c:3:18 start: t.c:3:18 finish: t.c:3:31>
This shows up in GCC 11 (with checking enabled).
Likely triggered with r7-821-gc7986356a1ca8e8e. (In reply to Martin Liška from comment #2) > Likely triggered with r7-821-gc7986356a1ca8e8e. From Andrew's comment, it looks like the bug is before that transformation, since it receives a bit_and_expr of type int with an argument of type char, no? (In reply to Marc Glisse from comment #3) > (In reply to Martin Liška from comment #2) > > Likely triggered with r7-821-gc7986356a1ca8e8e. > > From Andrew's comment, it looks like the bug is before that transformation, > since it receives a bit_and_expr of type int with an argument of type char, > no? Correct the bug was latent before that commit and I had already figured that commit had exposed it but I did not want to report though. *** Bug 107320 has been marked as a duplicate of this bug. *** I see very similar for this legal C code:
int li_4, li_5, us_8;
unsigned char func_7_ptr_13, func_7_uc_14;
void func_7_ptr_18() {
if (li_5) {
for (;;)
;
short s_15;
for (; func_7_uc_14;) {
us_8 = 7;
for (; us_8; us_8 += 1)
lblD2AF1FAB:
if (us_8)
li_4 = 1;
func_7_uc_14 += func_7_ptr_18;
if (func_7_ptr_13 & 1 && (func_7_uc_14 &= func_7_ptr_13))
s_15 %= func_7_uc_10li_19(s_15);
}
}
goto lblD2AF1FAB;
}
when compiled as follows:
$ ~/gcc/results//bin/gcc -c -O2 -Wall bug876.c
bug876.c: In function ‘func_7_ptr_18’:
bug876.c:14:20: warning: assignment to ‘unsigned char’ from ‘void (*)()’ makes integer from pointer without a cast [-Wint-conversion]
14 | func_7_uc_14 += func_7_ptr_18;
| ^~
bug876.c:16:17: warning: implicit declaration of function ‘func_7_uc_10li_19’ [-Wimplicit-function-declaration]
16 | s_15 %= func_7_uc_10li_19(s_15);
| ^~~~~~~~~~~~~~~~~
during GIMPLE pass: uninit
bug876.c:3:6: internal compiler error: in decompose, at wide-int.h:984
3 | void func_7_ptr_18() {
(In reply to David Binderman from comment #6) > I see very similar for this legal C code: That seems like a different issue, please file it seperately. (In reply to Andrew Pinski from comment #7) > (In reply to David Binderman from comment #6) > > I see very similar for this legal C code: > > That seems like a different issue, please file it seperately. Done, see 108547. I can't reproduce this on the trunk any more. |
$ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/configure --enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch --prefix=/scratch/software/gcc-trunk --disable-bootstrap Thread model: posix Supported LTO compression algorithms: zlib gcc version 12.0.0 20211014 (experimental) [master -gee9fa8a57] (GCC) $ cat mutant.c int isascii(enum mm2); f1(char *type) { isascii(*type); } $ gcc-trunk -w mutant.c mutant.c: In function ‘f1’: mutant.c:2:26: error: type of formal parameter 1 is incomplete 2 | f1(char *type) { isascii(*type); } | ^~~~~ mutant.c:2:18: internal compiler error: in decompose, at wide-int.h:984 2 | f1(char *type) { isascii(*type); } | ^~~~~~~~~~~~~~ 0x84c5a6 wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false, false> > const&) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/wide-int.h:984 0x87be6e wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false, false> > const&) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/tree.h:3612 0x87be6e wide_int_ref_storage<false, false>::wide_int_ref_storage<generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsigned int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/wide-int.h:1034 0x87be6e generic_wide_int<wide_int_ref_storage<false, false> >::generic_wide_int<generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsigned int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/wide-int.h:790 0x87be6e wi::binary_traits<generic_wide_int<wide_int_storage>, generic_wide_int<wide_int_ref_storage<false, false> >, wi::int_traits<generic_wide_int<wide_int_storage> >::precision_type, wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> > >::precision_type>::result_type wi::bit_and_not<generic_wide_int<wide_int_storage>, generic_wide_int<wide_int_ref_storage<false, false> > >(generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_ref_storage<false, false> > const&) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/wide-int.h:2343 0x87be6e gimple_simplify_BIT_AND_EXPR /tmp/tmp.gzh6IUhxke-gcc-builder/gcc-build-trunk/gcc/gimple-match.c:124016 0x15a7906 gimple_simplify /tmp/tmp.gzh6IUhxke-gcc-builder/gcc-build-trunk/gcc/gimple-match.c:142649 0x15a930c gimple_resimplify2 /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimple-match-head.c:320 0x15d451a gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node* (*)(tree_node*), tree_node* (*)(tree_node*)) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimple-match-head.c:959 0xc68926 fold_stmt_1 /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimple-fold.c:6212 0xca9b40 gimplify_modify_expr /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:6129 0xc9c7d3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:14584 0xca04da gimplify_stmt(tree_node**, gimple**) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:7018 0xca26c6 gimplify_and_add(tree_node*, gimple**) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:494 0xca26c6 internal_get_tmp_var /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:647 0xc9bdf7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:15587 0xc9c67a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:15350 0xca04da gimplify_stmt(tree_node**, gimple**) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:7018 0xca0d0e gimplify_bind_expr /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:1426 0xc9d00c gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) /tmp/tmp.gzh6IUhxke-gcc-builder/gcc/gcc/gimplify.c:14785 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions.