Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 568db40

Browse filesBrowse files
authored
gh-129838: Don't redefine _Py_NO_SANITIZE_UNDEFINED (#129839)
Newer GCC versions accept both __attribute__((no_sanitize("undefined"))) and __attribute__((no_sanitize_undefined)) so check that the macro is not already defined.
1 parent 0f5b821 commit 568db40
Copy full SHA for 568db40

File tree

2 files changed

+7
-4
lines changed
Filter options

2 files changed

+7
-4
lines changed
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Don't redefine ``_Py_NO_SANITIZE_UNDEFINED`` when compiling with a recent
2+
GCC version and undefined sanitizer enabled.

‎Modules/faulthandler.c

Copy file name to clipboardExpand all lines: Modules/faulthandler.c
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@
3737
#define PUTS(fd, str) (void)_Py_write_noraise(fd, str, strlen(str))
3838

3939

40-
// clang uses __attribute__((no_sanitize("undefined")))
41-
// GCC 4.9+ uses __attribute__((no_sanitize_undefined))
42-
#if defined(__has_feature) // Clang
40+
// Clang and GCC 9.0+ use __attribute__((no_sanitize("undefined")))
41+
#if defined(__has_feature)
4342
# if __has_feature(undefined_behavior_sanitizer)
4443
# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
4544
# endif
4645
#endif
47-
#if defined(__GNUC__) \
46+
47+
// GCC 4.9+ uses __attribute__((no_sanitize_undefined))
48+
#if !defined(_Py_NO_SANITIZE_UNDEFINED) && defined(__GNUC__) \
4849
&& ((__GNUC__ >= 5) || (__GNUC__ == 4) && (__GNUC_MINOR__ >= 9))
4950
# define _Py_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize_undefined))
5051
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.