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

what(): COMPILER BUG: ../frontends/p4/typeChecking/typeChecker.h:100 #453

Closed
rmiguelc opened this issue Apr 7, 2017 · 1 comment
Closed
Labels
wontfix This is a problem that will not be fixed.

Comments

@rmiguelc
Copy link

rmiguelc commented Apr 7, 2017

I previously mentioned this on a P4-dev-lists topic: http://lists.p4.org/pipermail/p4-dev_lists.p4.org/2017-March/000858.html

Mihai Budiu disclosed that this was intentional, here. As it turns out, the problem with my code was not the .hit attribute, but tables having parameters. This has been removed from the language and the compiler has already been changed accordingly, but is still printing the bug in epigraph.

Here is the complete P4 code I used on the sandbox test.

#include "./p4include/v1model.p4"

struct Meta {
	bit<1> hasmeta;
}

struct Parsed_packet {
	bit<8> field;
}

parser TopParser(packet_in b, out Parsed_packet p, inout Meta m, inout standard_metadata_t metadata) {
	state start {
		transition accept;
	}
}
control VeryChecksum(in Parsed_packet hdr, inout Meta meta) { apply {} }

control IngressP(inout Parsed_packet hdr,
                      inout Meta meta,
                      inout standard_metadata_t standard_metadata) {

 action Update_face_list(out bit<32> portArray, bit<32> currentVector)
 { portArray = currentVector; }

 table testtable(inout bit<32> portArray) {
        key = { hdr.field : exact; } //hdr.field is bit<8>
        actions = { Update_face_list(portArray); NoAction; }
        default_action = NoAction;
 }


 apply {
        bit<32> var = 0;
        bool match = false;

        match = testtable.apply(var).hit;

        if (match) {
         var = 5;
        }
 }
}

control EgressP(inout Parsed_packet hdr,
                     inout Meta meta,
                     inout standard_metadata_t standard_metadata) { apply {} }

control ChecksumComputer(inout Parsed_packet hdr,
                              inout Meta meta) { apply {} }

control TopDeparser(packet_out b, in Parsed_packet hdr) { apply {} }

V1Switch(TopParser(), VeryChecksum(), IngressP(), EgressP(), ChecksumComputer(), TopDeparser()) main;

Compiling with ./p4test --p4v 16 or ./p4c-bm2-ss --p4v 16 yields the following:

simple_switch.p4(78): error: testtable.apply: Passing 1 arguments when 0 expected
match = testtable.apply(var).hit;
------- ^^^^^^^^^^^^^^^^^^^^
terminate called after throwing an instance of 'Util::CompilerBug'
what(): COMPILER BUG: ../frontends/p4/typeChecking/typeChecker.h:100
simple_switch.p4(78): Could not find type of testtable.apply(var);
match = testtable.apply(var).hit;
------- ^^^^^^^^^^^^^^^^^^^^

(p4c-bm-ss also outputs a Segmentation Fault)

@mihaibudiu
Copy link
Contributor

I cannot reproduce this issue with the latest version of the compiler. The error I get is:

issue453.p4(25):syntax error, unexpected '(', expecting '{'
 table testtable(
                ^
error: 1 errors encountered, aborting compilation

So this program does not even parse.

@fruffy fruffy added wontfix This is a problem that will not be fixed. and removed invalid labels Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This is a problem that will not be fixed.
Projects
None yet
Development

No branches or pull requests

3 participants