ETSI's Bug Tracker - Part 01: TTCN-3 Core Language
View Issue Details

ID | Project | Category | View Status | Date Submitted | Last Update
0007136 | Part 01: TTCN-3 Core Language | Clarification | public | 11-08-2015 14:41 | 14-12-2015 11:44

Reporter | Tomas Urban |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.7.1 (published 2015-06) |
Target Version | v4.8.1 (published 2016-07) | Fixed in Version | v4.8.1 (published 2016-07) |
Clause Reference(s) | 6.2.7
Source (company - Author) | STF 487

Summary | 0007136: Value list size for arrays

Description

The rules for using value list notation for arrays don't specify what should happen if the value list contains a different amount of items than the array size. I assume that longer list is not allowed (using the rules describing arrays as a short-hand for a fixed size record-of and applying the constraint) and shorter value lists would be fine (just leaving the remaining items uninitialized). Nevertheless, I would prefer an explicit rule or note to be added into the specification to avoid any kind of different interpretations.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR7136_resolution_v1.docx (384,721) 03-11-2015 10:55 http://oldforge.etsi.org/mantis/file_download.php?file_id=3347&type=bug

Issue History
Date Modified | Username | Field | Change
11-08-2015 14:41 | Tomas Urban | New Issue |
21-09-2015 10:27 | Gyorgy Rethy | Target Version | => v4.8.1 (published 2016-07)
21-09-2015 15:01 | Gyorgy Rethy | Note Added: 0013214 |
21-09-2015 15:01 | Gyorgy Rethy | Assigned To | => Tomas Urban
21-09-2015 15:01 | Gyorgy Rethy | Status | new => feedback
21-09-2015 15:17 | Tomas Urban | Note Added: 0013216 |
21-09-2015 15:17 | Tomas Urban | Status | feedback => assigned
15-10-2015 13:54 | Jacob Wieland - Spirent | Note Added: 0013409 |
15-10-2015 13:55 | Jacob Wieland - Spirent | Note Added: 0013410 |
15-10-2015 13:55 | Jacob Wieland - Spirent | Assigned To | Tomas Urban => Gyorgy Rethy
15-10-2015 13:55 | Jacob Wieland - Spirent | Status | assigned => confirmed
02-11-2015 15:24 | Gyorgy Rethy | Note Added: 0013444 |
02-11-2015 15:25 | Gyorgy Rethy | Note Edited: 0013444 | bug_revision_view_page.php?bugnote_id=13444#r198
02-11-2015 15:25 | Gyorgy Rethy | Assigned To | Gyorgy Rethy => Jacob Wieland - Spirent
02-11-2015 15:25 | Gyorgy Rethy | Status | confirmed => assigned
03-11-2015 10:55 | Jacob Wieland - Spirent | File Added: CR7136_resolution_v1.docx |
03-11-2015 10:55 | Jacob Wieland - Spirent | Note Added: 0013461 |
03-11-2015 10:55 | Jacob Wieland - Spirent | Status | assigned => resolved
03-11-2015 10:55 | Jacob Wieland - Spirent | Fixed in Version | => v4.8.1 (published 2016-07)
03-11-2015 10:55 | Jacob Wieland - Spirent | Resolution | open => fixed
03-11-2015 10:55 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
14-12-2015 11:44 | Gyorgy Rethy | Note Added: 0013614 |
14-12-2015 11:44 | Gyorgy Rethy | Status | resolved => closed

Notes

(0013214)
Gyorgy Rethy
21-09-2015 15:01

STF discussion: There is no clear understanding what problem the CR wants to report. The relation of the number of items in a value list to the size of an array is unclear. Please elaborate the problem in more detail and provide an example.

(0013216)
Tomas Urban
21-09-2015 15:17

Examples:
var integer v_arr[3] := { 0, 1 }, // less elements than the size of the array
v_arr2[3] := { 0, 1, 2, 3 }; // more elements than the size of the array
Applying the rules for record of, the first assignment goes through and the second one produces an error. The problem is that the section on arrays doesn't say directly that these rules shall be apply, so there's a certain degree of uncertainty.
It would be nice to have explicit guidelines for these two cases.

(0013409)
Jacob Wieland - Spirent
15-10-2015 13:54

As arrays are just a different notation for record of types with fixed length restrictions (and maybe an offset), the same restrictions as for those apply.
In section 6.2.3 it is stated:
"Already initialized elements left without a corresponding list member in a value list notation (i.e. at the end of a list) are becoming uninitialized."
So it is explicitly allowed to assign a shorter list, even if it was already longer. The missing elements remain uninitialized. Since a longer list would definitely violate the fixed length restriction, that is out of the question, too.
Therefore, I think there is no action required here.

(0013410)
Jacob Wieland - Spirent
15-10-2015 13:55

confirm and resolve

(0013444)
Gyorgy Rethy
02-11-2015 15:24 (edited on: 02-11-2015 15:25)

I think what Tomas is missing is just an explicit statement or reference to 6.2.3.
Actually, in $6.2.3 we have:
"When using the value list notation, all elements in the structure shall be specified either with a value or the not used symbol "-". The first member of the list is assigned to the first element, the second list member is assigned to the second element, etc. No empty assignment is allowed (e.g. two commas, the second immediately following the first or only with white space between them). Elements to be left out of the assignment shall be explicitly skipped in the list by use of the not-used-symbol "-". Already initialized elements left without a corresponding list member in a value list notation (i.e. at the end of a list) are becoming uninitialized. In this way, a value with initialized elements can be made empty by using the empty value list notation ("{}")."
and in 6.2.7:
"The values of array elements shall be compatible with the corresponding variable or type declaration. Values may be assigned individually by a value list notation or indexed notation or more than one or all at once by a value list notation or index assignment notation. >>When the value list notation is used, the first value of the list is assigned to the first element of the array (the element with index 0 or the lower bound if an index range has been given), the second value to the next element, etc. Elements to be left out from the assignment shall be explicitly skipped in the list by using dash. For using the assignment notation for arrays, the rules described in 6.2.3 are valid for arrays as well.<<"
I think that the text in 6.2.7 between >> and << could be just replaced by
"For using the value list and the assignment notations for arrays, the rules described in 6.2.3 are valid for arrays as well."

(0013461)
Jacob Wieland - Spirent
03-11-2015 10:55

resolved according to Gyorgy's proposal

(0013614)
Gyorgy Rethy
14-12-2015 11:44

Added to draft V4.7.4