This issue tracker is closed. Please visit UPPAAL issue tracker at Github instead.

Bug 336 - side-effect-free function detection is too constraining
Summary: side-effect-free function detection is too constraining
Status: RESOLVED FIXED
Alias: None
Product: UPPAAL
Classification: Unclassified
Component: libutap (show other bugs)
Version: 4.0.1
Hardware: PC All
: P1 normal
Assignee: Gerd Behrmann
URL:
Depends on:
Blocks:
 
Reported: 2006-07-12 16:51 CEST by Marius Mikučionis
Modified: 2006-12-11 15:51 CET (History)
0 users

See Also:
Architecture:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Mikučionis 2006-07-12 16:51:31 CEST
the following code is detected as non-side-effect-free when used in guard:

int getIndex(const int &set[MAXLEN], const int &v) {
    int i;
    for (i=0; i<MAXLEN; ++i) // iterate through entire array
        if (v == set[i]) return i;
    return -1;
}

the function works fine when reference symbol is removed
(which means value passing by value instead of faster passing by reference).
Comment 1 Gerd Behrmann 2006-07-13 10:19:08 CEST
This is strictly speaking not a bug in UPPAAL, but a problem in the language. The problem is with the array parameter only; it is not a reference to a constant array of integers, but a reference to an array of constant integers. Therefore the  type checker does not realise that the argument cannot be modified by the function.

I will try to make a workaround for this.
Comment 2 Gerd Behrmann 2006-07-13 10:38:24 CEST
Fixed on the 4.0 branch from rev. 2429.
Comment 3 Gerd Behrmann 2006-12-11 15:51:04 CET
Fixed on the trunk from rev. 2853.