From 8b495402400e81c04278169c6176888f936fd6af Mon Sep 17 00:00:00 2001 From: DJ Delorie Date: Tue, 20 Apr 2004 20:24:05 -0400 Subject: [PATCH] dwarf2out.c (rtl_for_decl_location): Adjust rtl for byte variables stored in word registers, then in memory. * dwarf2out.c (rtl_for_decl_location): Adjust rtl for byte variables stored in word registers, then in memory. From-SVN: r80941 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 58436c33b0e..3c7c4997e15 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-04-20 DJ Delorie + + * dwarf2out.c (rtl_for_decl_location): Adjust rtl for byte + variables stored in word registers, then in memory. + 2004-04-20 Eric Christopher * cp/parser.c (cp_parser_declaration): Move translate diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 86512a4f8f5..9cd05a0a644 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -9756,6 +9756,24 @@ rtl_for_decl_location (tree decl) plus_constant (XEXP (rtl, 0), offset)); } } + else if (TREE_CODE (decl) == VAR_DECL + && GET_CODE (rtl) == MEM + && GET_MODE (rtl) != TYPE_MODE (TREE_TYPE (decl)) + && BYTES_BIG_ENDIAN) + { + int rsize = GET_MODE_SIZE (GET_MODE (rtl)); + int dsize = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl))); + + /* If a variable is declared "register" yet is smaller than + a register, then if we store the variable to memory, it + looks like we're storing a register-sized value, when in + fact we are not. We need to adjust the offset of the + storage location to reflect the actual value's bytes, + else gdb will not be able to display it. */ + if (rsize > dsize) + rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (decl)), + plus_constant (XEXP (rtl, 0), rsize-dsize)); + } if (rtl != NULL_RTX) { -- 2.30.2