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
Unexpected verification result about nested struct initialization #3653
#include <assert.h>
typedef int T[];
struct f { int w; T x; };
static struct f f = { 4, { 0, 1, 2, 3 } };
int main()
{
int i;
for (i = 0; i < f.w; ++i)
{
if (f.x[i] != i)
{ assert(0);}
}
return 0;
}
CBMC version: 5.10
Operating system: Ubuntu 18.04
Exact command line resulting in the issue: cbmc <file.c>
What behaviour did you expect: result in SUCCESS (proofed by compiling with gcc and executing)
What happened instead: [main.assertion.1] assertion 0: FAILURE
What behaviour do we actually expect here? Looking at the C standard, this is explicitly called out as invalid (paragraph 21/Example 2 in "6.7.2.1 Structure and union specifiers" in C11). Is the desired bug fix for us to reject this during type checking?
Activity
test for issue #3653
kroening commentedon Jan 6, 2019
Many thanks; I've made a PR with a test for this as PR #3695.
test for issue #3653
tautschnig commentedon Mar 8, 2021
What behaviour do we actually expect here? Looking at the C standard, this is explicitly called out as invalid (paragraph 21/Example 2 in "6.7.2.1 Structure and union specifiers" in C11). Is the desired bug fix for us to reject this during type checking?
kroening commentedon Mar 8, 2021
This might be a gcc/clang extension, but the documentation doesn't seem to be clear about that.
tautschnig commentedon Mar 8, 2021
It seems to work with GCC and MSVC, Clang rejects the program.
SaswatPadhi commentedon Aug 20, 2021
This appears to be a bug even with the latest (5.36) version.
Support non-heap allocated flexible arrays
Support non-heap allocated flexible arrays
Support non-heap allocated flexible arrays
Support non-heap allocated flexible arrays