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

Mixing exits and returns in actions #2359

Closed
fruffy opened this issue May 4, 2020 · 0 comments · Fixed by #2364
Closed

Mixing exits and returns in actions #2359

fruffy opened this issue May 4, 2020 · 0 comments · Fixed by #2364
Assignees
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.

Comments

@fruffy
Copy link
Collaborator

fruffy commented May 4, 2020

The following program


bit<32> do_function() {
    return 32w1;
}

control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
    action do_action(inout bit<48> val) {
        if (h.eth_hdr.eth_type == 1 ) {
            return;
        }
        exit;

    }

    apply {
        do_action(h.eth_hdr.src_addr);
    }
}

leads to the following crash in the MidEnd:


BMV2::SimpleSwitchMidEnd_0_CheckTableSize
BMV2::SimpleSwitchMidEnd_1_RemoveMiss
BMV2::SimpleSwitchMidEnd_2_EliminateNewtype
BMV2::SimpleSwitchMidEnd_3_EliminateSerEnums
In file: /mnt/windows/Projekte/p4_tv/p4c/ir/visitor.cpp:480
Compiler Bug: visitor returned non-Statement type: <IndexedVector<StatOrDecl>>(92549)

with compiler version:

fruffy@fruffy /m/w/P/p4_tv (master) [1]> p4c/build/p4c --version                                
p4c 1.2.0 (SHA: 59c6bccc9)

returns_and_exits.p4.txt

@mihaibudiu mihaibudiu self-assigned this May 4, 2020
@mihaibudiu mihaibudiu added the bug This behavior is unintended and should be fixed. label May 4, 2020
@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants