oxidecomputer / p4

A P4 compiler
Mozilla Public License 2.0
111 stars 5 forks source link

Variables without initializers cause invalid code generation. #34

Open rcgoodfellow opened 1 year ago

rcgoodfellow commented 1 year ago

The following works fine.

bit<32> x = 0;

However, the following causes bad code generation

bit<32> x;

According to the P4 spec section 11.2, variable initializers are optional, so this should be accepted by the front end and generate valid code.