mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-06-02 09:22:36 +02:00
5710c98fbf
The dwarf_eval_expr routine uses macros push, pop, and pick to manipulate the DWARF expression stack. When these macros are nested, e.g. in the implementation of DW_OP_dup: push (pick (0)); the combination can lead to unfortunate results. In particular, when substituting into: do { if (tos >= MAX_EXPR_STACK_SIZE) { Debug (1, "Stack overflow\n"); return -UNW_EINVAL; } stack[tos++] = (x); } while (0) a value of "x" that makes use of "tos" (as instances of the pick or pop macros do), the resulting expression will both use and modify tos without an intervening sequence point, which is undefined behavior according to the C standard. And in fact with current GCC on PowerPC, this leads to a miscompilation of the DW_OP_dup implementation. This patch fixes the problem by assigning "x" to a temporary variable before modifying tos. Signed-off-by: Ulrich Weigand <uweigand@de.ibm.com> |
||
---|---|---|
.. | ||
Gexpr.c | ||
Gfde.c | ||
Gfind_proc_info-lsb.c | ||
Gfind_unwind_table.c | ||
global.c | ||
Gparser.c | ||
Gpe.c | ||
Gstep.c | ||
Lexpr.c | ||
Lfde.c | ||
Lfind_proc_info-lsb.c | ||
Lfind_unwind_table.c | ||
Lparser.c | ||
Lpe.c | ||
Lstep.c |