GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Compiler warnings in main / 3.11 · Issue #96017 · python/cpython

Compiler warnings in main / 3.11 #96017

New issue
Copy link
New issue
Copy link
Closed
Closed
Compiler warnings in main / 3.11#96017
Copy link
Assignees
vstinnerencukoumarkshannon
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixesOS-wasitype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@tiran
tiran
opened on Aug 16, 2022
Issue body actions

Bug report

I'm getting several compiler warnings when compiling on Linux X86_64, wasm32-emscripten, and wasm32-wasi.

Your environment

  • x86_64-pc-linux-gnu with gcc
  • wasm32-emscripten with clang
  • wasm32-wasi with clang

warnings

Objects/typeobject.c:6805:34: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
    else if (type->tp_dictoffset < sizeof(PyObject)) {

Fix: cast sizeof to Py_ssize_t

Objects/typeobject.c:74:1: warning: unused function 'static_builtin_index_is_set' [-Wunused-function]
static_builtin_index_is_set(PyTypeObject *self)
^

Fix: don't define the function if NDEBUG is set.

Modules/_testcapi/heaptype.c:280:23: warning: unused variable 'class_ht' [-Wunused-variable]
    PyHeapTypeObject *class_ht = (PyHeapTypeObject *)class;
Modules/_testcapi/heaptype.c:279:19: warning: unused variable 'class_tp' [-Wunused-variable]
    PyTypeObject *class_tp = (PyTypeObject *)class;

Fix: unset NDEBUG before including assert.h.

Python/ceval_gil.h:136:13: warning: unused function 'recreate_gil' [-Wunused-function]
static void recreate_gil(struct _gil_runtime_state *gil)

Fix: only define function ifdef HAVE_FORK

Python/pytime.c:297:10: warning: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion]
    if (!_Py_InIntegralTypeRange(time_t, intpart)) {
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Include/internal/pycore_pymath.h:72:45: note: expanded from macro '_Py_InIntegralTypeRange'
    (_Py_IntegralTypeMin(type) <= v && v <= _Py_IntegralTypeMax(type))
                                         ~~ ^~~~~~~~~~~~~~~~~~~~~~~~~
Include/internal/pycore_pymath.h:61:88: note: expanded from macro '_Py_IntegralTypeMax'
    (_Py_IS_TYPE_SIGNED(type) ? (((((type)1 << (sizeof(type)*CHAR_BIT - 2)) - 1) << 1) + 1) : ~(type)0)

The warning is coming from clang from WASI-SDK.

Modules/expat/xmlparse.c:3107:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
Modules/expat/xmlparse.c:3106:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
Modules/expat/xmlparse.c:4050:9: warning: code will never be executed [-Wunreachable-code]
        parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf,
        ^~~~~~
Modules/expat/xmlparse.c:4049:16: note: silence by adding parentheses to mark code as explicitly dead
      else if (0 && parser->m_characterDataHandler)
               ^
               /* DISABLES CODE */ ( )
Modules/expat/xmlparse.c:7681:11: warning: format specifies type 'int' but the argument has type 'ptrdiff_t' (aka 'long') [-Wformat]
          bytesMore, (account == XML_ACCOUNT_DIRECT) ? "DIR" : "EXP",
          ^~~~~~~~~
3 warnings generated.

The warnings are coming from clang from WASI-SDK. These look like issues in upstream expat code.

Activity

  1. tiran
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Aug 16, 2022
  2. tiran
    added a commit that references this issue on Aug 16, 2022

    pythongh-96017: Fix some compiler warnings

    83a0cd0
  3. tiran
    assigned
    vstinner
    ,
    encukou
    and
    markshannon
    on Aug 16, 2022
  4. tiran
    added
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    on Aug 16, 2022
  5. tiran commented on Aug 16, 2022

    @tiran
    tiran
    on Aug 16, 2022
    MemberAuthor
    More actions

    Petr takes care of parts.h in #95992

  6. tiran
    added 3 commits that reference this issue on Aug 19, 2022

    Merge branch 'main' into pythongh-96017-compiler-warnings

    928a2b9

    gh-96017: Fix some compiler warnings (GH-96018)

    d9c1b74

    [3.11] pythongh-96017: Fix some compiler warnings (pythonGH-96018)

    70dd200
  7. brettcannon commented on Oct 3, 2022

    @brettcannon
    brettcannon
    on Oct 3, 2022
    Member
    More actions

    I'm going to break out the _Py_InIntegralTypeRange warning as it isn't special to WASM.

  8. vstinner commented on Oct 4, 2022

    @vstinner
    vstinner
    on Oct 4, 2022
    Member
    More actions

    See issue #97786 for the _Py_InIntegralTypeRange() warning.

  9. brettcannon
    added
    OS-wasi
    on Oct 4, 2022
  10. ambv
    added a commit that references this issue on Oct 5, 2022

    [3.11] gh-96017: Fix some compiler warnings (GH-96018) (#96106)

    eecbeec
  11. OTheDev commented on Feb 21, 2023

    @OTheDev
    OTheDev
    on Feb 21, 2023
    Contributor
    More actions

    FYI, the last warning still appears on main but has been addressed upstream :).

  12. vstinner commented on Apr 5, 2023

    @vstinner
    vstinner
    on Apr 5, 2023
    Member
    More actions

    It's hard to keep track of an issue reported multiple unrelated compiler warnings. Most of them seem to be fixed, so I close the issue. You may open new issues if some warnings are still emitted on latest versions.

  13. vstinner
    closed this as completedon Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @encukou
    encukou
  • @markshannon
    markshannon
  • @vstinner
    vstinner

Labels

3.11only security fixesonly security fixes3.12only security fixesonly security fixesOS-wasitype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.