The CONVECS team is pleased to announce
that version 3.5 of the TRAIAN compiler for LOTOS NT is available.
TRAIAN 3.5 brings two language changes, four code-generation changes,
twenty-four static-semantics changes, and ten bug fixes (see below
their description).
TRAIAN 3.5 introduces various changes to the LOTOS NT language in order to further align it with the LNT language supported by the CADP toolbox. The LOTOS NT Reference Manual and the style files for text editors have been updated to reflect these changes.
variable X not assigned in this branch but in some other branch(es)was removed. On the one hand, this warning was incompletely implemented, as certain situations were not reported. On the other hand, removing this warning allows one to write LOTOS NT code more freely, without being forced to assign the same variables in all branches of "if", "case", and "trap" instructions. See item 292 in the HISTORY.txt file.
handler for event E never executedto report when a "trap" instruction has a handler for some event E but does not raise E in its body, e.g.,
trap exception E is ... in return false end trapSee item 295 in the HISTORY.txt file.
event parameter E never usedto draw attention to functions declaring an event parameter that is not used in the body of the function. See item 296 in the HISTORY.txt file.
variable parameter X never usedto report when a function declares a variable parameter X that is not used in the body of the function. See item 297 in the HISTORY.txt file.
useless assignment to Xto report about variables that are assigned values never used later. To avoid such warnings, the existing LOTOS NT code needs to be cleaned up in various ways:
loop label L never usedto draw attention to loops that are declared with a label L and whose body contains no "break L" instruction. See item 300 in the HISTORY.txt file.
function F (...) : BOOL is loop L in loop null end loop end loop; return false end functionnow triggers the following warning for its "return" line:
dead code after infinite loopSee item 301 in the HISTORY.txt file.
"in" parameter X overwritten before used (should be a local variable)See item 307 in the HISTORY.txt file.
"in out" parameter X never modified (should be an "in" parameter)See item 308 in the HISTORY.txt file.
"in out" parameter X overwritten before used (should be an "out" parameter)See item 309 in the HISTORY.txt file.
"in" parameter X modified (should be an "in var" parameter)See item 310 in the HISTORY.txt file.
"out" parameter X both used and modified (should be an "out var" parameter)See item 311 in the HISTORY.txt file.
variable parameter X never usedis also emitted for "in var" parameters, as well as for "in" parameters. See item 313 in the HISTORY.txt file.
"in var" parameter X never modified (should be an "in" parameter)and
"in var" parameter X overwritten before used (should be a local variable)See item 314 in the HISTORY.txt file.
"out var" parameter X never used (should be an "out" parameter)and
"in out" parameter X overwritten before used (should be an "out var" parameter)See item 315 in the HISTORY.txt file.
infinite loop inside another loopwas replaced by a new, simpler warning:
infinite loopthat is triggered more frequently, due to the more precise data-flow analysis performed by TRAIAN. For instance, this warning is now triggered by the following LOTOS NT programs:
function F1 is var N : int in N := 0; loop N := N + 1 end loop end var end function function F2 is loop trap exception E is null in raise E end trap end loop end functionSee item 316 in the HISTORY.txt file.
loop body is executed at most onceto detect "loop" instructions that are useless because the loop body is executed zero or one time at most, due to "break", "raise", or "return" instructions (or nested infinite loops as well) that are necessarily executed, e.g.:
loop raise E end loopSee item 318 in the HISTORY.txt file.
function with "out" parameter(s) but no normal terminationwhich is emitted for functions such as:
function F1 [E : none] (out X : BOOL) is X := true; raise E end function function F2 (out var X : Int) is X := 0; loop X := X + 1 end loop end functionThis warning replaces an error message:
function F may return without assigning parameter Xthat was too restrictive. See item 319 in the HISTORY.txt file.
function with "in out" parameter(s) but no normal terminationSee item 320 in the HISTORY.txt file.
function with result but no normal terminationwhich is emitted for LOTOS NT programs such as:
function G [E : none] : bool is raise E end functionSee item 321 in the HISTORY.txt file.
process MAIN is i end processis now accepted by TRAIAN, whereas it was previously rejected with a error message:
event i is declared with channel NONE instead of anySee item 323 in the HISTORY.txt file.
function F [E : none] (X : BOOL) : BOOL is if X then loop null end loop else raise E end if; return X -- warning here end functionwill trigger a warning of the form:
dead code after infinite loop and "raise" instructionwhereas the following code fragment:
function F (X : BOOL) : BOOL is loop L in if X then return TRUE else break L end if; return X -- warning here end loop; return FALSE end functionwill trigger a warning of the form:
dead code after "break" and "return" instructionSee item 324 in the HISTORY.txt file.
function F (a, b, c, d : int, out q1, q2 : int) : nat is trap exception E1 is return 1 exception E2 is return 2 in q1 := a div[E1] b; q2 := c div[E2] d end trap; return 0 end functionThis program is now rejected with an error message stating that q1 and q2 may be, in certain cases, uninitialized when F returns. Also, some irrelevant warnings of the form:
variable X not assigned in this branch but in some other branch(es)have been suppressed. See item 288 in the HISTORY.txt file.
variable X may be uninitializedFor instance, the following programs are now accepted:
function F1 (X : NAT) : NAT is var N : NAT in if X == 0 then return 1 else N := X + 1 end if; return N -- there was an error: variable N may be uninitialized end var end function function F2 (X : NAT) : NAT is var N : NAT in case X in 0 -< return 1 | N -lt; N := N + 1 end case; return N -- there was an error: variable N may be uninitialized end var end function function F3 (X : NAT) : NAT is var N : NAT in trap exception E is N := 0 in case X -[E] 1 in 0 -< return 1 | N -< N := N + 1 end case end trap; return N -- there was an error: variable N may be uninitialized end var end function function F4 [E : none] (X : int) : bool is var Y : bool in if X < 0 then raise E else Y := X + 1 end if ; return Y -- there was an error: variable may be uninitialized end var end functionSee item 290 in the HISTORY.txt file.
"return" inside a loopthat was irrelevant, as the targeted problem was actually not the presence of a "return" in a loop, but the fact that the loop was executed only once because of this "return" instruction. See item 293 in the HISTORY.txt file.
function F may return without assigning parameter Yif they raised an exception in some branch of an "if" or "case" instruction, e.g.,
function F [E : none] (X : T, out Y : bool) is case X in NIL -> raise E | any -> Y := X end case end functionSee item 294 in the HISTORY.txt file.
function F (X: Bool) : Bool is loop L in return (X) end loop end functionwith the following error message:
function F may terminate without returning a valueSee item 299 in the HISTORY.txt file.
function F (X : nat) : nat is return X + 1; X := X + 1 end functionwith the following error message:
function F may terminate without returning a valueSee item 302 in the HISTORY.txt file.
dead code following a "return" instructionconcerning "for" and "while" loops with false conditions. For instance, programs such as: for ... while FALSE by ... loop return TRUE end loop; return FALSE no longer trigger the following warning: since TRAIAN knows that the loop will never be executed. See item 303 in the HISTORY.txt file.
incomplete patterns in "case" instructionSuch warnings are no longer emitted, and their message was enhanced to be more precise and more informative. See item 305 in the HISTORY.txt file.
TRAIAN 3.5 can be freely downloaded from the TRAIAN Web Page located at: