binutils-gdb/gdb/compile
Simon Marchi 266934d1ad compile-loc2c: Fix uninitialized variable error
Compiling with clang gives this warning/error:

  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:731:6: error: variable 'uoffset' is uninitialized when used here [-Werror,-Wuninitialized]
              uoffset += dwarf2_per_cu_text_offset (per_cu);
              ^~~~~~~
  /home/emaisin/src/binutils-gdb/gdb/compile/compile-loc2c.c:669:23: note: initialize the variable 'uoffset' to silence this warning
        uint64_t uoffset, reg;
                        ^
                         = 0

I am really not sure if what this patch does is good, but it is my best
guess.  DW_OP_addr means that there's an constant address provided by
the DWARF bytecode that should be pushed on the stack.  That address is
considered skipped by the "op_ptr += addr_size", but it is never read.
uoffset is indeed read just after, without having been assigned first.

So I think the intent is to read the address, it was just omitted.

gdb/ChangeLog:

	* compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Read
	address when op is DW_OP_addr.
2017-07-09 20:25:46 +02:00
..
compile-c-support.c Add STRINGIFY to gdb/common/preprocessor.h 2017-06-22 10:59:42 +01:00
compile-c-symbols.c Convert lvalue reference type check to general reference type check 2017-03-20 13:47:54 -07:00
compile-c-types.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
compile-internal.h Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
compile-loc2c.c compile-loc2c: Fix uninitialized variable error 2017-07-09 20:25:46 +02:00
compile-object-load.c Use class to manage BFD reference counts 2017-01-10 19:14:10 -07:00
compile-object-load.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
compile-object-run.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
compile-object-run.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
compile.c Introduce command_line_up 2017-04-12 11:16:17 -06:00
compile.h Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00