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

ID | Project | Category | View Status | Date Submitted | Last Update
0007118 | Part 01: TTCN-3 Core Language | Technical | public | 31-07-2015 11:18 | 03-11-2015 09: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) | 5.4.2
Source (company - Author) | STF 487

Summary | 0007118: Not clear when actual parameter passing occurs

Description

The current rules for actual parameters use the term "actual parameter passing" in several places. It is described how it works (the scope, involved objects etc.), but not when it occurs (or at least not explicitly).
Although not specified explicitly, the moment of actual parameter passing is set by the other rules for in and inout parameters - it has to occur before entering the parameterized content, i.e. before the bounding process specified in the section 3.1.
However, the situation is ambiguous in case of out parameters. The actual parameter value is not needed inside the parameterized content and there are rules saying that passing of the formal parameter to the actual parameter (which is not the same as actual parameter passing) occurs after invocation of the parameterized object. The question is then whether actual parameter passing occurs at this point (at the end of the invocation) or before invocation.
Consider the following example:
type component GeneralComp {
var integer vc_index := 0;
}
type record of integer RI;
function f_test(out integer p_par1) runs on GeneralComp {
vc_index := 1;
p_par1 := 10;
}
testcase TC_Sem_050402_actual_parameters_168() runs on GeneralComp {
var RI v_ri := { 1, 2 }
f_test(v_ri[vc_index]); // tested parameter passing
log(v_ri); // will we get { 1, 10 } or { 10, 2 } ?
}
In my opinion, the actual parameter passing shall occur at the moment of invocation, thus the example above should produce { 10, 2 }.
In order to remove all possible ambiguities, I propose to add the following sentence to the section 5.4.2:
Actual parameters are passed to formal parameters before invoking the parametrized object.

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

Relationships

related to | 0007114 | closed | Gyorgy Rethy | Actual parameters of out formal value parameters not defined

Attached Files |

Issue History
Date Modified | Username | Field | Change
31-07-2015 11:18 | Tomas Urban | New Issue |
03-08-2015 09:40 | Gyorgy Rethy | Note Added: 0013013 |
03-08-2015 09:57 | Tomas Urban | Note Added: 0013014 |
03-08-2015 10:28 | Gyorgy Rethy | Note Added: 0013016 |
03-08-2015 10:29 | Gyorgy Rethy | Assigned To | => Jacob Wieland - Spirent
03-08-2015 10:29 | Gyorgy Rethy | Status | new => assigned
04-08-2015 14:36 | Jacob Wieland - Spirent | Note Added: 0013065 |
04-08-2015 14:36 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Gyorgy Rethy
04-08-2015 14:36 | Jacob Wieland - Spirent | Status | assigned => confirmed
04-08-2015 14:36 | Jacob Wieland - Spirent | Relationship added | related to 0007114
25-09-2015 10:58 | Gyorgy Rethy | Target Version | => v4.8.1 (published 2016-07)
03-11-2015 09:44 | Gyorgy Rethy | Note Added: 0013452 |
03-11-2015 09:44 | Gyorgy Rethy | Status | confirmed => closed
03-11-2015 09:44 | Gyorgy Rethy | Resolution | open => fixed
03-11-2015 09:44 | Gyorgy Rethy | Fixed in Version | => v4.8.1 (published 2016-07)

Notes

(0013013)
Gyorgy Rethy
03-08-2015 09:40

I think that out parameters return values are passed back to the calling entity at the moment when the called function reaches its end or return. Shall be checked the standard's text if the moment of passing parameter values back is specified.

(0013014)
Tomas Urban
03-08-2015 09:57

The problem raised within this CR is not about passing the value to the out parameter. This is clear and well specified. The issue concerns the fact that it is not know when the "binding" between the actual and formal parameter occurs (actual parameter passing is the TTCN-3 term used for this binding) - whether it is before the parameterized statements starts execution or after that.
The issue is important, because the reference used as an actual parameter might contain items (such as array indexes) that can be changed within the parameterized content. The problem with the reference containing an index is demonstrated in the example attached to the original CR.
In case of mainstream programming languages, out parameters are used e.g. in C# where references used as actual parameters are resolved before executing parameterized content and not at the moment of value assignment from the formal parameter to the actual parameter. I would expect the same behaviour from TTCN-3.

(0013016)
Gyorgy Rethy
03-08-2015 10:28

STF discussion 03-08-2015: Check possible unambiguity and add text if needed. Add the example even if no unambiguity is identified.

(0013065)
Jacob Wieland - Spirent
04-08-2015 14:36

see resolution proposal CR 7114

(0013452)
Gyorgy Rethy
03-11-2015 09:44

Resolution can be found in CR7114