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

Incorrect Error: type-clash in send, (value <-> chan )

Drodt opened this issue · comments

We teach model checking with Spin and one of our students encountered a type checking error which appears to be incorrect.

Consider this model:

chan request = [2] of { byte, chan }; 

active [2] proctype Server() {
  byte client; 
  chan replyChannel; 
  do
    :: request ? client, replyChannel ->
          printf("Client %d processed by server %d\n", client, _pid); 
          replyChannel ! _pid
  od
}

active [5] proctype Client() {
  byte server; 
  chan reply = [1] of { byte };

  do     
    :: full(request) -> 
         printf("Client %d idle\n", _pid); 
    :: request ! _pid, reply ->
         printf("Client %d sends a request\n",_pid);
         reply ? server; 
         printf("Reply received from server %d by client  %d\n", server, _pid)
  od
}

There should be no type errors wrt the channels. However, when we set spin to verbose, it outputs:

spin: exercise3.pml:22, Error: type-clash in send, (value <-> chan  )

I did some digging, and it appears that the type of the channel-slot is not correct and set to seemingly random integers during the type checking. During initialization of the channel, all appears normal. I do not know much C, but I think that is correct.

agreed -- this was a bug -- fixed in todays update (may 30, 2023) together with a few other pending fixes.
thanks for reporting this!