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

ID | Project | Category | View Status | Date Submitted | Last Update
0006762 | Part 01: TTCN-3 Core Language | Technical | public | 03-06-2014 09:23 | 04-01-2015 21:16

Reporter | Tomas Urban |
Assigned To | Gyorgy Rethy |
Priority | normal | Severity | minor | Reproducibility | N/A
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version | v4.7.1 (published 2015-06) |
Target Version | v4.7.1 (published 2015-06) | Fixed in Version | v4.7.1 (published 2015-06) |
Clause Reference(s) | 6.2.3
Source (company - Author) | Elvior

Summary | 0006762: Array indexing breaches strong typing principle

Description

A new rule was added into the chapter 6.2.3 in 4.6.1 saying that: "For multi-dimensional arrays or nested record of or set of types, an array or record of integer can be used as a short-hand notation for a nested index notation."
If the value in the index notation is of an record of type not constrained to a single length and dimension of the value is not known at compilation time, the type of the expression cannot be determined in compilation time. In other word, such a reference is not strongly typed. E.g.
type record of integer RoI;
...
var integer v_arr[2][2];
var RoI v_index;
if (rnd()< 0.5) { v_index := {0} }
else { v_index := { 0, 1 }
v_arr[v_index] := 2; // OK for v_index == {0, 1}, but not OK for v_index == {0}
Using not strongly typed data leads to problems with error discovery in compilation time. Besides, it constitutes a significant problem for TTCN-3 tools that are dependent on strong typing as value references can appear in many syntactical constructions and all these places have to be fitted with a runtime type resolution.
Proposal:
Allow using values of record of inside the index notation only if the record of is restricted to a single length.
Alternative proposal:
Add a rule saying that in case the index value is of a record of type not constrained to a single length that is not a constant fulfilling conditions imposed by the restriction 10.b, an error will be generated if the indexing value contains a different number of elements than the dimension of the value being indexed.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.

Relationships

related to | 0006646 | closed | Gyorgy Rethy | Missing semantic rules for the index and assignment notation
related to | 0006645 | closed | Gyorgy Rethy | Rules for array values

Attached Files | CR6762_v1.docx (54,934) 08-10-2014 11:37 http://oldforge.etsi.org/mantis/file_download.php?file_id=3112&type=bug

Issue History
Date Modified | Username | Field | Change
03-06-2014 09:23 | Tomas Urban | New Issue |
03-06-2014 09:45 | Jacob Wieland - Spirent | Note Added: 0012068 |
03-06-2014 09:49 | Jacob Wieland - Spirent | Note Edited: 0012068 | bug_revision_view_page.php?bugnote_id=12068#r21
07-10-2014 14:50 | Tomas Urban | Assigned To | => Tomas Urban
07-10-2014 14:50 | Tomas Urban | Status | new => assigned
08-10-2014 10:28 | Tomas Urban | Description Updated | bug_revision_view_page.php?rev_id=77#r77
08-10-2014 11:25 | Tomas Urban | Relationship added | related to 0006646
08-10-2014 11:37 | Tomas Urban | File Added: CR6762_v1.docx |
08-10-2014 11:37 | Tomas Urban | Note Added: 0012279 |
08-10-2014 11:37 | Tomas Urban | Assigned To | Tomas Urban => Jens Grabowski
08-10-2014 11:37 | Tomas Urban | Status | assigned => confirmed
08-10-2014 14:27 | Jens Grabowski | Status | confirmed => resolved
08-10-2014 14:27 | Jens Grabowski | Resolution | open => fixed
08-10-2014 14:27 | Jens Grabowski | Assigned To | Jens Grabowski => Gyorgy Rethy
05-11-2014 09:46 | Tomas Urban | Relationship added | related to 0006645
04-01-2015 21:16 | Gyorgy Rethy | Note Added: 0012616 |
04-01-2015 21:16 | Gyorgy Rethy | Status | resolved => closed
04-01-2015 21:16 | Gyorgy Rethy | Fixed in Version | => v4.7.1 (published 2015-06)

Notes

(0012068)
Jacob Wieland - Spirent
03-06-2014 09:45 (edited on: 03-06-2014 09:49)

I agree, I also think it should be restricted to arrays of known dimensions and only arrays of the right number of dimensions should be allowed which, of course, is only checkable at runtime, but can be assumed to be true at compile-time.
If that is not the case, you get problem with generics (if the array type is generic over its element type, the dimensions could not be discernable if the dimensions of the element-type need to be taken into account as well).
So, in my opinion, only direct lists of ArraySpec consitute a dimension-specifiction.
This would mean that:
type integer A[5][6] has two dimensions
type A B[10][10] also has two dimensions

(0012279)
Tomas Urban
08-10-2014 11:37

Resolution uploaded. Please check.

(0012616)
Gyorgy Rethy
04-01-2015 21:16

Added to draft V4.6.3