Skip to content

BUG: Warning when compiling pandas/_libs/algos.c #58829

Open
@TabLand

Description

@TabLand

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

Build pandas from commit b162331554d7c7f6fd46ddde1ff3908f2dc8bcce and review build logs

Issue Description

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -DOPENSSL_NO_SSL3 -fPIC -DNPY_NO_DEPRECATED_API=0 -Ipandas/_libs/include -I/home/ijtaba/.pyenv/versions/pandas-dev/lib/python3.9/site-packages/numpy/core/include -I/home/ijtaba/.pyenv/versions/pandas-dev/include -I/home/ijtaba/.pyenv/versions/3.9.10/include/python3.9 -c pandas/_libs/algos.c -o build/temp.linux-x86_64-3.9/pandas/_libs/algos.o
    In file included from pandas/_libs/algos.c:1270:
    pandas/_libs/include/pandas/vendored/klib/khash_python.h: In function ‘traced_realloc’:
    pandas/_libs/include/pandas/vendored/klib/khash_python.h:39:7: warning: pointer ‘old_ptr’ may be used after ‘realloc’ [-Wuse-after-free]
       39 |       PyTraceMalloc_Untrack(KHASH_TRACE_DOMAIN, (uintptr_t)old_ptr);
          |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    pandas/_libs/include/pandas/vendored/klib/khash_python.h:36:15: note: call to ‘realloc’ here
       36 |   void *ptr = realloc(old_ptr, size);
          |               ^~~~~~~~~~~~~~~~~~~~~~

Expected Behavior

No warnings

Installed Versions

0+untagged.35052.g5db4dd6

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBuildLibrary building on various platformsClosing CandidateMay be closeable, needs more eyeballs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions