Logo etsi

ETSI's Bug Tracker

Notice: information submitted on the ETSI issue Tracker may be incorporated in ETSI publication(s) and therefore subject to the ETSI IPR policy.

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007116Part 01: TTCN-3 Core LanguageTechnicalpublic28-07-2015 14:3114-10-2015 12:44
ReporterTomas Urban 
Assigned ToGyorgy Rethy 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Versionv4.7.1 (published 2015-06) 
Target Versionv4.8.1 (published 2016-07)Fixed in Versionv4.8.1 (published 2016-07) 
Summary0007116: Actual parameters of out formal template parameters
DescriptionVariables and formal value parameters should not be mentioned in the following rule:

Actual parameters that are passed to out formal template parameters shall be variables, template variables, formal value parameters, formal template parameters or references to elements of variables, template variables, formal value parameters or formal template parameters of structured types.

That's because it allows to assign template to value. Consider the following example:

Actual parameters that are passed to out formal template parameters shall be template variables, formal template parameters or references to elements of template variables or formal template parameters of structured types.

function f(out template integer p) {
  p := ?;
}

control {
  var integer v;
  f(v); // after the function call, v would contain a matching symbol!!!
}

Proposal: Change the rule to:
TagsNo tags attached.
Clause Reference(s)5.4.2
Source (company - Author)STF 487
Attached Files

- Relationships
related to 0007114closedGyorgy Rethy Actual parameters of out formal value parameters not defined 

-  Notes
(0013009)
Tomas Urban (reporter)
29-07-2015 11:39

The changed rule should be:
Actual parameters that are passed to out formal template parameters shall be template variables, formal template parameters or references to elements of template variables or formal template parameters of structured types.
(0013010)
Tomas Urban (reporter)
30-07-2015 10:04

It should be also possible to use references to string items as actual parameters of out formal value parameters.

Example:

function f (out charstring p_out) {
   p_out := "r";
}

control {
  var charstring v_str := "test";
  f(v_str[0]); // similar to assignment such as v_str[0] := "r"
  log(v_str); // prints "rest"
}
(0013019)
Gyorgy Rethy (reporter)
03-08-2015 10:46
edited on: 04-08-2015 11:21

STF discussion 03-08-2015: Could be a potentially backward incompatible change. Ask tool vendors; send out a simple example code and ask for the result.

(0013021)
Tomas Urban (reporter)
03-08-2015 10:53

Just a note: In case the STF decides that the references are resolved at the moment of passing of the formal parameter value to the actual parameter (i.e. this is the moment of passing the actual parameter to the formal parameter), the following rule has to be changed so that it doesn't include out parameters anymore: The actual parameters are evaluated in the order of their appearance.
(0013054)
Gyorgy Rethy (reporter)
04-08-2015 11:40

I think your comment is partly correct, I would say the rule should be refined:
- in fact, the actual parameter itself passed to an out parameter shall not be evaluated when entering the called function (it shall not be an expression anyway, just a "bare" variable that will be overwritten, so evaluating it or not "theoretically", doesn't change anything)
- but if the actual parameter is a member of an array (of any kind), than the index has to be evaluated to know, which array member is the actual actual :-) parameter; there is no reason to make this evaluation in another order than the general parameter evaluation.
(0013056)
Gyorgy Rethy (reporter)
04-08-2015 11:54
edited on: 04-08-2015 12:56

Looking at the CR again, in more detail, in fact the question is if we allow passing value variables to template formal parameters?
If yes,
- it may cause runtime error when trying returning a matching mechanism from the function,
- or an implicit valueof if the formal parameter returns a concrete value,
but is backward compatible, as this is not forbidden today.
- and this is true for inout parameters as well...

But if all tools are so cautious that forbids this at the semantic check level, it can also be made explicit in the standard.

One way or another, but some clarification will be needed...

(0013069)
Jacob Wieland - Spirent (reporter)
04-08-2015 14:58

I have addressed these issues also in the CR 7114 resolution proposal.

But, of course, because of the possible backward incompatibility (in case that an out parameter is declared as template but always filled with a value when used with an actual value parameter), we should still ask the tool vendors about this.

Basically, it should DEFINITELY be an error if an actual value parameter is used for a template formal parameter which is assigned a matching mechanism. The question is only, if it is rejected at compile-time just on the basis of the parameter and type declarations or other inferrable means or if it is rejected at runtime when the out-parameter-template is assigned back to the actual-value-parameter.
(0013385)
Gyorgy Rethy (reporter)
14-10-2015 12:44

Resolved by CR 7114 already
(0013386)
Gyorgy Rethy (reporter)
14-10-2015 12:44

Resolved by CR 7114.

- Issue History
Date Modified Username Field Change
28-07-2015 14:31 Tomas Urban New Issue
29-07-2015 11:39 Tomas Urban Note Added: 0013009
30-07-2015 10:04 Tomas Urban Note Added: 0013010
03-08-2015 10:46 Gyorgy Rethy Note Added: 0013019
03-08-2015 10:46 Gyorgy Rethy Assigned To => Gyorgy Rethy
03-08-2015 10:46 Gyorgy Rethy Status new => assigned
03-08-2015 10:53 Tomas Urban Note Added: 0013021
04-08-2015 11:21 Gyorgy Rethy Note Edited: 0013019 View Revisions
04-08-2015 11:40 Gyorgy Rethy Note Added: 0013054
04-08-2015 11:54 Gyorgy Rethy Note Added: 0013056
04-08-2015 12:56 Gyorgy Rethy Note Edited: 0013056 View Revisions
04-08-2015 14:58 Jacob Wieland - Spirent Note Added: 0013069
06-08-2015 10:16 Gyorgy Rethy Relationship added related to 0007114
07-08-2015 09:05 Jacob Wieland - Spirent Status assigned => confirmed
25-09-2015 10:58 Gyorgy Rethy Target Version => v4.8.1 (published 2016-07)
14-10-2015 12:44 Gyorgy Rethy Note Added: 0013385
14-10-2015 12:44 Gyorgy Rethy Note Added: 0013386
14-10-2015 12:44 Gyorgy Rethy Status confirmed => closed
14-10-2015 12:44 Gyorgy Rethy Resolution open => fixed
14-10-2015 12:44 Gyorgy Rethy Fixed in Version => v4.8.1 (published 2016-07)


MantisBT 1.2.14 [^]
Copyright © 2000 - 2024 MantisBT Team
Powered by Mantis Bugtracker