From 5cc5056844a402c6cf466c8ca45119a4540b5900 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 7 Jul 2009 20:19:40 +0200 Subject: PR10348 Compilation failure with gcc 4.5 snapshot: switch jumps over vars. * loc2c-test.c (print_vars): Define attr_mem, typedie_mem and typedie before switch. * loc2c.c (translate): Wrap case DW_OP_drop in block brackets. (location_relative): Initialize stack. --- loc2c-test.c | 7 ++++--- loc2c.c | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/loc2c-test.c b/loc2c-test.c index 01edc805..01108573 100644 --- a/loc2c-test.c +++ b/loc2c-test.c @@ -378,6 +378,9 @@ static void print_vars (unsigned int indent, Dwarf_Die *die) { Dwarf_Die child; + Dwarf_Attribute attr_mem; + Dwarf_Die typedie_mem; + Dwarf_Die *typedie; if (dwarf_child (die, &child) == 0) do switch (dwarf_tag (&child)) @@ -387,9 +390,7 @@ print_vars (unsigned int indent, Dwarf_Die *die) printf ("%*s%-30s[%6" PRIx64 "]", indent, "", dwarf_diename (&child), (uint64_t) dwarf_dieoffset (&child)); - Dwarf_Attribute attr_mem; - Dwarf_Die typedie_mem; - Dwarf_Die *typedie = dwarf_formref_die + typedie = dwarf_formref_die (dwarf_attr_integrate (&child, DW_AT_type, &attr_mem), &typedie_mem); print_type (typedie, '\t'); diff --git a/loc2c.c b/loc2c.c index 7cae16cd..f95400bb 100644 --- a/loc2c.c +++ b/loc2c.c @@ -251,9 +251,11 @@ translate (struct obstack *pool, int indent, Dwarf_Addr addrbias, break; case DW_OP_drop: - POP (ignore); - emit ("%*s/* drop " STACKFMT "*/\n", indent * 2, "", ignore); - break; + { + POP (ignore); + emit ("%*s/* drop " STACKFMT "*/\n", indent * 2, "", ignore); + break; + } case DW_OP_pick: sp = expr[i].number; @@ -622,7 +624,7 @@ location_relative (struct obstack *pool, const Dwarf_Op *expr, size_t len, Dwarf_Addr address, struct location **input, Dwarf_Attribute *fb_attr) { - Dwarf_Sword *stack; + Dwarf_Sword *stack = NULL; unsigned int stack_depth = 0, max_stack = 0; inline void deepen (void) { -- cgit