From: Benjamin M. <ben...@ce...> - 2006-12-08 13:48:05
|
Hello, Cil.constFoldBinOp may compute unspecified shifts. For example shifting a char by more than 8 is unspecified and should be l= eft=20 unchanged by Cil. Here is a patch to fix this: just replace shiftInBounds in constFoldBinOp= by let shiftInBounds i2 =3D (* We only try to fold shifts if the second arg is positive and less than the size of the type of the first argument. Otherwise, the semantics are processor-dependent, so let the = compiler sort it out. *) if machdep then try i2 >=3D Int64.zero && i2 < (Int64.of_int (bitsSizeOf (typeOf= e1'))) with SizeOfError _ -> false else false in Is this patch correct ? Cheers, --=20 | Benjamin Monate | mailto:ben...@ce... | | Ing=E9nieur-Chercheur | CEA-LIST/DRT/DTSI/SOL/LSL | | B=E2t. 528 Pt. 115a | 91191 Gif-sur-Yvette CEDEX | | T=E9l. 01 69 08 94 09 | Fax : 01 69 08 83 95 | |