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 in inlining pass #388

Closed
jnfoster opened this issue Mar 24, 2017 · 0 comments
Closed

Compiler bug in inlining pass #388

jnfoster opened this issue Mar 24, 2017 · 0 comments
Labels
duplicate This issue or pull request is a duplicate. fixed This topic is considered to be fixed.

Comments

@jnfoster
Copy link
Contributor

jnfoster commented Mar 24, 2017

Compiling the following program

#include <v1model.p4>

header h_t {
  bit<8> f;
}

struct my_packet {
  h_t h;
}

struct my_metadata {

}

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

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

control C() {
  apply {} 
}

C() c;

control MyIngress(inout my_packet p, inout my_metadata m, inout standard_metadata_t s) {
  apply { c.apply(); }
}

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;

using the Bmv2 backend,

p4c-bm2-ss --p4-16 min.p4

crashes with a compiler bug:

terminate called after throwing an instance of 'Util::CompilerBug'
  what():  COMPILER BUG: ../midend/inlining.h:154
/home/vagrant/min.p4(31): Could not locate instance C c() invoked by c.apply();
C() c;
    ^
/home/vagrant/min.p4(34)
  apply { c.apply(); }
          ^^^^^^^^^

Aborted (core dumped)
@mihaibudiu mihaibudiu added the duplicate This issue or pull request is a duplicate. label Apr 7, 2017
mihaibudiu pushed a commit to mihaibudiu/p4c-clone that referenced this issue May 11, 2017
@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label May 12, 2017
ChrisDodd pushed a commit that referenced this issue May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request is a duplicate. fixed This topic is considered to be fixed.
Projects
None yet
Development

No branches or pull requests

2 participants