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

ID | Project | Category | View Status | Date Submitted | Last Update
0008004 | Part 01: TTCN-3 Core Language | Clarification | public | 16-02-2021 08:50 | 23-11-2021 11:42

Reporter | Tomas Urban |
Assigned To | Jens Grabowski |
Priority | normal | Severity | minor | Reproducibility | have not tried
Status | closed | Resolution | fixed |
Platform |  | OS |  | OS Version |
Product Version |  |
Target Version |  | Fixed in Version |  |
Clause Reference(s) | 11.1, 11.2, 16.1.0
Source (company - Author) | Elvior OÜ

Summary | 0008004: Unassigned variables in return statements

Description

The rules for using unassigned variables seem to be inconsistent. The rule for template variables (11.2.d) states:
"Use of uninitialized template variables at other places than the left hand side of assignments, in return statements, or as actual parameters passed to formal parameters shall cause an error."
There's a similar rule for value variables (11.1.d).
However, the rule for functions returning templates 16.1.0.h states: "The return statement shall return a template that is at least partially initialized."
Functions returning values are not restricted in such a way which makes returning an uninitialized value theoretically possible. But what are the rules for assignment in such case? Will it overwrite a variable or leave it unchanged? And if there's this option why it is not possible to use an uninitialized variable on the right side of an assignment directly?
In my opinion, uninitialized values should not occur in return statements at all. I suggest to modify the rules 11.1.d and 11.2.d and remove the words "return statement" from them. In addition to that, the rules for functions should contain a new restriction saying that the value or template returned by a function should be at least partially initialized. The restriction 16.1.0 can be shortened then.

Steps To Reproduce |
Additional Information |
Tags | No tags attached.
Relationships |
Attached Files | CR8004-1.docx (200,095) 09-09-2021 07:35 http://oldforge.etsi.org/mantis/file_download.php?file_id=4007&type=bug CR8004-2.docx (177,281) 09-09-2021 12:17 http://oldforge.etsi.org/mantis/file_download.php?file_id=4012&type=bug

Issue History
Date Modified | Username | Field | Change
16-02-2021 08:50 | Tomas Urban | New Issue |
23-03-2021 16:15 | Jens Grabowski | Project | TTCN-3 Change Requests => Part 01: TTCN-3 Core Language
27-04-2021 13:18 | Wolfgang Seka | Note Added: 0015929 |
06-09-2021 09:55 | Jens Grabowski | Note Added: 0015935 |
06-09-2021 09:56 | Jens Grabowski | Assigned To | => Tomas Urban
06-09-2021 09:56 | Jens Grabowski | Status | new => assigned
09-09-2021 07:35 | Tomas Urban | File Added: CR8004-1.docx |
09-09-2021 07:35 | Tomas Urban | Note Added: 0015961 |
09-09-2021 07:35 | Tomas Urban | Assigned To | Tomas Urban => Jacob Wieland - Spirent
09-09-2021 07:35 | Tomas Urban | Status | assigned => confirmed
09-09-2021 12:17 | Jacob Wieland - Spirent | File Added: CR8004-2.docx |
09-09-2021 12:18 | Jacob Wieland - Spirent | Status | confirmed => assigned
09-09-2021 12:18 | Jacob Wieland - Spirent | Note Added: 0015968 |
09-09-2021 12:18 | Jacob Wieland - Spirent | Assigned To | Jacob Wieland - Spirent => Tomas Urban
09-09-2021 12:18 | Jacob Wieland - Spirent | Status | assigned => confirmed
10-09-2021 08:22 | Tomas Urban | Note Added: 0015973 |
10-09-2021 08:22 | Tomas Urban | Status | confirmed => resolved
10-09-2021 08:22 | Tomas Urban | Resolution | open => fixed
10-09-2021 08:22 | Tomas Urban | Assigned To | Tomas Urban => Jens Grabowski
23-11-2021 11:42 | Jens Grabowski | Note Added: 0016095 |
23-11-2021 11:42 | Jens Grabowski | Status | resolved => closed

Notes

(0015929)
Wolfgang Seka
27-04-2021 13:18

We've had a discussion in this area some year ago already:
We have cases where the return value of a function is only used in specific cases (depending on the parameters).
=> For these functions it needs to be allowed to return an uninitialised variable (or more precise, to use an uninitialised variable in the return statement).
Nevertheless in cases when the function returns an uninitialised variable, the return value shall not be used, i.e. the function call shall not be at the right hand side of an assignment.
This is what we have in our test suites and therefore any further restriction would be a non-backward (i.e. not acceptable) change.

(0015935)
Jens Grabowski
06-09-2021 09:55

STF discussion: Remove resctriction 16.1.0.h and add a rule for functions returning uninitialized values (maybe as 16.1.1 g).

(0015961)
Tomas Urban
09-09-2021 07:35

Resolution uploaded, please review.

(0015968)
Jacob Wieland - Spirent
09-09-2021 12:18

Fixed a typo and changed some wording. Please review

(0015973)
Tomas Urban
10-09-2021 08:22

I agree with the corrections made by Jacob. The last draft resolves the issue raised in this CR and can be added to the next version of the core language specification.

(0016095)
Jens Grabowski
23-11-2021 11:42

implemented