Opened 10 years ago
Closed 4 years ago
#2936 closed defect (fixed)
Zero-length arrays size(arr, 2) crashes run-time
Reported by: | Martin Sjölund | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.16.0 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: |
Description
Example that triggers error with zero-length arrays: ModelicaTest.Tables.CombiTable2D.Test15
The stack is:
#0 0x00007ffff5effbb9 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff5f02fc8 in __GI_abort () at abort.c:89 #2 0x00007ffff5ef8a76 in __assert_fail_base ( fmt=0x7ffff604a370 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x407c18 "(i > 0) && (i <= a.ndims)", file=file@entry=0x407c32 "/usr/include/omc/c/util/base_array.h", line=line@entry=75, function=function@entry=0x407c57 "int size_of_dimension_base_array(const base_array_t, int)") at assert.c:92 #3 0x00007ffff5ef8b22 in __GI___assert_fail ( assertion=0x407c18 "(i > 0) && (i <= a.ndims)", file=0x407c32 "/usr/include/omc/c/util/base_array.h", line=75, function=0x407c57 "int size_of_dimension_base_array(const base_array_t, int)") at assert.c:101 #4 0x0000000000405a93 in size_of_dimension_base_array (a=..., i=2) at /usr/include/omc/c/util/base_array.h:75 #5 0x00000000004059df in omc_Modelica_Blocks_Types_ExternalCombiTable2D_constructor (threadData=0x7fffffffddb0, _tableName=0x407d19 "akima2D", _fileName=0x407d21 "/usr/lib/omlibrary/Modelica 3.2.1/Resources/Data/Tables/test_v4.mat", _table=..., _smoothness=3) at ModelicaTest.Tables.CombiTable2D.Test15_functions.c:40 #6 0x0000000000405d6e in ModelicaTest_Tables_CombiTable2D_Test15_callExternalObjectConstructors (data=0x7fffffffde60) at ModelicaTest.Tables.CombiTable2D.Test15_01exo.c:49 #7 0x00007ffff7865b61 in initializeModel () from /usr/lib/omc/libSimulationRuntimeC.so #8 0x00007ffff78669a4 in solver_main () from /usr/lib/omc/libSimulationRuntimeC.so #9 0x00007ffff78998ba in callSolver () from /usr/lib/omc/libSimulationRuntimeC.so #10 0x00007ffff789826c in startNonInteractiveSimulation () from /usr/lib/omc/libSimulationRuntimeC.so #11 0x00007ffff789ae59 in _main_SimulationRuntime () from /usr/lib/omc/libSimulationRuntimeC.so #12 0x000000000040557d in main ()
Code is:
simple_alloc_1d_base_array(&tmp1022, 0, NULL); $PtableID = omc_Modelica_Blocks_Types_ExternalCombiTable2D_constructor(threadData, "akima2D", "/usr/lib/omlibrary/Modelica 3.2.1/Resources/Data/Tables/test_v4.mat", tmp1022, 3);
Followed by:
size_of_dimension_base_array(_table, (modelica_integer) 2)
Change History (1)
comment:1 by , 4 years ago
Milestone: | Future → 1.16.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The model now works correctly in all the versions of ModelicaTest that we cover.