Skip to content
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

autoconf link test for tcl/tk fails with optimizing compilers #126877

Open
bramoore opened this issue Nov 15, 2024 · 0 comments
Open

autoconf link test for tcl/tk fails with optimizing compilers #126877

bramoore opened this issue Nov 15, 2024 · 0 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@bramoore
Copy link

bramoore commented Nov 15, 2024

Bug report

Bug description:

The autoconf test for linking TCL/Tk libraries is flawed when using an optimizing compiler such as AOCC. AOCC 5.0 defaults to using the optimization level -O2, which includes dead-code elimination. The current autoconf test is trying to check for the Tcl_Init and Tk_Init symbols by assigning them to variables which are then never referenced. This is seen by the compiler as dead code, and removed. Thus, the symbols are not included in the object and the link-test passes, even if there are no TCL/Tk libraries on the system.

Current test in configure.ac:

[
    void *x1 = Tcl_Init;
    void *x2 = Tk_Init;
]

One possible solution is to change the test from a simple assignment to calling those functions, at which the expression is used, and not elided by the optimizing compiler:

[
    int x1 = Tcl_Init();
    int x2 = Tk_Init();
]

Another possible solution would be to force use of -O0 during for this test.

CPython versions tested on:

3.12, 3.13

Operating systems tested on:

Linux

@bramoore bramoore added the type-bug An unexpected behavior, bug, or error label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant