https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128204
Bug ID: 128204
Summary: internal compiler error: tree check: expected
ssa_name, have var_decl in first_readonly_imm_use, at
ssa-iterators.h
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: 0599jiangyc at gmail dot com
Target Milestone: ---
The following code:
```c
struct A { char *a; };
struct A strlen (char *);
int f (char *p)
{
struct A r = strlen (p);
return r.a != 0;
}
```
Output:
```
during GIMPLE pass: forwprop
<source>: In function 'f':
<source>:4:5: internal compiler error: tree check: expected ssa_name, have
var_decl in first_readonly_imm_use, at ssa-iterators.h:393
4 | int f (char *p)
| ^
0x28d3bb8 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x28c87fb internal_error(char const*, ...)
???:0
0x9481b2 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
???:0
/cefs/86/8648502252d366b91fe55083_gcc-trunk-20261026/bin/../libexec/gcc/x86_64-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu -iprefix
/cefs/86/8648502252d366b91fe55083_gcc-trunk-20261026/bin/../lib/gcc/x86_64-linux-gnu/17.0.0/
<source> -quiet -dumpdir /app/output.s- -dumpbase example.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -g -O2 -fdiagnostics-color=always -fno-verbose-asm
-o /tmp/ccu7n91U.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
x86-64 gcc (trunk) - 857ms
```
Trunk: https://godbolt.org/z/TqT96ffv3