From: Mark Wielaard Date: Thu, 27 Nov 2014 22:41:57 +0000 (+0100) Subject: libdw: Initialize variables in getcfi_gnu_eh_frame. X-Git-Tag: elfutils-0.161~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=12ab700282dd66d5d2144e13611011426091f260;p=thirdparty%2Felfutils.git libdw: Initialize variables in getcfi_gnu_eh_frame. Some older GCCs are not clever enough to realize that when search_table is NULL not only are search_table_entries and search_table_encoding not initialized, they are also not used. Giving "may be used uninitialized" errors. Signed-off-by: Mark Wielaard --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index 37f94df10..c199707d9 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2014-11-27 Mark Wielaard + + * dwarf_getcfi_elf.c (getcfi_gnu_eh_frame): Initialize + search_table_entries and search_table_encoding. + 2014-11-24 Mark Wielaard * dwarf_getsrclines.c (read_srclines): Check line_range is not zero diff --git a/libdw/dwarf_getcfi_elf.c b/libdw/dwarf_getcfi_elf.c index a423ef3df..61ca60de4 100644 --- a/libdw/dwarf_getcfi_elf.c +++ b/libdw/dwarf_getcfi_elf.c @@ -1,5 +1,5 @@ /* Get CFI from ELF file's exception-handling info. - Copyright (C) 2009-2010 Red Hat, Inc. + Copyright (C) 2009-2010, 2014 Red Hat, Inc. This file is part of elfutils. This file is free software; you can redistribute it and/or modify @@ -140,8 +140,8 @@ getcfi_gnu_eh_frame (Elf *elf, const GElf_Ehdr *ehdr, const GElf_Phdr *phdr) } Dwarf_Addr eh_frame_ptr; - size_t search_table_entries; - uint8_t search_table_encoding; + size_t search_table_entries = 0; + uint8_t search_table_encoding = 0; const uint8_t *search_table = parse_eh_frame_hdr (data->d_buf, phdr->p_filesz, phdr->p_vaddr, ehdr, &eh_frame_ptr,