Skip to content

test-signalhandler: test SIGFPE / assert exitcodes#7238

Merged
firewave merged 2 commits intocppcheck-opensource:mainfrom
firewave:sigfpe
Jan 23, 2025
Merged

test-signalhandler: test SIGFPE / assert exitcodes#7238
firewave merged 2 commits intocppcheck-opensource:mainfrom
firewave:sigfpe

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.

@firewave firewave force-pushed the sigfpe branch 2 times, most recently from 5d21f93 to ef72a3c Compare January 18, 2025 17:45
@firewave firewave marked this pull request as ready for review January 19, 2025 13:38
return 2;
if (std::feraiseexcept(FE_ALL_EXCEPT) != 0)
return 3;
return 1 % -1;
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 imagine that 1 % -1 is always 0, isn't it? why not write 0 here? Because it's testcode?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That is the invalid floating-point operation which is causing the exception. The code above is just telling it to raise the exception and to trap it (cause the signal).

https://www.gnu.org/software/libc/manual/html_node/FP-Exceptions.html

@firewave firewave merged commit ceafb41 into cppcheck-opensource:main Jan 23, 2025
@firewave firewave deleted the sigfpe branch January 23, 2025 12:10
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.

2 participants