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 related to typechecking generics (1/2) #344

Closed
jnfoster opened this issue Mar 3, 2017 · 1 comment
Closed

Compiler bug related to typechecking generics (1/2) #344

jnfoster opened this issue Mar 3, 2017 · 1 comment

Comments

@jnfoster
Copy link
Contributor

jnfoster commented Mar 3, 2017

Compiling the following program with the Bmv2 backend,

#include <v1model.p4>

header my_h {
  bit<8> tag;
}

struct my_packet {
  my_h h;
}

struct my_metadata {

}

parser MyParser(packet_in b, out my_packet p, inout my_metadata m, inout standard_metadata_t s) {
  state start {
    b.extract(p.h);
    transition accept;
  }
}

control MyVerifyChecksum(in my_packet hdr, inout my_metadata meta) {
  apply { }
}


control MyIngress<H>(inout my_packet p, inout my_metadata m, inout standard_metadata_t s) {
  action nop() { }
  table t (in H h) {
    key = { }
    actions = { nop; }
    default_action = nop();
  }
  apply { 
    H h = 0;
    t.apply(h);
  }
}

control MyEgress(inout my_packet p, inout my_metadata m, inout standard_metadata_t s) {
  apply { }
}

control MyComputeChecksum(inout my_packet p, inout my_metadata m) {
  apply { }
}

control MyDeparser(packet_out b, in my_packet p) {
  apply { }
}

/* Instantiate */
MyParser() p;
MyVerifyChecksum() vck;
MyIngress() i;
MyEgress() e;
MyComputeChecksum() cck;
MyDeparser() dp;

V1Switch(p, vck, i, e, cck, dp) main;

crashes with an bug:

$ ./build/p4c-bm2-ss --p4-16 -o config.json min.p4
terminate called after throwing an instance of 'Util::CompilerBug'
  what():  COMPILER BUG: ../frontends/p4/typeChecking/bindVariables.cpp:8
../frontends/p4/typeChecking/bindVariables.cpp:8: Null type

Aborted (core dumped)
mihaibudiu pushed a commit to mihaibudiu/p4c-clone that referenced this issue Mar 4, 2017
ChrisDodd pushed a commit that referenced this issue Mar 5, 2017
@mihaibudiu
Copy link
Contributor

I believe that this issue has been 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

2 participants