[ was: Re: [committed][gdbserver] Fix Wlto-type-mismatch for debug_agent ] On 6/17/20 6:38 PM, Tom de Vries wrote: > On 6/12/20 8:19 PM, Christian Biesinger wrote: >> On Fri, Jun 12, 2020 at 11:37 AM Tom de Vries wrote: >>> >>> Hi, >>> >>> When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto, >>> I run into: >>> ... >>> src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \ >>> does not match original declaration [-Werror=lto-type-mismatch] >>> extern bool debug_agent; >>> ^ >>> src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool' >>> int debug_agent = 0; >>> ^ >>> src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here >>> src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \ >>> -fno-strict-aliasing is used >> >> So it sounds like this didn't come up before because ax.cc doesn't >> include gdbsupport/agent.h? > > Yes. > >> It probably should? > > Um, good point, thanks. > > Though ax.h does: > ... > #ifdef IN_PROCESS_AGENT > #define debug_threads debug_agent > #endif > ... > so I wonder if we should have the include there instead. I'll try to > test this. Any comments? Thanks, - Tom