https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125314
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2026-05-15
CC| |rguenth at gcc dot gnu.org
Status|UNCONFIRMED |NEW
Keywords| |ice-on-valid-code,
| |wrong-code
Ever confirmed|0 |1
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
(gdb) p temp.opcode
$1 = FUNCTION_DECL
from
afun.i = 1;
(gdb) p debug_tree (lhs)
<component_ref 0x7ffff722d180
type <integer_type 0x7ffff76175e8 integer(kind=4) public SI
size <integer_cst 0x7ffff761b018 constant 32>
unit-size <integer_cst 0x7ffff761b030 constant 4>
align:32 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7ffff76175e8 precision:32 min <integer_cst 0x7ffff7602fc0 -2147483648> max
<integer_cst 0x7ffff7602fd8 2147483647>
pointer_to_this <pointer_type 0x7ffff761fb28>>
arg:0 <function_decl 0x7ffff7224600 afun
type <function_type 0x7ffff722bdc8 type <record_type 0x7ffff72237e0
PDTty1_1_1>
so we are accessing a FUNCTION_DECL as record (it returns a record).
wrong code from the frontend. I suppose intended GENERIC woudl be
sth like
COMPONENT_REF <TARGET_EXPR <D.1234, CALL_EXPR (afunc)>, i>
I suppose I can make FRE not ICE but generate code to write to 'afun',
but I'm not sure RTL expansion does sth sensible to this.
struct S { int i; };
struct S foo();
void bar()
{
((struct S*)foo)->i = 1;
}
wraps the access in a MEM and that's handled fine. I suppose IL verification
should catch the FUNCTION_DECL case, but for some reason it does not.
MEM[(struct S *)foo].i = 1;