Test Harness Works with MinGW But Not with IAR
Why does a test harness work with MinGW and crash with IAR?
VectorCAST does not ensure the test cases are run time safe with C/C++. The C/C++ data types do not give enough information to allow it to do that. Two examples are pointers to unconstrained arrays and casting between data types of different sizes.
The library function causing the discrepancy is malloc().
malloc() allocates memory without direct reference to the data type it is allocating for. If the function under test overruns the allocated memory, behavior is undefined and could be one of
- Test case succeeds. The overrun does not affect memory used for other purposes.
- Test case fails. The overrun affected memory used for other purposes.
- Test harness crashes. For example a segmentation violation occurs.
This can occur without involvement of VectorCAST. Stand alone erroneous code may run on one compiler but not on another. Compilers conform to the malloc() specification but implement it differently, which leads to undefined behaviour if misused.
VectorCAST is not a bounds checker. In classical unit testing, the code within the function-under-test should be compiled and executed as identically as possible to the production compilation and execution and therefore the test tool does not insert array bounds checking.