-
Notifications
You must be signed in to change notification settings - Fork 20
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
sv-benchmarks intel-tdx-module parsing errors #176
Comments
The first error also happens on this minimized program: typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef union
{
struct
{
uint32_t leaf;
uint32_t subleaf;
};
uint64_t raw;
} cpuid_config_leaf_subleaf_t;
typedef struct
{
cpuid_config_leaf_subleaf_t leaf_subleaf;
} cpuid_lookup_t;
extern const cpuid_lookup_t cpuid_lookup[68];
const cpuid_lookup_t cpuid_lookup[68] = {
[10] = { .leaf_subleaf = {.leaf = 0x0, .subleaf = 0xffffffff}}
}; |
After further simplification, it seems that to trigger the problem it suffices to initialize a union with a struct. typedef union
{
struct
{
short leaf;
};
int raw;
} un;
un v = { .leaf = 0 }; |
It seems that the code to generate initializers does not handle anonymous members properly. For normal accesses CIL properly translates this. For example un v;
v.leaf = 8; becomes un v ;
v.__annonCompField1.leaf = (short)8; Notice the nice spelling mistake 🤣 |
I vaguely recall from looking at it that referencing the inner |
In other cases CIL seems to perform a DFS which also seems to be the morally correct thing to do. As these anonymous things behave "as if" their members were members of the original struct, this should be non-ambigous. Lines 3499 to 3514 in f5ee39b
It supposedly was supported as a GCC extension but has since become part of the standard (C11). For a rather superficial treatment see, e.g., here https://www.geeksforgeeks.org/g-fact-38-anonymous-union-and-structure/. |
If I'm not mistaken, the initializer case is instead handled here: Lines 5524 to 5551 in f5ee39b
There's some Cabs hackery with a special ___matching_field field name.
The code in the initial issue prints these |
SV-COMP has a new SoftwareSystems subcategory where we cannot parse any of the programs. For example:
The text was updated successfully, but these errors were encountered: