From: David Y. <dav...@in...> - 2011-05-03 15:35:17
|
Hi all, I found a bug in Mono.Cecil.Cil. The bug arises after branch optimization, producing, in some scenarios, wrong code. However, the origin of the problem may be at some other function. In MethodBody.cs::OptimizeBranch(), some long jumps are optimized into short jumps, because their offsets are small enough. However, at some point, the instruction stream between the target and the jump instruction is modified. The new jump offset becomes longer than a short jump. The modification is not reported and the jump is any way optimized into short jump. It incurs into an overflow in the jump address, so jumping into some incorrect address (I was able to detect it when the target was out of the function). We should identify the source of the problem and fix it. Right now I only skeep this optimization (that is what the patch is doing). It can be reproduced with the benchmark SPEC2000:188.ammp. The code produced by cli-be is correct just before linking. After linking, the wrong address appears. After applying this "patch", it works. David |