Menu

#475 [Warning] inlined from ‘void irr::scene::CDMFLoader::addMaterialPath(irr::core::stringc&, const irr::core::stringc&)’ at CDMFLoader.cpp:51:6:

current stable SDK
closed-duplicate
nobody
None
5
2024-09-24
2024-09-24
Jon Daniel
No

compiling with

CXXFLAGS="-march=native -mfpmath=sse -std=gnu++26 -O3" make NDEBUG=1 sharedlib install

results in

x86_64-pc-linux-gnu-g++ -march=native -mfpmath=sse -O3 -std=gnu++26 -Wall -pipe -fno-exceptions -fno-rtti -I../../include -Izlib -Ijpeglib -Ilibpng -I/usr/X11R6/include -DIRRLICHT_EXPORTS=1 -O3 -fPIC  -c -o CDMFLoader.o CDMFLoader.cpp
In file included from ../../include/path.h:8,
                 from ../../include/IMeshLoader.h:9,
                 from CDMFLoader.h:33,
                 from CDMFLoader.cpp:24:
In member function ‘irr::core::string<T, TAlloc>& irr::core::string<T, TAlloc>::append(T) [with T = char; TAlloc = irr::core::irrAllocator<char>]’,
    inlined from ‘void irr::scene::CDMFLoader::addMaterialPath(irr::core::stringc&, const irr::core::stringc&) at CDMFLoader.cpp:59:22,
    inlined from ‘void irr::scene::CDMFLoader::addMaterialPath(irr::core::stringc&, const irr::core::stringc&) at CDMFLoader.cpp:51:6:
../../include/irrString.h:640:31: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
  640 |                 array[used-1] = 0;
      |                 ~~~~~~~~~~~~~~^~~
In file included from ../../include/irrString.h:9:
In member function ‘void* irr::core::irrAllocator<T>::internal_new(size_t) [with T = char]’,
    inlined from ‘T* irr::core::irrAllocator<T>::allocate(size_t) [with T = char] at ../../include/irrAllocator.h:35:26,
    inlined from ‘irr::core::string<T, TAlloc>& irr::core::string<T, TAlloc>::operator=(const irr::core::string<T, TAlloc>&) [with T = char; TAlloc = irr::core::irrAllocator<char>] at ../../include/irrString.h:340:30,
    inlined from ‘irr::core::string<T, TAlloc>::string(const irr::core::string<T, TAlloc>&) [with T = char; TAlloc = irr::core::irrAllocator<char>] at ../../include/irrString.h:111:9,
    inlined from ‘void irr::scene::CDMFLoader::addMaterialPath(irr::core::stringc&, const irr::core::stringc&) at CDMFLoader.cpp:58:37,
    inlined from ‘void irr::scene::CDMFLoader::addMaterialPath(irr::core::stringc&, const irr::core::stringc&) at CDMFLoader.cpp:51:6:
../../include/irrAllocator.h:60:36: note: at offset 4294967295 into destination object of size [0, 4294967295] allocated by ‘operator new’
   60 |                 return operator new(cnt);
      |                        ~~~~~~~~~~~~^~~~~
../../include/irrAllocator.h:60:36: note: at offset 4294967295 into destination object of size [0, 4294967295] allocated by ‘operator new’
../../include/irrAllocator.h:60:36: note: at offset 4294967295 into destination object of size [0, 4294967295] allocated by ‘operator new’
../../include/irrAllocator.h:60:36: note: at offset 4294967295 into destination object of size [0, 4294967295] allocated by ‘operator new’

Discussion

  • Michael Zeilfelder

    • status: open --> closed-duplicate
     
  • Michael Zeilfelder

    Duplicate of #468. I see it has some more information - that you use c++26 for example. Unfortunately the compiler in my Debian stable doesn't support that yet, so I can't reproduce the warning yet.

    If you want to add information to #468 please to so in that bugreport. This one will be closed.

    And just a note as I never commented the other one - I simply have no clue what's causing it. From what I can see core::string ensures that array always has at least size 1. Maybe the compiler gets confused by something? I have to admit it's something I'd like to rewrite slightly, but for other reasons (avoiding the dynamic memory allocation for the 0 case could be done by re-using the size as 0 character for size 0. Or maybe even full short string optimization like in STL).

     

Log in to post a comment.

MongoDB Logo MongoDB