@@ -173,15 +173,18 @@ def ast_fragment(
173173 if frag .is_predicated :
174174 theninstrs = [ASTInterfaceInstruction (i ) for i in frag .thenbranch ]
175175 elseinstrs = [ASTInterfaceInstruction (i ) for i in frag .elsebranch ]
176- thenstmt = self .linear_ast (astree , theninstrs )
177- elsestmt = self .linear_ast (astree , elseinstrs )
176+ thenstmt = self .linear_block_ast (astree , theninstrs )
177+ elsestmt = self .linear_block_ast (astree , elseinstrs )
178178 cinstr = theninstrs [0 ]
179179 brcond = cinstr .ast_cc_condition (astree )
180180 if brcond is None :
181181 chklogger .logger .warning (
182182 "No instruction predicate expression found at address %s" ,
183183 cinstr .iaddr )
184184 brcond = astree .mk_temp_lval_expression ()
185+ else :
186+ astree .astree .add_expr_span (
187+ brcond .exprid , cinstr .iaddr , cinstr .bytestring )
185188 return astree .mk_branch (brcond , thenstmt , elsestmt , "0x0" )
186189 else :
187190 instrs = [ASTInterfaceInstruction (i ) for i in frag .linear ]
@@ -213,6 +216,16 @@ def ast(self, astree: "ASTInterface") -> AST.ASTStmt:
213216 return self .linear_ast (
214217 astree , sorted (self .instructions .values (), key = lambda p :p .iaddr ))
215218
219+ def linear_block_ast (
220+ self ,
221+ astree : "ASTInterface" ,
222+ instritems : List [ASTInterfaceInstruction ]) -> AST .ASTStmt :
223+ instrs : List [AST .ASTInstruction ] = []
224+ for i in instritems :
225+ instrs .extend (i .ast (astree ))
226+ instrseq = astree .mk_instr_sequence (instrs )
227+ return astree .mk_block ([instrseq ])
228+
216229 def linear_ast (
217230 self ,
218231 astree : "ASTInterface" ,
0 commit comments