@@ -75,18 +75,18 @@ where
7575 withinIntegralRange ( underlyingTypeAfter , [ upperBound ( c .getExpr ( ) ) , lowerBound ( c .getExpr ( ) ) ] )
7676 or
7777 // Heuristic - is there are guard the abs value of the float can fit in the precision of an int?
78- exists ( GuardCondition gc , FunctionCall log2f , FunctionCall fabsf , Expr precision |
78+ exists ( GuardCondition gc , FunctionCall log2 , FunctionCall fabs , Expr precision |
7979 // gc.controls(c, false) and
80- log2f .getTarget ( ) .hasGlobalOrStdName ( "log2f" ) and
81- fabsf .getTarget ( ) .hasGlobalOrStdName ( "fabsf" ) and
82- log2f .getArgument ( 0 ) = fabsf and
80+ log2 .getTarget ( ) .hasGlobalOrStdName ( "log2" + [ "" , "l" , "f" ] ) and
81+ fabs .getTarget ( ) .hasGlobalOrStdName ( "fabs" + [ "" , "l" , "f" ] ) and
82+ log2 .getArgument ( 0 ) = fabs and
8383 // Precision is either a macro expansion or function call
8484 (
8585 precision .( FunctionCall ) .getTarget ( ) instanceof PopCount
8686 or
8787 precision = any ( PrecisionMacro pm ) .getAnInvocation ( ) .getExpr ( )
8888 ) and
89- gc .ensuresLt ( precision , log2f , 0 , c .getExpr ( ) .getBasicBlock ( ) , false )
89+ gc .ensuresLt ( precision , log2 , 0 , c .getExpr ( ) .getBasicBlock ( ) , false )
9090 )
9191 )
9292select c , "Conversion of float to integer without appropriate guards avoiding undefined behavior."
0 commit comments