Warnings when Building Release - Ubuntu GCC 7.5.0

As I’m trying to configure a GitHub Action to build our app on Ubuntu, these warnings creep up when building for Release using GCC.

Strangely enough, Clang 6.0.0 on the same Ubuntu doesn’t complain…

In file included from ../../submodules/JUCE/modules/juce_core/juce_core.cpp:139:0,
                 from ../../JuceLibraryCode/include_juce_core.cpp:9:
In function ‘void operator delete [](void*)’,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder*)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:164:52:
../../submodules/JUCE/modules/juce_core/memory/juce_AllocationHooks.cpp:65:15: warning: attempt to free a non-heap object ‘juce::emptyString’ [-Wfree-nonheap-object]
     std::free (p);
     ~~~~~~~~~~^~~
Compiling include_juce_dsp.cpp
In function ‘void operator delete [](void*)’,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder*)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:164:52,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder::CharPointerType)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:169:17,
    inlined from ‘juce::String::~String()’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:249:27,
    inlined from ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = juce::String*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<juce::StringArray::sort(bool)::<lambda(const juce::String&, const juce::String&)> >]’ at /usr/include/c++/7/bits/move.h:198:11,
    inlined from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = juce::String*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<juce::StringArray::sort(bool)::<lambda(const juce::String&, const juce::String&)> >]’ at /usr/include/c++/7/bits/stl_algo.h:1923:77:
../../submodules/JUCE/modules/juce_core/memory/juce_AllocationHooks.cpp:65:15: warning: attempt to free a non-heap object ‘juce::emptyString’ [-Wfree-nonheap-object]
     std::free (p);
     ~~~~~~~~~~^~~
In function ‘void operator delete [](void*)’,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder*)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:164:52,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder::CharPointerType)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:169:17,
    inlined from ‘juce::String::~String()’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:249:27,
    inlined from ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = juce::String*; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<juce::StringArray::sortNatural()::<lambda(const juce::String&, const juce::String&)> >]’ at /usr/include/c++/7/bits/move.h:198:11,
    inlined from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = juce::String*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_comp_iter<juce::StringArray::sortNatural()::<lambda(const juce::String&, const juce::String&)> >]’ at /usr/include/c++/7/bits/stl_algo.h:1923:77:
../../submodules/JUCE/modules/juce_core/memory/juce_AllocationHooks.cpp:65:15: warning: attempt to free a non-heap object ‘juce::emptyString’ [-Wfree-nonheap-object]
     std::free (p);
     ~~~~~~~~~~^~~
Compiling include_juce_events.cpp
In function ‘void operator delete [](void*)’,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder*)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:164:52,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder::CharPointerType)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:169:17,
    inlined from ‘juce::String::~String()’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:249:27,
    inlined from ‘juce::File::~File()’ at ../../submodules/JUCE/modules/juce_core/files/juce_File.h:77:5,
    inlined from ‘juce::ArrayBase<ElementType, TypeOfCriticalSectionToUse>::NonTriviallyCopyableVoid<T> juce::ArrayBase<ElementType, TypeOfCriticalSectionToUse>::setAllocatedSizeInternal(int) [with T = juce::File; ElementType = juce::File; TypeOfCriticalSectionToUse = juce::DummyCriticalSection]’ at ../../submodules/JUCE/modules/juce_core/containers/juce_ArrayBase.h:449:13,
    inlined from ‘void juce::ArrayBase<ElementType, TypeOfCriticalSectionToUse>::setAllocatedSize(int) [with ElementType = juce::File; TypeOfCriticalSectionToUse = juce::DummyCriticalSection]’ at ../../submodules/JUCE/modules/juce_core/containers/juce_ArrayBase.h:217:42,
    inlined from ‘void juce::ArrayBase<ElementType, TypeOfCriticalSectionToUse>::ensureAllocatedSize(int) [with ElementType = juce::File; TypeOfCriticalSectionToUse = juce::DummyCriticalSection]’ at ../../submodules/JUCE/modules/juce_core/containers/juce_ArrayBase.h:228:30,
    inlined from ‘void juce::ArrayBase<ElementType, TypeOfCriticalSectionToUse>::add(ElementType&&) [with ElementType = juce::File; TypeOfCriticalSectionToUse = juce::DummyCriticalSection]’ at ../../submodules/JUCE/modules/juce_core/containers/juce_ArrayBase.h:266:29,
    inlined from ‘int juce::File::findChildFiles(juce::Array<juce::File>&, int, bool, const juce::String&) const’ at ../../submodules/JUCE/modules/juce_core/containers/juce_Array.h:431:9:
../../submodules/JUCE/modules/juce_core/memory/juce_AllocationHooks.cpp:65:15: warning: attempt to free a non-heap object ‘juce::emptyString’ [-Wfree-nonheap-object]
     std::free (p);
     ~~~~~~~~~~^~~
Compiling include_juce_graphics.cpp
Compiling include_juce_gui_basics.cpp
In function ‘void operator delete [](void*)’,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder*)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:164:52,
    inlined from ‘static void juce::StringHolder::release(juce::StringHolder::CharPointerType)’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:169:17,
    inlined from ‘juce::String::~String()’ at ../../submodules/JUCE/modules/juce_core/text/juce_String.cpp:249:27,
    inlined from ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = juce::String*; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/7/bits/move.h:198:11,
    inlined from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = juce::String*; _Size = long int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]’ at /usr/include/c++/7/bits/stl_algo.h:1923:77:
../../submodules/JUCE/modules/juce_core/memory/juce_AllocationHooks.cpp:65:15: warning: attempt to free a non-heap object ‘juce::emptyString’ [-Wfree-nonheap-object]
     std::free (p);

Can you try with a more recent version of GCC? It could be a false positive.

Hm, doing an apt upgrade or dist-upgrade doesn’t change the GCC version from the GitHub Actions.

I could manually install GCC during the Action itself but that would eat so much time… Where GitHub Actions have only finite minutes per month.

Someone else would have to try atm…