p4-spec icon indicating copy to clipboard operation
p4-spec copied to clipboard

headerstackvar.size is it really a compile time constant or not?

Open apinski-cavium opened this issue 3 years ago • 1 comments

Take:

header h{}
struct s { h[2] f; }
void func(s v)
{
  bit<(v.f.size)> v1;
}

The current specifications has:

- `hs.size`: produces a 32-bit unsigned integer that returns the
  size of the header stack (a compile-time constant).

....

The following are compile-time known values:
...
- The `size` field of a value with type header stack.

Is the value a constant or just a known value at compile time? Yes there can be (and should be) slight difference between the two?

This is related to https://github.com/p4lang/p4-spec/issues/932 too. I don't expect an answer right away since this can get complex really.

apinski-cavium avatar Apr 14 '22 04:04 apinski-cavium

Can we fix this while leaving #932 open?

mihaibudiu avatar Sep 12 '22 18:09 mihaibudiu

In the interest of tidying up the set of active issues on the P4 specification repository, I'm marking this as "stalled" and closing it. Of course, we can always re-open it in the future if there is interest in resurrecting it.

jnfoster avatar Nov 11 '23 13:11 jnfoster