Skip to content

_Py_NO_SANITIZE_UNDEFINED is defined twice when compiling with recent GCC #129838

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

Closed
collinfunk opened this issue Feb 8, 2025 · 0 comments
Closed
Labels
build The build process and cross-build extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@collinfunk
Copy link
Contributor

collinfunk commented Feb 8, 2025

Bug report

Bug description:

When compiling with a recent version of GCC and enabling undefined sanitizer, I see the following warning:

./Modules/faulthandler.c:49:11: warning: "_Py_NO_SANITIZE_UNDEFINED" redefined
   49 | #  define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
      |           ^~~~~~~~~~~~~~~~~~~~~~~~~
./Modules/faulthandler.c:44:13: note: this is the location of the previous definition
   44 | #    define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~

The conditions just need some updating to match recent GCC and Clang versions.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

@collinfunk collinfunk added the type-bug An unexpected behavior, bug, or error label Feb 8, 2025
collinfunk added a commit to collinfunk/cpython that referenced this issue Feb 8, 2025
Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
@picnixz picnixz added extension-modules C modules in the Modules dir build The build process and cross-build labels Feb 8, 2025
vstinner pushed a commit that referenced this issue Feb 20, 2025
Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 20, 2025
…29839)

Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
(cherry picked from commit 568db40)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 20, 2025
…29839)

Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
(cherry picked from commit 568db40)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
vstinner pushed a commit that referenced this issue Feb 20, 2025
#130365)

gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (GH-129839)

Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
(cherry picked from commit 568db40)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
vstinner pushed a commit that referenced this issue Feb 20, 2025
#130366)

gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (GH-129839)

Newer GCC versions accept both __attribute__((no_sanitize("undefined")))
and __attribute__((no_sanitize_undefined)) so check that the macro is
not already defined.
(cherry picked from commit 568db40)

Co-authored-by: Collin Funk <collin.funk1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants