Thanks to visit codestin.com
Credit goes to github.com

Skip to content

always_inline makes build fail with -Og and --without-pydebug #121266

Closed
@mgorny

Description

@mgorny

Bug report

Bug description:

We're trying to build CPython to debug a crash in third-party extension. To do that, I've set CFLAGS="-Og -g" and passed --with-assertions. However, we're not using --with-pydebug since that has had side effects that broke multiple third-party packages in the past. Unfortunately, in this configuration CPython fails to build due to use of always_inline:

gcc -c -fno-strict-overflow -fstack-protector-strong -Wtrampolines -Wsign-compare -g -O3 -Wall -Og   -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Objects/dictobject.o Objects/dictobject.c
In function ‘do_lookup’,
    inlined from ‘unicodekeys_lookup_unicode’ at Objects/dictobject.c:1137:12:
Objects/dictobject.c:1120:1: error: inlining failed in call to ‘always_inline’ ‘compare_unicode_unicode’: function not considered for inlining
 1120 | compare_unicode_unicode(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1052:30: note: called from here
 1052 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1120:1: error: inlining failed in call to ‘always_inline’ ‘compare_unicode_unicode’: function not considered for inlining
 1120 | compare_unicode_unicode(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1068:30: note: called from here
 1068 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘do_lookup’,
    inlined from ‘unicodekeys_lookup_generic’ at Objects/dictobject.c:1116:12:
Objects/dictobject.c:1085:1: error: inlining failed in call to ‘always_inline’ ‘compare_unicode_generic’: function not considered for inlining
 1085 | compare_unicode_generic(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1052:30: note: called from here
 1052 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1085:1: error: inlining failed in call to ‘always_inline’ ‘compare_unicode_generic’: function not considered for inlining
 1085 | compare_unicode_generic(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1068:30: note: called from here
 1068 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘do_lookup’,
    inlined from ‘dictkeys_generic_lookup’ at Objects/dictobject.c:1171:12:
Objects/dictobject.c:1141:1: error: inlining failed in call to ‘always_inline’ ‘compare_generic’: function not considered for inlining
 1141 | compare_generic(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~
Objects/dictobject.c:1052:30: note: called from here
 1052 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Objects/dictobject.c:1141:1: error: inlining failed in call to ‘always_inline’ ‘compare_generic’: function not considered for inlining
 1141 | compare_generic(PyDictObject *mp, PyDictKeysObject *dk,
      | ^~~~~~~~~~~~~~~
Objects/dictobject.c:1068:30: note: called from here
 1068 |             Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:3051: Objects/dictobject.o] Error 1

CPython versions tested on:

3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs

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