mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Fix off-by-one bug in array indexing in the OCaml bindings
This patch fixes an off-by-one bug that occurred in the construction of output arrays in the OCaml bindings.
This commit is contained in:
		
							parent
							
								
									dadcc6e8ff
								
							
						
					
					
						commit
						0e966f21ff
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1477,10 +1477,10 @@ def mk_z3native_stubs_c(ml_src_dir, ml_output_dir): # C interface
 | 
			
		|||
                    pts = ml_plus_type(ts)
 | 
			
		||||
                    pops = ml_plus_ops_type(ts)
 | 
			
		||||
                    if ml_has_plus_type(ts):
 | 
			
		||||
                        ml_wrapper.write('    %s _a%dp = %s_mk(ctx_p, (%s) _a%d[_i]);\n' % (pts, i, pts, ml_minus_type(ts), i))
 | 
			
		||||
                        ml_wrapper.write('    %s _a%dp = %s_mk(ctx_p, (%s) _a%d[_i - 1]);\n' % (pts, i, pts, ml_minus_type(ts), i))
 | 
			
		||||
                        ml_wrapper.write('    %s\n' % ml_alloc_and_store(pt, 'tmp_val', '_a%dp' % i))
 | 
			
		||||
                    else:
 | 
			
		||||
                        ml_wrapper.write('    %s\n' % ml_alloc_and_store(pt, 'tmp_val', '_a%d[_i]' % i))
 | 
			
		||||
                        ml_wrapper.write('    %s\n' % ml_alloc_and_store(pt, 'tmp_val', '_a%d[_i - 1]' % i))
 | 
			
		||||
                    ml_wrapper.write('    _iter = caml_alloc(2,0);\n')
 | 
			
		||||
                    ml_wrapper.write('    Store_field(_iter, 0, tmp_val);\n')
 | 
			
		||||
                    ml_wrapper.write('    Store_field(_iter, 1, _a%s_val);\n' % i)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue