Unsupported types for log_msg calls #2201
Labels
enhancement
This topic discusses an improvement to existing compiler code.
fixed
This topic is considered to be fixed.
I had a fairly decent sized v1model P4 program that was causing simple_switch to give an error message very soon after starting up, about some unexpected contents inside of the BMv2 JSON file, and it took a while to whittle it down and discover it was because I was trying to do log_msg on a value of type
bool
. Casting it to abit<1>
type caused things to work. It would be nice to at least document what types are supported, and preferably give a compile time error message for unsupported types.From my experiments using the attached P4 program, it appears that these types cause either cryptic errors when starting simple_switch, or a run-time error and simple_switch crash when the log_msg statement is executed:
bit<W>
I did not try header_union, header stack, or anything more 'exotic' than header or struct, but would expect they have the same behavior as header/struct.
One enhancement possibility - Change p4c bmv2 back end to give an error if an unsupported type is used as argument to log_msg calls.
Whatever list of supported/unsupported types we decide upon, I am happy to document, either in the v1model.p4 #include file, or here, whichever seems most appropriate: https://github.com/p4lang/behavioral-model/blob/master/docs/simple_switch.md
The text was updated successfully, but these errors were encountered: