Opened 14 years ago
Last modified 14 years ago
#1361 closed defect (fixed)
Ranges with negative step (and possibly the ones with start larger than stop) are not handled correctly
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | critical | Milestone: | White December |
Component: | Instantiation | Version: | 1.6.0 |
Keywords: | Cc: | Adrian Pop, Adrian Pop, Per Östlund |
Description
For example, this model:
model NegativeRange parameter Integer start = 10; parameter Integer stop = 1; parameter Integer step = -1; Real a[start-stop + 1] = start:step:stop; end NegativeRange;
generates:
adrpo@kafka ~/dev/OpenModelicaBackend/build/bin $ ./omc NegativeRange.mo +d=failtrace +showErrorMessages class NegativeRange parameter Integer start = 10; parameter Integer stop = 1; parameter Integer step = -1; parameter Real a[1]; parameter Real a[2]; parameter Real a[3]; parameter Real a[4]; parameter Real a[5]; parameter Real a[6]; parameter Real a[7]; parameter Real a[8]; parameter Real a[9]; parameter Real a[10]; end NegativeRange;
Note:
See TracTickets
for help on using tickets.
Another example:
with even wronger result as component
a
disappears:Even code generation is wrong as we get:
in the generated code.