CodeQL library for C/C++

Predicate SimpleRangeAnalysisCached::upperBound

Gets the upper bound of the expression.

Note: expressions in C/C++ are often implicitly or explicitly cast to a different result type. Such casts can cause the value of the expression to overflow or to be truncated. This predicate computes the upper bound of the expression without including the effect of the casts. To compute the upper bound of the expression after all the casts have been applied, call upperBound like this:


Import path

import semmle.code.cpp.rangeanalysis.SimpleRangeAnalysis
float upperBound(Expr expr)