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

compiler bug: cloning #100

Closed
smolkaj opened this issue Oct 12, 2016 · 2 comments
Closed

compiler bug: cloning #100

smolkaj opened this issue Oct 12, 2016 · 2 comments

Comments

@smolkaj
Copy link
Member

smolkaj commented Oct 12, 2016

The program below compiles fine with the p4c-bm2-ss backend, put crashes with

Invalid number of parameters for primitive action clone_ingress_pkt_to_egress: expected 2 but got 1

when executed with the simple_switch bmv2:

#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) {

    apply {
        clone(CloneType.I2E, smeta.clone_spec); // this causes the error
    }

}

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;
@mihaibudiu
Copy link
Contributor

I have created a test case from this example. (For now this will be an XFAIL.)

ChrisDodd pushed a commit that referenced this issue Oct 19, 2016
commit e6b02f9
Author: mbudiu-vmw <mbudiu@vmware.com>
Date:   Tue Oct 18 13:21:43 2016 -0700

    Fix for issue #100

commit 590eff9
Merge: 87b520c d578cfc
Author: mbudiu-vmw <mbudiu@vmware.com>
Date:   Mon Oct 17 15:35:43 2016 -0700

    merged with upstream

commit 87b520c
Author: mbudiu-vmw <mbudiu@vmware.com>
Date:   Mon Oct 17 15:31:06 2016 -0700

    Fixed incorrect handling of current()
ChrisDodd pushed a commit that referenced this issue Oct 20, 2016
* Fixed incorrect handling of current()

* Fix for issue #100

* Lexer fix for integer literals; removed XPASS test

* Fix for issue #110
@smolkaj
Copy link
Member Author

smolkaj commented Nov 3, 2016

I don't know if it works as expected (since I don't know what's expected), but it doesn't crash anymore.

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

2 participants