You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
emit-c: an array-of-arrays literal in a function body does not compile (rows named inside an initializer list) #1771
Found while fixing #1484 (pcre2's [[u8; 21]; 17] tables, initialized at startup by that fix, hit it first).
--emit-c of an array-of-arrays literal in a function body emits C that does not compile:
fn main:
let t = [[1, 2], [3, 4]]
print(t[1][0])
The aggregate assignment renders every row by name inside an initializer list ({ int32_t __with_arr_tmp[2][2] = {_1, _2}; memcpy(...); }); a row is a C array, so clang reports incompatible pointer to integer conversion initializing 'int32_t' with an expression of type 'int32_t[2]'. The LLVM backend prints 3.
Expected: each row is copied into the temporary (memcpy per row), then the temporary into the destination.
Activity
emit-c: an array of arrays built from its rows copies each row (#1771)
C backend and modeled-C fixes: map loops, generic structs, view compa…