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

Some problems with function calls in struct initialization #2543

Closed
fruffy opened this issue Sep 14, 2020 · 1 comment · Fixed by #2552
Closed

Some problems with function calls in struct initialization #2543

fruffy opened this issue Sep 14, 2020 · 1 comment · Fixed by #2552
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 Sep 14, 2020

I think one of the recent merges has unearthed some problems with structure initializations and function calls within them.
The following two programs throw errors that do not seem correct.

return_hdr_struct.p4.txt

MidEnd_10_HandleNoMatch
MidEnd_11_SimplifyParsers
MidEnd_12_StrengthReduction
bugs/crash/return_hdr_struct.p4(17): [--Werror=type-error] error: AssignmentStatement: Cannot unify tuple_0 with ethernet_t
    return { { 1, 1, produce_val() }};
    ^^^^^^
bugs/crash/return_hdr_struct.p4(2)
header ethernet_t {
       ^^^^^^^^^^

struct_function_call.p4.txt

FrontEnd_47_InlineFunctions
P4::TypeChecking_0_ResolveReferences
P4::TypeChecking_1_TypeInference
SetHeaders_0_TypeChecking
In file: p4c/frontends/p4/typeMap.cpp:95
�[31mCompiler Bug�[0m: Could not find type for <StructExpression>(7655)
@mihaibudiu mihaibudiu self-assigned this Sep 14, 2020
@mihaibudiu mihaibudiu added the bug This behavior is unintended and should be fixed. label Sep 14, 2020
@mihaibudiu
Copy link
Contributor

These are actually two different bugs.

@mihaibudiu mihaibudiu added the fixed This topic is considered to be fixed. label Sep 17, 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