Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when sending a constant to a channel with a defined channel type #695

Open
ArquintL opened this issue Oct 26, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working channels encoding

Comments

@ArquintL
Copy link
Member

The following program causes a violation during encoding:

type ChannelMsgType int

const ChannelMsg ChannelMsgType = 42

pred sendInvariant(v ChannelMsgType) {
    true
}

requires acc(channel.SendChannel(), 1/2)
requires channel.SendGivenPerm() == sendInvariant!<_!>
requires channel.SendGotPerm() == PredTrue!<!>
func sendMsg(channel chan ChannelMsgType) {
    fold sendInvariant!<_!>(ChannelMsg)
    fold PredTrue!<!>()
    assert acc(channel.SendChannel(), _) && sendInvariant!<_!>(ChannelMsg)
    assert acc(channel.SendChannel(), _) && channel.SendGivenPerm()(ChannelMsg)
    channel <- ChannelMsg
}

The channel encoding checks whether the message type is identical to the channel type. This is however not the case here because constant propagation replaces ChannelMsg with 42, i.e., an integer literal.

@ArquintL ArquintL added bug Something isn't working encoding channels labels Oct 26, 2023
@ArquintL ArquintL self-assigned this Oct 26, 2023
@ArquintL ArquintL mentioned this issue Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working channels encoding
Projects
None yet
Development

No branches or pull requests

1 participant