This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM


Hi,

With ptr_mode = SImode and Pmode == DImode, given

(note 21 8 17 2 (expr_list:REG_DEP_TRUE (concat:SI (reg:SI 5 di) 
        (subreg:SI (plus:DI (reg/f:DI 16 argp)
                (const_int -20 [0xffffffffffffffec])) 0)) 
    (nil)) NOTE_INSN_CALL_ARG_LOCATION)

when

(plus:DI (reg/f:DI 16 argp)
    (const_int -20 [0xffffffffffffffec]))

reaches mem_loc_descriptor:

   case PLUS: 
    plus: 
      if (is_based_loc (rtl) 
          && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
          && GET_MODE_CLASS (mode) == MODE_INT)
        mem_loc_result = based_loc_descr (XEXP (rtl, 0),
                                          INTVAL (XEXP (rtl, 1)),
                                          VAR_INIT_STATUS_INITIALIZED);
      else  

it fails "GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE" since mode is DImode
and DWARF2_ADDR_SIZE is 4.  arg_pointer_rtx and frame_pointer_rtx are
special cases.  They should be allowed for based_loc_descr even if their
mode sizes > DWARF2_ADDR_SIZE.  OK for trunk?

Thanks.


H.J.
----
gcc/

2012-04-06  H.J. Lu  <hongjiu.lu@intel.com>

	PR debug/52857
	* dwarf2out.c (mem_loc_descriptor): Assert dbx_reg_number !=
	INVALID_REGNUM for DW_OP_GNU_regval_type.  Allow
	arg_pointer_rtx and frame_pointer_rtx for based_loc_descr.

gcc/testsuite/

2012-04-06  H.J. Lu  <hongjiu.lu@intel.com>

	PR debug/52857
	* gcc.target/i386/pr52857.c: New.

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ca88fc5..ab20683 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11661,6 +11661,7 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 	      ))
 	{
 	  dw_die_ref type_die;
+	  unsigned int dbx_regno;
 
 	  if (dwarf_strict)
 	    break;
@@ -11670,8 +11671,10 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
 					 GET_MODE_CLASS (mode) == MODE_INT);
 	  if (type_die == NULL)
 	    break;
+	  dbx_regno = dbx_reg_number (rtl);
+	  gcc_assert (dbx_regno != INVALID_REGNUM);
 	  mem_loc_result = new_loc_descr (DW_OP_GNU_regval_type,
-					  dbx_reg_number (rtl), 0);
+					  dbx_regno, 0);
 	  mem_loc_result->dw_loc_oprnd2.val_class = dw_val_class_die_ref;
 	  mem_loc_result->dw_loc_oprnd2.v.val_die_ref.die = type_die;
 	  mem_loc_result->dw_loc_oprnd2.v.val_die_ref.external = 0;
@@ -11927,7 +11930,9 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
     case PLUS:
     plus:
       if (is_based_loc (rtl)
-	  && GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+	  && (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
+	      || XEXP (rtl, 0) == arg_pointer_rtx
+	      || XEXP (rtl, 0) == frame_pointer_rtx)
 	  && GET_MODE_CLASS (mode) == MODE_INT)
 	mem_loc_result = based_loc_descr (XEXP (rtl, 0),
 					  INTVAL (XEXP (rtl, 1)),
diff --git a/gcc/testsuite/gcc.target/i386/pr52857.c b/gcc/testsuite/gcc.target/i386/pr52857.c
new file mode 100644
index 0000000..16fd78f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr52857.c
@@ -0,0 +1,10 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-g -O -mx32 -maddress-mode=long" } */
+
+extern void get_BID128 (int *);
+void 
+__bid128_div (void)
+{
+  int res;
+  get_BID128 (&res);
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]