M5-0-3
, M5-0-7
, M5-0-8
, M5-0-9
: Casted argument of function call is wrongly considered as a cvalue
#602
Labels
Difficulty-Low
A false positive or false negative report which is expected to take <1 day effort to address
false positive/false negative
An issue related to observed false positives or false negatives.
Impact-Medium
Standard-AUTOSAR
user-report
Issue reported by an end user of CodeQL Coding Standards
Affected rules
M5-0-3
M5-0-7
M5-0-8
M5-0-9
Description
Return value of
static_cast
seems to be treated as acvalue
interferring with several MISRA rules:M-0-8
When upcasting variable using
static_cast
and rightaway using the result in another expression, it triggers a M5-0-9 warning (illustrated in example functionfalse_positive
).It forces the user to create a intermediate variable containing the result of the
static_cast
, then using this intermediate variable in the expression (illustrated in example functiontrue_negative
).M-0-9
When changing variable's signedness using
static_cast
and rightaway using the result in another expression, it triggers a M5-0-9 warning (illustrated in example functionfalse_positive
).It forces the user to create a intermediate variable containing the result of the
static_cast
, then using this intermediate variable in the expression (illustrated in example functiontrue_negative
).Example
M-0-8
M-0-9
The text was updated successfully, but these errors were encountered: