Skip to content

fix #11685: FP floatConversionOverflow from dead code#6973

Merged
danmar merged 7 commits intocppcheck-opensource:mainfrom
ludviggunne:11685
Nov 6, 2024
Merged

fix #11685: FP floatConversionOverflow from dead code#6973
danmar merged 7 commits intocppcheck-opensource:mainfrom
ludviggunne:11685

Conversation

@ludviggunne
Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread lib/checktype.cpp Outdated
Comment thread test/testtype.cpp Outdated
"}", settingsDefault);
ASSERT_EQUALS("[test.cpp:2]: (error) Undefined behaviour: float () to integer conversion overflow.\n", removeFloat(errout_str()));

const Settings settingsWithStdint = settingsBuilder().library("std.cfg").build();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think loading std.cfg is required. Can you cast to "unsigned short" instead of uint16_t? That should save some cpu cycles.

Comment thread lib/astutils.cpp Outdated
break;

if (parent->isBinaryOp()) {
bool left = tok == parent->astOperand1();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: make left const.

@danmar danmar merged commit 4ad32de into cppcheck-opensource:main Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants