https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86869
Bug ID: 86869 Summary: ICE when taking address of array member of __memx struct pointer Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: saaadhu at gcc dot gnu.org Target Milestone: --- The following code struct S { char y[2]; }; void foo(const __memx struct S *s) { const char (*p)[2] = &s->y; } causes an ICE when compiled with the below flags on avr-gcc 9.0.0 20180805 (reproducible on 5.4 as well) causes an ICE $ avr-gcc -O0 -mmcu=avr51 test.c during RTL pass: expand In function 'foo': 6 : internal compiler error: in convert_memory_address_addr_space_1, at explow.c:300 const char (*p)[2] = &s->y; ^ 0x5bd7ca convert_memory_address_addr_space_1(scalar_int_mode, rtx_def*, unsigned char, bool, bool) ../../gcc-src/gcc/explow.c:300 0x939605 convert_memory_address_addr_space_1(scalar_int_mode, rtx_def*, unsigned char, bool, bool) ../../gcc-src/gcc/explow.c:401 0x939605 convert_memory_address_addr_space(scalar_int_mode, rtx_def*, unsigned char) ../../gcc-src/gcc/explow.c:402 0x94fdd9 expand_expr_addr_expr ../../gcc-src/gcc/expr.c:8028 0x94fdd9 expand_expr_real_1(tree_node*, rtx_def*, machine_mode, expand_modifier, rtx_def**, bool) ../../gcc-src/gcc/expr.c:11142 0x95b727 store_expr(tree_node*, rtx_def*, int, bool, bool) ../../gcc-src/gcc/expr.c:5614 0x95c8c0 expand_assignment(tree_node*, tree_node*, bool) ../../gcc-src/gcc/expr.c:5398 0x849837 expand_gimple_stmt_1 ../../gcc-src/gcc/cfgexpand.c:3636 0x84a728 expand_gimple_stmt ../../gcc-src/gcc/cfgexpand.c:3734 0x84b0ff expand_gimple_basic_block ../../gcc-src/gcc/cfgexpand.c:5769 0x84fec7 execute ../../gcc-src/gcc/cfgexpand.c:6372 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. Compiler exited with result code 1