-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support multidimensional VLAs #5
Comments
Source of raised error: |
The question is whether the above is considered a variable length array since its length is constant. https://en.wikipedia.org/wiki/Variable-length_array#C99
Tried to get the compiler to complain about it, but it doesn't:
|
The length in your example I think the reason GCC does not complain is that it allows some extensions and apparently VLA is among them, maybe try with |
Thanks, with
That was the point - check if the warning disappears after making it |
Changing
booo 😄 |
Ok, we should patch it to also support nested arrays by calling Size: |
As soon as one of the dimensions of an array is not a constant, we should consider the entire thing a VLA and turn it into an So all of these should be considered VLAs:
The logic for this should go into isVariableSizedArray:3020 in cabs2cil.ml. |
After some discussion with Helmut we have come to the decision that is probably nicer to
I hope it should not be too much work, I'll get started on this |
Works for good-natured cases in 11e6aa0. Things that are still TODO:
|
The changes to Goblint are in https://github.com/goblint/analyzer/tree/allow_vla_in_cil_result So far it works for VLAs that are used as local variables, but still crashes for functions that take VLA as an argument. |
One-dimensional VLAs are (kind of) supported via turning them into
alloca
calls.But this fails for multidimensional arrays:
leads to
Error: Cannot resolve variable m.
Changing it to
int m[x][1];
makes it work again.The text was updated successfully, but these errors were encountered: