gh-126877: Fix the configure check for Tcl/Tk with optimizing compilers#153543
Merged
serhiy-storchaka merged 1 commit intoJul 11, 2026
Merged
Conversation
…ompilers The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
007fd01 to
c5c30ab
Compare
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-153553 is a backport of this pull request to the 3.15 branch. |
|
GH-153554 is a backport of this pull request to the 3.14 branch. |
|
GH-153555 is a backport of this pull request to the 3.13 branch. |
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 11, 2026
…compilers (GH-153543) (GH-153555) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. (cherry picked from commit ff0a9ae) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 11, 2026
…compilers (GH-153543) (GH-153554) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. (cherry picked from commit ff0a9ae) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
serhiy-storchaka
added a commit
that referenced
this pull request
Jul 11, 2026
…compilers (GH-153543) (GH-153553) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. (cherry picked from commit ff0a9ae) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Abhi210
pushed a commit
to Abhi210/cpython
that referenced
this pull request
Jul 11, 2026
…ompilers (pythonGH-153543) The check assigned the addresses of Tcl_Init() and Tk_Init() to unused variables, which optimizing compilers can eliminate, so it linked even when the libraries were missing. Call the functions instead. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
configurecheck for Tcl/Tk assigned the addresses ofTcl_Init()andTk_Init()to unused variables. Optimizing compilers can eliminate these dead stores, dropping the only reference to the symbols, so the check links — and Tcl/Tk is detected as available — even when the libraries are missing.This calls the functions instead, matching the existing
__register_frame()probe in the same file. A call to an external function cannot be optimized away, and the check still only links and never runs, so it stays cross-compile safe.Verified with gcc at
-O2: the old probe links with the symbols absent, the new one correctly fails, andconfigurethen reports_tkinter... missinginstead of a false positive.