-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix uninitialized variable issue #11440
Fix uninitialized variable issue #11440
Conversation
src/ds/ds-options.cpp
Outdated
@@ -86,7 +86,8 @@ namespace librealsense | |||
if (0 == temperature_data.*is_valid_field) | |||
LOG_ERROR(_ep.get_option_name(_option) << " value is not valid!"); | |||
|
|||
return temperature_data.*field; | |||
float temperature_val = temperature_data.*field; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix did not solve the error...
May we mark it as not a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Nir-Az, please advise if we may mark it like "Not a problem".
I checked via debugger that a value was temperature_val
= 37.000000
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the static analysis complaint ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return static_cast<float>(temperature_data.*field)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this will work but it's worth a shot...
The field
value is casted to float anyway but it seems that KW does not interpret .*
as dereferencing the pointer-to-member. Maybe an explicit cast will help, but we tried setting that into a value that is returned in a different statement, and it didn't help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the static analysis complaint ..
See LRS-670 (number 2 in the description)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whatever you think, if you wish to mark as Not a problem, feel free (on master+ development KW projects.
Or maybe the static cast will help
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So @Tamir91, undo the change and mark it as not a problem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tracked on [LRS-670]
Tracked on [LRS-671]