* PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM
@ 2012-04-04 1:01 H.J. Lu
0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2012-04-04 1:01 UTC (permalink / raw)
To: gcc-patches; +Cc: jason
Hi,
As the testcase in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857
shows, for
(subreg:SI (plus:DI (reg/f:DI 16 argp)
(const_int -128 [0xffffffffffffff80])) 0)
we generates DW_OP_GNU_regval_type with INVALID_REGNUM. This patch
checks dbx_reg_number for INVALID_REGNUM before using it. OK for
trunk and 4.7?
Thanks.
H.J.
---
2012-04-03 H.J. Lu <hongjiu.lu@intel.com>
PR debug/52857
* dwarf2out.c (mem_loc_descriptor): Don't generate
DW_OP_GNU_regval_type with INVALID_REGNUM.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ca88fc5..935c86f 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11664,7 +11664,8 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
if (dwarf_strict)
break;
- if (REGNO (rtl) > FIRST_PSEUDO_REGISTER)
+ if (REGNO (rtl) > FIRST_PSEUDO_REGISTER
+ || dbx_reg_number (rtl) == INVALID_REGNUM)
break;
type_die = base_type_for_mode (mode,
GET_MODE_CLASS (mode) == MODE_INT);
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM
2012-04-25 14:00 H.J. Lu
@ 2012-04-25 18:52 ` Richard Henderson
0 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2012-04-25 18:52 UTC (permalink / raw)
To: H.J. Lu; +Cc: H.J. Lu, gcc-patches, jason, jakub
On 04/25/12 06:59, H.J. Lu wrote:
> PR debug/52857
> * dwarf2out.c (dbx_reg_number): Assert return value !=
> INVALID_REGNUM.
Ok.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM
@ 2012-04-25 14:00 H.J. Lu
2012-04-25 18:52 ` Richard Henderson
0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2012-04-25 14:00 UTC (permalink / raw)
To: gcc-patches; +Cc: jason, jakub
Hi,
We may generate DW_OP_GNU_regval_type with INVALID_REGNUM. This patch
adds an assert to make sure that we don't. OK for trunk?
Thanks.
H.J.
---
2012-04-06 H.J. Lu <hongjiu.lu@intel.com>
PR debug/52857
* dwarf2out.c (dbx_reg_number): Assert return value !=
INVALID_REGNUM.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ca88fc5..515a824 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10167,7 +10167,9 @@ dbx_reg_number (const_rtx rtl)
}
#endif
- return DBX_REGISTER_NUMBER (regno);
+ regno = DBX_REGISTER_NUMBER (regno);
+ gcc_assert (regno != INVALID_REGNUM);
+ return regno;
}
/* Optionally add a DW_OP_piece term to a location description expression.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM
2012-04-06 13:31 H.J. Lu
@ 2012-04-06 17:40 ` H.J. Lu
0 siblings, 0 replies; 5+ messages in thread
From: H.J. Lu @ 2012-04-06 17:40 UTC (permalink / raw)
To: Jason Merrill; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
On Fri, Apr 6, 2012 at 6:30 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> 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?
>
I missed another place where arg_pointer_rtx and frame_pointer_rtx should
be allowed for based_loc_descr. Tested on Linux/ia32, Linux/x86-64 and
Linux/x32. OK for trunk?
Thanks.
--
H.J.
[-- Attachment #2: gcc-pr52857-2.patch --]
[-- Type: application/octet-stream, Size: 2475 bytes --]
gcc/
2012-04-06 H.J. Lu <hongjiu.lu@intel.com>
PR debug/52857
* dwarf2out.c (dbx_reg_number): Assert return value !=
INVALID_REGNUM.
(mem_loc_descriptor): 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-1: New.
* gcc.target/i386/pr52857-2.c: Likewise.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index ca88fc5..515a824 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10167,7 +10167,9 @@ dbx_reg_number (const_rtx rtl)
}
#endif
- return DBX_REGISTER_NUMBER (regno);
+ regno = DBX_REGISTER_NUMBER (regno);
+ gcc_assert (regno != INVALID_REGNUM);
+ return regno;
}
/* Optionally add a DW_OP_piece term to a location description expression.
@@ -11655,6 +11657,8 @@ mem_loc_descriptor (rtx rtl, enum machine_mode mode,
case REG:
if (GET_MODE_CLASS (mode) != MODE_INT
|| (GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE
+ && rtl != arg_pointer_rtx
+ && rtl != frame_pointer_rtx
#ifdef POINTERS_EXTEND_UNSIGNED
&& (mode != Pmode || mem_mode == VOIDmode)
#endif
@@ -11927,7 +11931,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-1.c b/gcc/testsuite/gcc.target/i386/pr52857-1.c
new file mode 100644
index 0000000..16fd78f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr52857-1.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);
+}
diff --git a/gcc/testsuite/gcc.target/i386/pr52857-2.c b/gcc/testsuite/gcc.target/i386/pr52857-2.c
new file mode 100644
index 0000000..879240a
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr52857-2.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-options "-g -O -mx32 -maddress-mode=long" } */
+
+void uw_init_context_1 (void *);
+void _Unwind_ForcedUnwind (void)
+{
+ uw_init_context_1 (__builtin_dwarf_cfa ());
+}
^ permalink raw reply [flat|nested] 5+ messages in thread
* PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM
@ 2012-04-06 13:31 H.J. Lu
2012-04-06 17:40 ` H.J. Lu
0 siblings, 1 reply; 5+ messages in thread
From: H.J. Lu @ 2012-04-06 13:31 UTC (permalink / raw)
To: gcc-patches
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);
+}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-04-25 18:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04 1:01 PATCH: PR debug/52857: DW_OP_GNU_regval_type is generated with INVALID_REGNUM H.J. Lu
2012-04-06 13:31 H.J. Lu
2012-04-06 17:40 ` H.J. Lu
2012-04-25 14:00 H.J. Lu
2012-04-25 18:52 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).