@@ -688,10 +688,13 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
688688 " Null instruction at index %zu" ,
689689 instr_idx);
690690
691+ const void * instr_args = instruction->instr_args ();
691692 switch (instruction->instr_args_type ()) {
692693 case executorch_flatbuffer::InstructionArguments::KernelCall: {
693- const auto arg_idxs =
694- instruction->instr_args_as_KernelCall ()->args ();
694+ const auto * instr_args_as_KernelCall =
695+ static_cast <const executorch_flatbuffer::KernelCall*>(
696+ instr_args);
697+ const auto arg_idxs = instr_args_as_KernelCall->args ();
695698 ET_CHECK_OR_RETURN_ERROR (
696699 arg_idxs != nullptr , InvalidProgram, " KernelCall args missing" );
697700 auto res = gen_instruction_arguments (
@@ -705,7 +708,7 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
705708 }
706709 chain_instruction_arg_lists[instr_idx] = res.get ();
707710 auto err = resolve_operator (
708- instruction-> instr_args_as_KernelCall () ->op_index (),
711+ instr_args_as_KernelCall->op_index (),
709712 chain_instruction_kernels,
710713 instr_idx,
711714 res.get (),
@@ -720,7 +723,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
720723 } break ;
721724 case executorch_flatbuffer::InstructionArguments::DelegateCall: {
722725 const auto arg_idxs =
723- instruction->instr_args_as_DelegateCall ()->args ();
726+ static_cast <const executorch_flatbuffer::DelegateCall*>(
727+ instr_args)
728+ ->args ();
724729 ET_CHECK_OR_RETURN_ERROR (
725730 arg_idxs != nullptr ,
726731 InvalidProgram,
@@ -740,7 +745,9 @@ Error Method::init(executorch_flatbuffer::ExecutionPlan* s_plan) {
740745 // Validate the index at load time so we can trust it during
741746 // execution.
742747 auto index =
743- instruction->instr_args_as_JumpFalseCall ()->cond_value_index ();
748+ static_cast <const executorch_flatbuffer::JumpFalseCall*>(
749+ instr_args)
750+ ->cond_value_index ();
744751 ET_CHECK_OR_RETURN_ERROR (
745752 index >= 0 && index < n_value_,
746753 InvalidProgram,
0 commit comments