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

Sarathna/cmplropts #1007

Merged
merged 6 commits into from
Jan 16, 2023
Merged

Sarathna/cmplropts #1007

merged 6 commits into from
Jan 16, 2023

Conversation

sarathnandu
Copy link
Contributor

Description

Add compiler flags to prevent compiler from optimizing out security checks.

Fixes # - issue number(s) if exists

  • - git commit message contains an appropriate signed-off-by string (see CONTRIBUTING.md for details)

Type of change

Choose one or multiple, leave empty if none of the other choices apply

Add a respective label(s) to PR if you have permissions

  • bug fix - change that fixes an issue
  • new feature - change that adds functionality
  • tests - change in tests
  • infrastructure - change in infrastructure and CI
  • documentation - documentation update

Tests

  • added - required for new features and some bug fixes
  • [x ] not needed

Documentation

  • updated in # - add PR number
  • needs to be updated
  • [x ] not needed

Breaks backward compatibility

  • Yes
  • [x ] No
  • Unknown

Notify the following users

List users with @ to send notifications

Other information

@phprus
Copy link
Contributor

phprus commented Jan 12, 2023

Tell me please, why only for GCC?
Won't adding these flags mask undefined behavior errors in oneTBB?

@sarathnandu
Copy link
Contributor Author

The flags added in this patch
-fno-strict-overflow tells the compiler NOT to assume that signed overflow does not occur.
-fno-delete-null-pointer-checks tells the compiler NOT to assume that null pointer deference does not exist.
-fwrapv tells the compiler that signed overflow always wraps.
So i believe it restrict the compiler from making arbitrary decisions while handling undefined C/C++ behaviors.

AIUI they are not supported in Clang or msvc. By adding it in Gnu.cmake it gets included in Intel.cmake as well. If I found similar flags for clang version, I would like to add for Clang too.

@sarathnandu sarathnandu requested a review from omalyshe January 12, 2023 23:47
@omalyshe
Copy link
Contributor

@sarathnandu Please fix the copyright year to 2020-2023

@omalyshe omalyshe merged commit 3b16143 into master Jan 16, 2023
@omalyshe omalyshe deleted the sarathna/cmplropts branch January 16, 2023 11:00
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