https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98592
Bug ID: 98592
Summary: ICE in gimple_canonical_types_compatible_p while
formatting a MEM_REF
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
With the ICEs reported in pr98578 and pr95768 both fixed, the latest trunk now
fails with another ICE in the same code on the test case below. Apparently,
gimple_canonical_types_compatible_p() doesn't like mixed array and scalar types
(t1 is an int, t2 is an int array).
$ cat t.c && gcc -O2 -S -Wall -fdump-tree-uninit=/dev/stdout t.c
void f (int);
void g (int n)
{
int a[n][3];
f (((*(int(*)[4])&a[1][2]))[3]);
}
;; Function g (g, funcdef_no=0, decl_uid=1945, cgraph_uid=1, symbol_order=0)
ā
during GIMPLE pass: uninit
dump file: /dev/stdout
EMERGENCY DUMP:
void g (int n)
{
int[0:D.1950][3] * a.1;
sizetype _1;
int _6;
sizetype _7;
<bb 2> [local count: 1073741824]:
_1 = (sizetype) n_2(D);
_7 = _1 * 12;
a.1_9 = __builtin_alloca_with_align (_7, 32);
_6 = MEM[(int[4] *)a.1_9 + 20B][3];
f (_6);
return;
}
In function āgā:
in gimple_canonical_types_compatible_p, at tree.c:14367
3 | void g (int n)
| ^
0x195c249 gimple_canonical_types_compatible_p(tree_node const*, tree_node
const*, bool)
/src/gcc/master/gcc/tree.c:14366
0xb3616f print_mem_ref
/src/gcc/master/gcc/c-family/c-pretty-print.c:1869
0xb3686d c_pretty_printer::unary_expression(tree_node*)
/src/gcc/master/gcc/c-family/c-pretty-print.c:2005
0xb380fd c_pretty_printer::expression(tree_node*)
/src/gcc/master/gcc/c-family/c-pretty-print.c:2508
0xb35922 c_pretty_printer::postfix_expression(tree_node*)
/src/gcc/master/gcc/c-family/c-pretty-print.c:1729
0xb3517a c_pretty_printer::postfix_expression(tree_node*)
/src/gcc/master/gcc/c-family/c-pretty-print.c:1587
0xb380da c_pretty_printer::expression(tree_node*)
/src/gcc/master/gcc/c-family/c-pretty-print.c:2493
0xa31fa2 c_tree_printer
/src/gcc/master/gcc/c/c-objc-common.c:317
0x2883a45 pp_format(pretty_printer*, text_info*)
/src/gcc/master/gcc/pretty-print.c:1475
0x2859d96 diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
/src/gcc/master/gcc/diagnostic.c:1216
0x285a3e7 diagnostic_impl
/src/gcc/master/gcc/diagnostic.c:1366
0x285aca3 warning_at(unsigned int, int, char const*, ...)
/src/gcc/master/gcc/diagnostic.c:1503
0x180d584 maybe_warn_operand
/src/gcc/master/gcc/tree-ssa-uninit.c:418
0x180e15d warn_uninitialized_vars
/src/gcc/master/gcc/tree-ssa-uninit.c:657
0x1813575 execute
/src/gcc/master/gcc/tree-ssa-uninit.c:3019
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.