AST WhileStmt has 2 children in Clang 9.0 (instead of 3 children)
mewmew opened this issue · 0 comments
mewmew commented
The WhileStmt
node of Clang 9.0 has 2 children nodes, rather than 3 as in prior versions of Clang.
This results in a panic transpileWhileStmt
, as presented below.
Example source file
int f(int x) {
int sum = 0;
int i = 0;
while (i < x) {
sum += i;
i++;
}
return sum;
}
Panic
$ c2go transpile i.c
panic: runtime error: index out of range [2] with length 2
goroutine 1 [running]:
github.com/elliotchance/c2go/transpiler.transpileWhileStmt(0xc0000c08a0, 0xc0000e4000, 0x8, 0xc0003209b0, 0x10, 0x10, 0xc0000a7140, 0x0, 0xc0000a7130, 0x8b37a0, ...)