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 with ?: and int types #3806

Closed
apinski-cavium opened this issue Dec 23, 2022 · 1 comment · Fixed by #3828
Closed

Compiler bug with ?: and int types #3806

apinski-cavium opened this issue Dec 23, 2022 · 1 comment · Fixed by #3828
Assignees
Labels
bug This behavior is unintended and should be fixed. fixed This topic is considered to be fixed.

Comments

@apinski-cavium
Copy link

Take:

header ethernet_t {
    bit<48> dst_addr;
    bit<48> src_addr;
    bit<16> eth_type;
}
struct Headers {
    ethernet_t eth_hdr;
}

void f (inout Headers h) {
  h.eth_hdr = h.eth_hdr.eth_type == 1 ? {1, 1, 1} : {2, 2, 2};
}

This produces:

In file: /home/apinski/src/p4/p4c/frontends/p4/typeChecking/typeChecker.cpp:158
Compiler Bug: At this point in the compilation typechecking should not infer new types anymore, but it did.

This is a slightly modified version of testdata/p4_16_samples/issue2487.p4 where the tuple contains int types rather than the types of the header fields.

@apinski-cavium
Copy link
Author

#2487

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