Tests are not compilable on branch feature/conan-2 (Linux environment)
simfaucher opened this issue · 2 comments
simfaucher commented
Hello,
We have the following error when compiling libcosimc on branch feature/conan-2:
[ 12%] Building C object CMakeFiles/execution_from_ssp_test.dir/tests/execution_from_ssp_test.c.o
[ 19%] Built target inital_values_test
[ 25%] Building C object CMakeFiles/execution_from_ssp_custom_algo_test.dir/tests/execution_from_ssp_custom_algo_test.c.o
[ 35%] Built target connections_test
[ 35%] Built target load_config_and_teardown_test
[ 41%] Built target execution_from_osp_config_test
[ 48%] Built target observer_can_buffer_samples
[ 54%] Built target multiple_fmus_execution_test
[ 61%] Built target observer_multiple_slaves_test
[ 77%] Built target observer_initial_samples_test
[ 77%] Built target simulation_error_handling_test
[ 80%] Built target single_fmu_execution_test
[ 87%] Built target time_series_observer_test
[ 93%] Built target variable_metadata_test
In file included from /usr/include/string.h:535,
from /home/developper/DGA/libcosimc/tests/execution_from_ssp_test.c:6:
In function ‘strcpy’,
inlined from ‘main’ at /home/developper/DGA/libcosimc/tests/execution_from_ssp_test.c:63:9:
In file included from /usr/include/string.h:535,
from /home/developper/DGA/libcosimc/tests/execution_from_ssp_custom_algo_test.c:6:
In function ‘strcpy’,
inlined from ‘main’ at /home/developper/DGA/libcosimc/tests/execution_from_ssp_custom_algo_test.c:72:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:79:10: error: ‘__builtin___stpcpy_chk’ offset 2056 is out of the bounds [0, 2056] of object ‘infos’ with type ‘cosim_slave_info[2]’ [-Werror=array-bounds]
79 | return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:79:10: error: ‘__builtin___stpcpy_chk’ offset 2056 is out of the bounds [0, 2056] of object ‘infos’ with type ‘cosim_slave_info[2]’ [-Werror=array-bounds]
79 | return __builtin___strcpy_chk (__dest, __src, __glibc_objsize (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/developper/DGA/libcosimc/tests/execution_from_ssp_test.c: In function ‘main’:
/home/developper/DGA/libcosimc/tests/execution_from_ssp_custom_algo_test.c: In function ‘main’:
/home/developper/DGA/libcosimc/tests/execution_from_ssp_test.c:57:22: note: ‘infos’ declared here
57 | cosim_slave_info infos[2];
| ^~~~~
/home/developper/DGA/libcosimc/tests/execution_from_ssp_custom_algo_test.c:66:22: note: ‘infos’ declared here
66 | cosim_slave_info infos[2];
| ^~~~~
cc1: all warnings being treated as errors
cc1: all warnings being treated as errors
gmake[2]: *** [CMakeFiles/execution_from_ssp_custom_algo_test.dir/build.make:76: CMakeFiles/execution_from_ssp_custom_algo_test.dir/tests/execution_from_ssp_custom_algo_test.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:244: CMakeFiles/execution_from_ssp_custom_algo_test.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
gmake[2]: *** [CMakeFiles/execution_from_ssp_test.dir/build.make:76: CMakeFiles/execution_from_ssp_test.dir/tests/execution_from_ssp_test.c.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:270: CMakeFiles/execution_from_ssp_test.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
The solution is very simple and present on pull request #52 :
for tests execution_from_ssp_custom_algo_test.c, line 66, replace :
cosim_slave_info infos[2];
with
cosim_slave_info infos[3];
The same for execution_from_ssp_test.c, line 57
Could you fix it please?
Thank you!