nimble-code / Spin

Explicit state logic model checking tool -- 2002 winner of the ACM System Software Award.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

syntax sugar problem

kailiangji opened this issue · comments

spin does not work well on the following example. If the type of the chan element is a reference, it works.
active proctype test() {
int i;
chan x = [4] of { int };
x ! 1;
x ! 2;
x ! 3;
x ! 4;
for (i in x) {
printf("i = %d\n", i);
}
}

typedef Int {
int v;
}
active proctype test() {
Int i;
chan x = [4] of { Int };
x ! 1;
x ! 2;
x ! 3;
x ! 4;
for (i in x) {
printf("i = %d\n", i.v);
}
}

interesting! will check it

It is true that this fails, but the manual page
http://spinroot.com/spin/Man/for.html
mentions this explicitly:

"The third use of the for statement is to retrieve all messages from a channel in sequence. To be able to do this the channel has to be defined in a special way, with a single user-defined type as its contents."