p4c: Conditional execution in actions is not supported

    action drop() {
        mark_to_drop();
        exit;
    }

    action forward_ipv4() {
        hdr.ipv4.ttl         = hdr.ipv4.ttl - 1;

        if (hdr.ipv4.ttl == 0) {
            drop();
        }
    }

The above code snippet from P4D2 ARP exercise will trigger a compiler error in the frontend. Both p4test and p4c-bm2-ss report the same error.

error: MethodCallStatement: Conditional execution in actions is not supported on this target
        mark_to_drop();
        ^^^^^^^^^^^^^^
Compile failed.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 37 (36 by maintainers)

Most upvoted comments

This bug is not fixed in the compiler.