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

-Wfree-nonheap-object compiler warning at link time #15667

Open
wrrrzr opened this issue Jan 10, 2025 · 2 comments
Open

-Wfree-nonheap-object compiler warning at link time #15667

wrrrzr opened this issue Jan 10, 2025 · 2 comments
Labels
@ Build CMake, build scripts, official builds, compiler and linker errors Low priority Not a bug The behaviour is working as intended and won't be changed Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature

Comments

@wrrrzr
Copy link
Contributor

wrrrzr commented Jan 10, 2025

Luanti version

Luanti 5.11.0-dev-e5542e5b0 (Linux)
Using LuaJIT 2.1.1731601260
Built by GCC 14.2
Running on Linux/6.12.8 x86_64
BUILD_TYPE=Release
RUN_IN_PLACE=1
USE_CURL=1
USE_GETTEXT=1
USE_SOUND=1
STATIC_SHAREDIR="."
STATIC_LOCALEDIR="locale"

Operating system and version

Arch linux

Summary

[ 50%] Linking CXX executable ../bin/luanti
In member function ‘deallocate’,
    inlined from ‘deallocate’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:513:23,
    inlined from ‘_M_deallocate’ at /usr/include/c++/14.2.1/bits/stl_vector.h:389:19,
    inlined from ‘__dt_base ’ at /usr/include/c++/14.2.1/bits/stl_vector.h:368:15,
    inlined from ‘__dt_base ’ at /usr/include/c++/14.2.1/bits/stl_vector.h:738:7,
    inlined from ‘runTimeouts’ at /home/me/src/opensource/minetest/src/network/mtp/threads.cpp:270:1:
/usr/include/c++/14.2.1/bits/new_allocator.h:172:33: warning: ‘operator delete’ called on pointer ‘_594’ with nonzero offset [3, 9223372036854775806] [-Wfree-nonheap-object]
  172 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
      |                                 ^
In member function ‘allocate’,
    inlined from ‘allocate’ at /usr/include/c++/14.2.1/bits/alloc_traits.h:478:28,
    inlined from ‘_M_allocate’ at /usr/include/c++/14.2.1/bits/stl_vector.h:380:33,
    inlined from ‘_M_create_storage’ at /usr/include/c++/14.2.1/bits/stl_vector.h:398:44,
    inlined from ‘__ct ’ at /usr/include/c++/14.2.1/bits/stl_vector.h:334:26,
    inlined from ‘__ct ’ at /usr/include/c++/14.2.1/bits/stl_vector.h:603:61,
    inlined from ‘getPeerIDs’ at /home/me/src/opensource/minetest/src/network/mtp/impl.h:268:10,
    inlined from ‘runTimeouts’ at /home/me/src/opensource/minetest/src/network/mtp/threads.cpp:168:60:
/usr/include/c++/14.2.1/bits/new_allocator.h:151: note: returned from ‘operator new’
  151 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
[100%] Built target luanti
[100%] Built target minetest_alias

Steps to reproduce

build luanti with -DRUN_IN_PLACE=1

@wrrrzr wrrrzr added the Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible label Jan 10, 2025
@appgurueu
Copy link
Contributor

appgurueu commented Jan 10, 2025

I recall looking into this warning a while ago. If I'm not mistaken, it's a false positive. I think our code is similar to the example shown in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115048.

Maybe we should disable this warning entirely by default: It has a history of false positives. I'm yet to see it being useful.

The reason this (now) happens at link time is LTO.

@appgurueu appgurueu changed the title Warring at link time -Wfree-nonheap-object compiler warning at link time Jan 10, 2025
@appgurueu appgurueu added @ Build CMake, build scripts, official builds, compiler and linker errors Not a bug The behaviour is working as intended and won't be changed Low priority Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature and removed Unconfirmed bug Bug report that has not been confirmed to exist/be reproducible labels Jan 10, 2025
@Mizokuiam

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Build CMake, build scripts, official builds, compiler and linker errors Low priority Not a bug The behaviour is working as intended and won't be changed Request / Suggestion The issue makes a suggestion for something that should be done but isn't a new feature
Projects
None yet
Development

No branches or pull requests

3 participants