https://github.com/python/cpython/commit/53af5b2dd2069680be4ce76626c857e9b2959f77 commit: 53af5b2dd2069680be4ce76626c857e9b2959f77 branch: 3.12 author: Victor Stinner <[email protected]> committer: vstinner <[email protected]> date: 2024-09-12T16:21:31+02:00 summary:
[3.12] gh-123917: Fix crypt check in configure (#123952) Use a global volatile variable and check if the function is not NULL to use the variable. Otherwise, a compiler optimization can remove the variable making the check useless. Co-authored-by: Paul Smith <[email protected]> files: A Misc/NEWS.d/next/Build/2024-09-11-16-06-42.gh-issue-123917.JuZl0r.rst M configure M configure.ac diff --git a/Misc/NEWS.d/next/Build/2024-09-11-16-06-42.gh-issue-123917.JuZl0r.rst b/Misc/NEWS.d/next/Build/2024-09-11-16-06-42.gh-issue-123917.JuZl0r.rst new file mode 100644 index 00000000000000..4cf4a177f1513f --- /dev/null +++ b/Misc/NEWS.d/next/Build/2024-09-11-16-06-42.gh-issue-123917.JuZl0r.rst @@ -0,0 +1,2 @@ +Fix the check for the ``crypt()`` function in the configure script. Patch by +Paul Smith and Victor Stinner. diff --git a/configure b/configure index 173674073ca51e..1c75810d9e8c4b 100755 --- a/configure +++ b/configure @@ -22041,16 +22041,18 @@ else $as_nop #include <crypt.h> #endif #include <unistd.h> + volatile void *func; int main (void) { #ifdef HAVE_CRYPT_R - void *x = crypt_r; + func = crypt_r; #else - void *x = crypt; + func = crypt; #endif + return (func != NULL); ; return 0; diff --git a/configure.ac b/configure.ac index f22e71f46fea5e..d0d54050286cd8 100644 --- a/configure.ac +++ b/configure.ac @@ -5237,12 +5237,14 @@ WITH_SAVE_ENV([ #include <crypt.h> #endif #include <unistd.h> + volatile void *func; ], [ #ifdef HAVE_CRYPT_R - void *x = crypt_r; + func = crypt_r; #else - void *x = crypt; + func = crypt; #endif + return (func != NULL); ]) ], [ac_cv_crypt_crypt=yes], [ac_cv_crypt_crypt=no]) ]) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
