From dea163fcd6e83b01b98a822d82488b51ee0f9b3b Mon Sep 17 00:00:00 2001 From: "sajan.kumar@intel.com" Date: Wed, 15 Dec 2021 21:26:02 -0800 Subject: [PATCH] Switch statement not correctly translated when default case is not present --- testdata/p4_16_samples_outputs/issue383-bmv2-midend.p4 | 9 ++++----- .../psa-switch-expression-without-default.p4.spec | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/testdata/p4_16_samples_outputs/issue383-bmv2-midend.p4 b/testdata/p4_16_samples_outputs/issue383-bmv2-midend.p4 index bb52ab80148..4a305851a40 100644 --- a/testdata/p4_16_samples_outputs/issue383-bmv2-midend.p4 +++ b/testdata/p4_16_samples_outputs/issue383-bmv2-midend.p4 @@ -24,13 +24,13 @@ struct col_t { } struct local_metadata_t { - @field_list(0) + @field_list(0) bit<1> _row0_alt0_valid0; - @field_list(0) + @field_list(0) bit<7> _row0_alt0_port1; - @field_list(0) + @field_list(0) bit<1> _row0_alt1_valid2; - @field_list(0) + @field_list(0) bit<7> _row0_alt1_port3; bit<1> _row1_alt0_valid4; bit<7> _row1_alt0_port5; @@ -140,4 +140,3 @@ control compute_checksum(inout parsed_packet_t hdr, inout local_metadata_t local } V1Switch(parse(), verifyChecksum(), ingress(), egress(), compute_checksum(), deparser()) main; - diff --git a/testdata/p4_16_samples_outputs/psa-switch-expression-without-default.p4.spec b/testdata/p4_16_samples_outputs/psa-switch-expression-without-default.p4.spec index b7d8b8e21f2..d8e9f2d9c11 100644 --- a/testdata/p4_16_samples_outputs/psa-switch-expression-without-default.p4.spec +++ b/testdata/p4_16_samples_outputs/psa-switch-expression-without-default.p4.spec @@ -53,7 +53,7 @@ struct user_meta_t { bit<32> psa_ingress_input_metadata_ingress_port bit<32> psa_ingress_input_metadata_packet_path bit<64> psa_ingress_input_metadata_ingress_timestamp - bit<8> psa_ingress_input_metadata_parser_error + bit<16> psa_ingress_input_metadata_parser_error bit<8> psa_ingress_output_metadata_class_of_service bit<8> psa_ingress_output_metadata_clone bit<16> psa_ingress_output_metadata_clone_session_id @@ -66,7 +66,7 @@ struct user_meta_t { bit<32> psa_egress_input_metadata_packet_path bit<16> psa_egress_input_metadata_instance bit<64> psa_egress_input_metadata_egress_timestamp - bit<8> psa_egress_input_metadata_parser_error + bit<16> psa_egress_input_metadata_parser_error bit<32> psa_egress_deparser_input_metadata_egress_port bit<8> psa_egress_output_metadata_clone bit<16> psa_egress_output_metadata_clone_session_id