https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82600
Bug ID: 82600
Summary: Address of local variable returned
[-Werror=return-local-addr] when building
mozilla-central
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: andi at mozilla dot com
Target Milestone: ---
Building firefox with gcc8 trunk i get this error:
In file included from
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/memory/build/Unified_cpp_memory_build0.cpp:2:0:
/root/firefox-gcc-last/memory/build/mozjemalloc.cpp: In member function
'void** AddressRadixTree<Bits>::GetSlot(void*, bool)':
/root/firefox-gcc-last/memory/build/mozjemalloc.cpp:1695:10: error: address of
local variable 'node' returned [-Werror=return-local-addr]
void** node;
^~~~
cc1plus: all warnings being treated as errors
The entire context can be found here:
[1]
http://searchfox.org/mozilla-central/rev/a984558fa2bbde6492d3fb918496fc0b0835b2ce/memory/build/mozjemalloc.cpp#1721
[2]
http://searchfox.org/mozilla-central/rev/a984558fa2bbde6492d3fb918496fc0b0835b2ce/memory/build/mozjemalloc.cpp#1698
It can easily be seen that by just analysing [2] 'node' only points somewhere
in 'mRoot'.