Commit f4b032a
fix: heap-allocate interface values in array/variadic contexts
When casting lvalues to interface types inside array literals or
variadic argument packing, the generated C code used stack pointers
(&local_var) for the interface object. These pointers become dangling
when the stack frame ends, causing parameter corruption on Linux
(confirmed on CI: string values read as empty or pointed to wrong
stack data like the query string).
Fix: set inside_cast_in_heap when generating interface/sumtype array
elements and variadic args so that call_cfn_for_casting_expr uses
HEAP() instead of bare &. This does not affect direct interface
assignments (mut ii := II(aa)) which correctly share memory.
Fixes #26760
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 899fc7d commit f4b032a
3 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
94 | 100 | | |
95 | 101 | | |
96 | 102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3143 | 3143 | | |
3144 | 3144 | | |
3145 | 3145 | | |
| 3146 | + | |
| 3147 | + | |
| 3148 | + | |
| 3149 | + | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
3146 | 3153 | | |
3147 | 3154 | | |
3148 | 3155 | | |
3149 | | - | |
| 3156 | + | |
3150 | 3157 | | |
3151 | 3158 | | |
3152 | 3159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2862 | 2862 | | |
2863 | 2863 | | |
2864 | 2864 | | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
2865 | 2870 | | |
2866 | 2871 | | |
2867 | 2872 | | |
| |||
2871 | 2876 | | |
2872 | 2877 | | |
2873 | 2878 | | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
2874 | 2882 | | |
2875 | 2883 | | |
2876 | 2884 | | |
| |||
0 commit comments