Skip to content

Commit 7719552

Browse files
pythongh-123917: Fix crypt check in configure
Use the volatile keyword when checking crypt_r() or crypt() function in the configure script. Without volatile, the assignment can be removed by an optimization. Co-Authored-By: Paul Smith <[email protected]>
1 parent 8ca75ee commit 7719552

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the check for the ``crypt()`` function in the configure script: use the
2+
``volatile`` keyword to prevent the compiler to remove the check. Patch by
3+
Paul Smith and Victor Stinner.

configure

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5239,9 +5239,9 @@ WITH_SAVE_ENV([
52395239
#include <unistd.h>
52405240
], [
52415241
#ifdef HAVE_CRYPT_R
5242-
void *x = crypt_r;
5242+
volatile void *x = crypt_r;
52435243
#else
5244-
void *x = crypt;
5244+
volatile void *x = crypt;
52455245
#endif
52465246
])
52475247
], [ac_cv_crypt_crypt=yes], [ac_cv_crypt_crypt=no])

0 commit comments

Comments
 (0)