Skip to content

PGO/LTO Build Fails With -O0 #128042

Description

@ericsnowcurrently

Bug report

Bug description:

fails: ./configure CFLAGS=-O0 --enable-optimizations --with-lto
succeeds: ./configure CFLAGS=-O1 --enable-optimizations --with-lto

It fails when it runs the tests to build the profile. The problematic test is TestLRUC.test_lru_recursion in Lib/test/test_functools.py. It runs out of stack at well below the expected limit. Py_C_RECURSION_LIMIT is set to 10000. The test runs a simple recursive fibonacci function starting at 2857 (limit*2//7). It keeps crashing with smaller values, down to about 450. I'm not sure why the combination of PGO and -O0 special in this regard. (FYI, my build toolchain is probably a bit outdated, but I'm not sure that's a significant factor.)

I can think of several solutions here:

  • "don't do that!": document that -O0 should not be combined with --enable-optimizations (docs, maybe devguide)
  • print a warning in configure with that combination
  • lower Py_C_RECURSION_LIMIT with that combination

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions