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
This issue is about passing an array to a function using initializer syntax. If a function takes an array argument and I pass it an initializer list that I cast to an array, then cgeist crashes while trying to convert the argument to an array.
Here is a minimal example of the problem:
$ cat arraycall.c
int f(int a[], int i){
return a[i];
}
int g(){
return f(((int []){0,1,2}),2);
}
When I run cgeist on this program here is the output that I see (which is a crash):
That code runs correctly when I compile all the way to executable using gcc and clang.
I tried commenting out the failing assertion (and the one immediately after it) to see if I could recklessly get the code to go through without crashing, but unfortunately, that didn't work and I stopped following that thread.
The expected behavior for this program would be to stack allocate (i.e., alloca) the argument array in g(), just before the call to f(), although I'm not sure what that looks like in terms of memref.
The text was updated successfully, but these errors were encountered:
This issue is about passing an array to a function using initializer syntax. If a function takes an array argument and I pass it an initializer list that I cast to an array, then
cgeist
crashes while trying to convert the argument to an array.Here is a minimal example of the problem:
When I run
cgeist
on this program here is the output that I see (which is a crash):Compiling with
clang
works:And the resulting LLVM IR seems reasonable (notice the
alloca
of the array at the start of g()):That code runs correctly when I compile all the way to executable using
gcc
andclang
.I tried commenting out the failing assertion (and the one immediately after it) to see if I could recklessly get the code to go through without crashing, but unfortunately, that didn't work and I stopped following that thread.
The expected behavior for this program would be to stack allocate (i.e.,
alloca
) the argument array ing()
, just before the call tof()
, although I'm not sure what that looks like in terms ofmemref
.The text was updated successfully, but these errors were encountered: