Opened 7 years ago
Closed 6 years ago
#4904 closed defect (fixed)
Creating ExternalObject with constant arguments can generate bad code
Reported by: | Per Östlund | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | Code Generation | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: |
Description
Creating e.g. an ExternalCombiTimeTable using constant arguments like this:
model M Modelica.Blocks.Types.ExternalCombiTimeTable tableID = Modelica.Blocks.Types.ExternalCombiTimeTable( "test", "test", {{1, 2}, {3, 4}}, 0.0, {1}, Modelica.Blocks.Types.Smoothness.LinearSegments, Modelica.Blocks.Types.Extrapolation.LastTwoPoints); end M;
will cause the simulation to segfault due to a call in the generated code for the constructor:
pack_integer_array(&_columns);
The issue seems to be that pack_integer_array
modifies the array instead of creating a new array, but the given array in this case is a #DEFINE'd literal that can't be modified.
Note:
See TracTickets
for help on using tickets.
Fixed in 3f21797.