mpictor/StepClassLibrary — Issue #155: fedex_plus - array bounds calculated by function are garbage
Author: mpictor
Created: 2012-03-09 01:23:44+00:00
State: open

Using this schema, a subset of 242:

SCHEMA array_bounds_from_fn;

TYPE ypr_rotation = ARRAY [ypr_index(yaw) : ypr_index(roll)]
OF plane_angle_measure;
END_TYPE;

TYPE plane_angle_measure = REAL;
END_TYPE;

TYPE ypr_enumeration = ENUMERATION OF
(yaw,
pitch,
roll);
END_TYPE;

FUNCTION ypr_index (ypr : ypr_enumeration) : INTEGER;
CASE ypr OF
yaw : RETURN (1);
pitch : RETURN (2);
roll : RETURN (3);
END_CASE;
RETURN (?);
END_FUNCTION;

END_SCHEMA;

As with the code generated for ap242, bounds 1 and 2 are the same. The numbers seem to be garbage, and **running fedex_plus multiple times results in multiple values**.

`$ grep ypr_rotation SdaiARRAY_BOUNDS_FROM_FN.init.cc`

```C
array_bounds_from_fn::t_ypr_rotation->Bound1(34535192);
array_bounds_from_fn::t_ypr_rotation->Bound2(34535192);
```

after running fedex_plus again:

```C
array_bounds_from_fn::t_ypr_rotation->Bound1(11556632);
array_bounds_from_fn::t_ypr_rotation->Bound2(11556632);
```