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

[bmv2] conditional execution + negation #137

Closed
smolkaj opened this issue Nov 5, 2016 · 1 comment
Closed

[bmv2] conditional execution + negation #137

smolkaj opened this issue Nov 5, 2016 · 1 comment

Comments

@smolkaj
Copy link
Member

smolkaj commented Nov 5, 2016

Invoking a table inside the condition of a if-then statement leads to the following error:

terminate called after throwing an instance of 'Util::CompilerBug'
  what():  COMPILER BUG: ../backends/bmv2/jsonconverter.cpp:202
multicast.p4(397): do_process_multicast_do_process_ipv4_multicast_ipv4_multicast_bridge;: could not convert to Json
            if(!ipv4_multicast_bridge.apply().hit) {
                ^^^^^^^^^^^^^^^^^^^^^

Here is a minimal example:

#include <core.p4>
#include <v1model.p4>

struct H { };
struct M { };

parser ParserI(packet_in pk, out H hdr, inout M meta, inout standard_metadata_t smeta) {
    state start { transition accept; }
}

control IngressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) {
    
    table t {
        key = {}
        actions = { NoAction; }
    }
    apply {
        // works when removing the `!`
        if(!t.apply().hit) {

        }
    }
}

control EgressI(inout H hdr, inout M meta, inout standard_metadata_t smeta) {
    apply { }
}

control DeparserI(packet_out pk, in H hdr) {
    apply { }
}

control VerifyChecksumI(in H hdr, inout M meta) {
    apply { }
}

control ComputeChecksumI(inout H hdr, inout M meta) {
    apply { }
}


V1Switch(ParserI(), VerifyChecksumI(), IngressI(), EgressI(),
         ComputeChecksumI(), DeparserI()) main;

Interestingly, there is no problem when removing the logical negation !.

ChrisDodd pushed a commit that referenced this issue Nov 5, 2016
@smolkaj
Copy link
Member Author

smolkaj commented Nov 10, 2016

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant