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

Bug 336

Summary: side-effect-free function detection is too constraining
Product: UPPAAL Reporter: Marius Mikučionis <marius>
Component: libutapAssignee: Gerd Behrmann <behrmann>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P1    
Version: 4.0.1   
Hardware: PC   
OS: All   
Architecture:

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.