-
Notifications
You must be signed in to change notification settings - Fork 452
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
p4RuntimeSerializer does not support stack field references in match keys #291
Comments
To observe this output, this fix is needed: #290. Otherwise the compiler crashes. |
This is a known problem; header stack references in match keys were something I left for future work in an effort to get p4RuntimeSerializer merged more quickly. I'll cook up a patch. |
That error should also refer to |
In P4-16 array indexes do not have to be constant values. |
And that's what |
Yes, ::error calls toString. |
OK. So I suppose this is a general problem with any compiler error we report involving a header stack, then. Should we change |
Arguably the default Expression::toString() method should just call dbprint
into stringbuffer and return the resulting string.
We kind-of have the convertion that dbprint is for logging while toString
is for error messages, so in general dbprint might include compiler
internal info that would be confusing to end-users, but at least as far as
expressions are concerned, dbprint just prints the expression in
source-equivalent form.
…On Thu, Feb 9, 2017 at 2:16 PM, Seth Fowler ***@***.***> wrote:
OK. So I suppose this is a general problem with any compiler error we
report involving a header stack, then. Should we change toString()'s
behavior to print the index expression, or is there a reason to prefer the
current behavior?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#291 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AD4c8a86Kishg4qLKw-PvZ4EiCiBddibks5ra5AhgaJpZM4L8gAU>
.
|
This is a problem of usability; if the index expression is complex the error message may be more obscure. |
The consequence of the current approach is that errors messages refer to code that isn't valid P4 and doesn't actually appear in the program anywhere, though. =\ |
If the error refers to an IR node with source position the source code will be quoted exactly. |
It sounds like it would be simplest not to address that issue as part of this PR. =) |
…table match keys. Fixes p4lang#291
…table match keys. Fixes p4lang#291
…table match keys. Fixes p4lang#291
The attached program produces the following output:
stack_ref.p4.txt
The text was updated successfully, but these errors were encountered: