Skip to content
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

test-signalhandler: test SIGFPE / assert exitcodes #7238

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

firewave
Copy link
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
Owner

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
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 danmar:main Jan 23, 2025
60 checks passed
@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