Bug #7244
closedEMG declares and operates with variables of types non-visible in the file with an entry point
0%
Description
EMG chooses single file for an entry point function, control functions and label declarations. Label can be generated to represent resources which are relevant to callbacks from the other files of a module under verification. Referred labels can have type which is not visible in the main file of an environment model which causes incomplete type error.
This situation is already modelled in a test set for testing environment model specifications and can be easily reproduced.
Updated by Ilja Zakharov over 8 years ago
The most reliable way is to use for process labels primitive types or pointers for more complicated types only. So I am going to implement casts to pointers for labels of all non-pointer complicated types. By the way additionally I will add automatic includes of header files given in interface categories specifications and if there are given then EMG will not do mentioned above casts. The latter case example is interrupt enum type which is used for interrupt return values and including of a corresponding header is a better solution.
Updated by Evgeny Novikov over 8 years ago
I would like to warn you to include additional headers very accurately, otherwise we will fall back into related #6560. I suggest that you can safely include appropriate headers if they are really required for corresponding interfaces in corresponding files. In particular you can specify required headers for corresponding interfaces directly in environment model specifications rather than include them unconditionally.
In addition using pointers instead of, say, structures can also fail since you will need at least corresponding structure declarations (something like struct A;) while they can absent without including corresponding headers.
Updated by Vadim Mutilin over 8 years ago
Idealy, we should be able to detect whether the structure is defined, declared or not. Based on this we should use the type itself, pointer to a type or void* correspondingly.
For now as far as we mostly use in specifications parameters and return values which are pointers to a declared structure type or simple type, the fix for #7262 should solve most of the cases.
Updated by Ilja Zakharov over 8 years ago
Since I cannot detect absence of a declaration in an entry point file, I am going to declare additionally all structures and unions to avoid warnings from a compiler.
Updated by Ilja Zakharov over 8 years ago
- Priority changed from Urgent to Normal
As a workaround I have added export of control functions from the main file with an entry point to files with a container relevant to control function, callback call or kernel function call. This allowed to get rid of several problems relevant to scope and reported in relevant issues.
Implementation is available in emg-improvements branch.
Updated by Ilja Zakharov over 6 years ago
- Status changed from New to Resolved
Moved to 8066-abstract-translator. Currently there is no any problems with the types scope.
Updated by Evgeny Novikov about 5 years ago
- Status changed from Resolved to Closed
It seems that the branch was merged to master a long ago, but issues were not closed at that time.