From 76a327e1e1f02e2f8027d4dd02950711435ea461 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Tue, 27 Jun 2023 10:11:38 -0700 Subject: [PATCH] Fix case of locality optimizer being wrong for split repeated fields and add a check that the optimized order has the same size as the unoptimized order. PiperOrigin-RevId: 543779555 --- src/google/protobuf/compiler/cpp/message.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/google/protobuf/compiler/cpp/message.cc b/src/google/protobuf/compiler/cpp/message.cc index 5ad4ba3657..6ab4114932 100644 --- a/src/google/protobuf/compiler/cpp/message.cc +++ b/src/google/protobuf/compiler/cpp/message.cc @@ -547,8 +547,10 @@ MessageGenerator::MessageGenerator( } } + const size_t initial_size = optimized_order_.size(); message_layout_helper_->OptimizeLayout(&optimized_order_, options_, scc_analyzer_); + ABSL_CHECK_EQ(initial_size, optimized_order_.size()); // This message has hasbits iff one or more fields need one. for (auto field : optimized_order_) {