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

Follow-up on slice arguments #2498

Closed
fruffy opened this issue Aug 12, 2020 · 0 comments · Fixed by #2579
Closed

Follow-up on slice arguments #2498

fruffy opened this issue Aug 12, 2020 · 0 comments · Fixed by #2579
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 Aug 12, 2020

I started fuzzing slices again after the recent fix to #2147 (hurray). Unfortunately, there seem to be more nasty edge cases.

In this action we assign 2 (0000 0010) to h.h.a while also assigning 1 to the least significant bit. The final value of h.h.a should be 3 (0000 0011). However, in 35_SimplifyDefUse, the compiler removes the assignment to h.h.a. Copy-out should only copy back the least significant bit, but it looks like the pass assumes that the entire header is copied back. At least that is how I understand it.

control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
    @name("slice_action") action slice_action_0(inout bit<1> sliced_val) {
        h.h.a = 8w2;
        sliced_val = 1w1;
    }
    apply {
        slice_action_0(h.h.a[0:0]);
    }
}

to

control ingress(inout Headers h, inout Meta m, inout standard_metadata_t sm) {
    @name("slice_action") action slice_action_0(inout bit<1> sliced_val) {
        ;
        sliced_val = 1w1;
    }
    apply {
        slice_action_0(h.h.a[0:0]);
    }
}

slice_assignment.p4.txt
slice_assignment.stf.txt

@mihaibudiu mihaibudiu self-assigned this Aug 12, 2020
@mihaibudiu mihaibudiu added the bug This behavior is unintended and should be fixed. label Aug 12, 2020
@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label Oct 7, 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