[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlaplus] Re: How come TLA never hits the assert?



I'll try to answer my own question: this is a (weird) side effect of the call to masterWrite: it did not have a return it. Adding a return fixed this problem.
Apparently failing to run return does not revert procedure's local variables to their initial, default value. For imperative C/C++ programmers like me,
it's an unexpected side effect. 

On Sunday, November 15, 2020 at 4:59:59 PM UTC-5 recepient recepient wrote:
Consider this process definition in which everything seems to run except, that once the if-then is evaluated, the assert is never hit. Without the assert, the process never seems to run the goto command either.

process MainProc \in NumClients+1..NumClients+1

variable rpc, msg;

begin

master_dequeue:

    print "await master_dequeue";

    await MasterInQueue /= <<>>;

    (* print << "master pre-dequeue:", MasterInQueue>>; *)

    rpc:=Head(MasterInQueue);

    MasterInQueue:=Tail(MasterInQueue);

    (* print << "master post-dequeue:", MasterInQueue>>; *)

master_combine:

    rpc := rpc \o << MasterSequence >>;

    Message := Message \o rpc;

    MasterSequence:=MasterSequence+1;

master_handler:

    if (rpc[RpcOpIdx]=OP_GET)

    then

        skip;

    else

        call masterWrite(rpc);

    end if;

master_cont:

    assert FALSE;

    print "goto master_dequeue";

    goto master_dequeue;

end process;

--
You received this message because you are subscribed to the Google Groups "tlaplus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tlaplus+unsubscribe@xxxxxxxxxxxxxxxx.
To view this discussion on the web visit https://groups.google.com/d/msgid/tlaplus/127f552b-ce15-4dd7-8675-4d1558ce541bn%40googlegroups.com.