https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86869
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|target |c
Last reconfirmed| |2023-12-04
Status|UNCONFIRMED |ASSIGNED
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It still ICEs. The IL from the frontend looks wrong. We have
p = &s->y;
but we should have a ADDR_SPACE_CONVERT_EXPR here, but we have
<decl_expr 0x7ffff6b2d7e0
type <void_type 0x7ffff6a210a8 void VOID
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6a210a8
pointer_to_this <pointer_type 0x7ffff6a21150>>
side-effects
arg:0 <var_decl 0x7ffff6b62000 p
type <pointer_type 0x7ffff6b45e70 type <array_type 0x7ffff6b45dc8>
unsigned HI
...
and its DECL_INITIAL is
<nop_expr 0x7ffff6b2d7c0
type <pointer_type 0x7ffff6b45e70
type <array_type 0x7ffff6b45dc8 type <integer_type 0x7ffff6a2a0a8 char>
HI
size <integer_cst 0x7ffff6a0ba98 constant 16>
unit-size <integer_cst 0x7ffff6a0bab0 constant 2>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45dc8 domain <integer_type 0x7ffff6b45930>
pointer_to_this <pointer_type 0x7ffff6b45e70>>
unsigned HI size <integer_cst 0x7ffff6a0ba98 16> unit-size <integer_cst
0x7ffff6a0bab0 2>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45e70>
readonly
arg:0 <addr_expr 0x7ffff6b2d7a0
type <pointer_type 0x7ffff6b45d20 type <array_type 0x7ffff6b45c78>
unsigned HI size <integer_cst 0x7ffff6a0ba98 16> unit-size
<integer_cst 0x7ffff6a0bab0 2>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff6b45d20>
readonly
arg:0 <component_ref 0x7ffff6b5f120 type <array_type 0x7ffff6b45c78>
readonly
arg:0 <indirect_ref 0x7ffff6b2d780 type <record_type 0x7ffff6b45a80
S address-space-7>
readonly arg:0 <parm_decl 0x7ffff7fc8080 s>
t.c:6:26 start: t.c:6:26 finish: t.c:6:27> arg:1 <field_decl
0x7ffff6a28e40 y>
t.c:6:26 start: t.c:6:25 finish: t.c:6:28>
t.c:6:24 start: t.c:6:24 finish: t.c:6:28>
t.c:6:24 start: t.c:6:24 finish: t.c:6:28>
and the issue is that while the RECORD_TYPE has the correct address-space
qualification the array-type does not (the array-type component does).
That's the fault of the C frontend c_build_qualified_type which
special-cases ARRAY_TYPE and doesn't behave like build_array_type_1 would.
I have a fix.