diff mbox

Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853)

Message ID BANLkTinU_1JzzZhm-ZkUr7xwuCo+VrhjsQ@mail.gmail.com
State New
Headers show

Commit Message

H.J. Lu May 7, 2011, 1:11 a.m. UTC
On Thu, May 5, 2011 at 2:20 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> My typed DWARF stack changes apparently broke ia64-hpux and H.J.'s out of
> tree x32 target.  There are several issues:
> 1) for SUBREG mem_loc_descriptor's 3rd argument was wrong, found by code
>   inspection
> 2) CONST/SYMBOL_REF/LABEL_REF when in MEM addresses on POINTERS_EXTEND_UNSIGNED
>   targets are often Pmode, which is unfortunately larger than DWARF2_ADDR_SIZE
>   and my conditional would just return NULL in that case instead of
>   emitting DW_OP_addr.
> 3) and, when mem_loc_descriptor is called from unwind code, Pmodes larger
>   than DWARF2_ADDR_SIZE would result in the new DW_OP_GNU_*_type etc. ops
>   which are not allowed in .eh_frame/.debug_frame
> The following patch ought to fix that, bootstrapped/regtested on
> x86_64-linux and i686-linux and Steve tested it on ia64-hpux and H.J. on his
> port.  Ok for trunk?
>
> 2011-05-05  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/48853
>        * dwarf2out.c (mem_loc_descriptor) <case SUBREG>: Pass mem_mode
>        instead of mode as 3rd argument to recursive call.
>        (mem_loc_descriptor) <case REG>: If POINTERS_EXTEND_UNSIGNED, don't
>        emit DW_OP_GNU_regval_type if mode is Pmode and mem_mode is not
>        VOIDmode.
>        (mem_loc_descriptor) <case SYMBOL_REF>: If POINTERS_EXTEND_UNSIGNED,
>        don't give up if mode is Pmode and mem_mode is not VOIDmode.
>        (mem_loc_descriptor) <case CONST_INT>: If POINTERS_EXTEND_UNSIGNED,
>        use int_loc_descriptor if mode is Pmode and mem_mode is not VOIDmode.
>

Here is the missing patch for case SUBREG.  OK for trunk if there is
no regressions?

Thanks.


H.J.
----
2011-05-06  H.J. Lu  <hongjiu.lu@intel.com>

	PR debug/48853
	* dwarf2out.c (mem_loc_descriptor) <case SUBREG>: If
	POINTERS_EXTEND_UNSIGNED, don't give up if mode is Pmode and
	mem_mode is not VOIDmode.

Comments

Jason Merrill May 9, 2011, 6:04 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 026e4a7..049ca8e 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -13892,7 +13892,11 @@  mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 	break;
       if (GET_MODE_CLASS (mode) == MODE_INT
 	  && GET_MODE_CLASS (GET_MODE (SUBREG_REG (rtl))) == MODE_INT
-	  && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+	  && (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+#ifdef POINTERS_EXTEND_UNSIGNED
+	      || (mode == Pmode && mem_mode != VOIDmode)
+#endif
+	     )
 	  && GET_MODE_SIZE (GET_MODE (SUBREG_REG (rtl))) <= DWARF2_ADDR_SIZE)
 	{
 	  mem_loc_result = mem_loc_descriptor (SUBREG_REG (rtl),