aboutsummaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2023-04-29 22:46:11 +0200
committerMark Wielaard <mark@klomp.org>2023-05-02 17:43:31 +0200
commit433e8364fedffb394d5cac29691f2bb0480369a4 (patch)
tree39e2e80485e229116c36f29611f5a144907a4101 /gdb/infcmd.c
parent69330acb2014b3b520206f53a244815226897f9b (diff)
downloadgdb-433e8364fedffb394d5cac29691f2bb0480369a4.zip
gdb-433e8364fedffb394d5cac29691f2bb0480369a4.tar.gz
gdb-433e8364fedffb394d5cac29691f2bb0480369a4.tar.bz2
xcoffread.c: Fix -Werror=dangling-pointer= issue with main_subfile.
GCC 13 points out that main_subfile has local function scope, but a pointer to it is assigned to the global inclTable array subfile element field: In function ‘void process_linenos(CORE_ADDR, CORE_ADDR)’, inlined from ‘void aix_process_linenos(objfile*)’ at xcoffread.c:727:19, inlined from ‘void aix_process_linenos(objfile*)’ at xcoffread.c:720:1: xcoffread.c:629:37: error: storing the address of local variable ‘main_subfile’ in ‘*inclTable.19_45 + _28._inclTable::subfile’ [-Werror=dangling-pointer=] 629 | inclTable[ii].subfile = &main_subfile; | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~ xcoffread.c: In function ‘void aix_process_linenos(objfile*)’: xcoffread.c:579:18: note: ‘main_subfile’ declared here 579 | struct subfile main_subfile; | ^~~~~~~~~~~~ xcoffread.c:496:19: note: ‘inclTable’ declared here 496 | static InclTable *inclTable; /* global include table */ | ^~~~~~~~~ Fix this by making main_subfile file static. And allocate and deallocated together with inclTable in allocate_include_entry and xcoff_symfile_finish. Adjust the use of main_subfile in process_linenos to take a pointer to the subfile.
Diffstat (limited to 'gdb/infcmd.c')
0 files changed, 0 insertions, 0 deletions