public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long
@ 2012-04-03 23:15 hjl.tools at gmail dot com
  2012-04-03 23:29 ` [Bug debug/52857] " hjl.tools at gmail dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-03 23:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

             Bug #: 52857
           Summary: [x32] DW_OP_GNU_regval_type doesn't handle
                    ARG_POINTER_REGNUM properly with -maddress-mode=long
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hjl.tools@gmail.com
                CC: ubizjak@gmail.com


Created attachment 27081
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27081
A testcase

On Linux/x86-64, for the testcase, I got

# /xgcc -B./  -O -g /tmp/x.i -c -mx32 -maddress-mode=long
# readelf -w x.o
...
   <37a3>   DW_AT_GNU_call_site_value: 21 byte block: f5 ff ff ff ff f 25 f4 25
8 80 ff ff ff ff ff ff ff 22 f7 2c     (DW_OP_GNU_regval_type: 4294967295 (r-1)
<0x25>; DW_OP_GNU_const_type: <0x25>  8 byte block: 80 ff ff ff ff ff ff ff ;
DW_OP_plus; DW_OP_GNU_convert <0x2c>)

The problem is

         mem_loc_result = new_loc_descr (DW_OP_GNU_regval_type,
                                          dbx_reg_number (rtl), 0);

with

(gdb) call debug_rtx (rtl)
(reg/f:DI 16 argp)
(gdb) f 3
#3  0x0000000000709ec0 in mem_loc_descriptor (rtl=0x7ffff0e12978, mode=SImode, 
    mem_mode=VOIDmode, initialized=VAR_INIT_STATUS_INITIALIZED)
    at /export/gnu/import/git/gcc-addr32/gcc/dwarf2out.c:11631
11631          mem_loc_result = mem_loc_descriptor (SUBREG_REG (rtl),
(gdb) call debug_rtx (rtl)
(subreg:SI (plus:DI (reg/f:DI 16 argp)
        (const_int -128 [0xffffffffffffff80])) 0)
(gdb)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
@ 2012-04-03 23:29 ` hjl.tools at gmail dot com
  2012-04-06  0:51 ` [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM hjl.tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-03 23:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-03 23:28:42 UTC ---
Does this patch

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);

make senses?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
  2012-04-03 23:29 ` [Bug debug/52857] " hjl.tools at gmail dot com
@ 2012-04-06  0:51 ` hjl.tools at gmail dot com
  2012-04-06 13:06 ` hjl.tools at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-06  0:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-06 00:50:50 UTC ---
A small testcase:

[hjl@gnu-6 delta]$ cat testcase.c
extern void get_BID128 (int *);
void 
__bid128_div (long long bid_y)
{
  int res;
  get_BID128 (&res);
}
[hjl@gnu-6 delta]$ gcc -mx32 -maddress-mode=long -g -O testcase.c -c && readelf
-w testcase.o | grep "DW_OP_GNU_regval_type: 4294967295"
    <79>   DW_AT_GNU_call_site_value: 21 byte block: f5 ff ff ff ff f 25 f4 25
8 ec ff ff ff ff ff ff ff 22 f7 2c     (DW_OP_GNU_regval_type: 4294967295 (r-1)
<0x25>; DW_OP_GNU_const_type: <0x25>  8 byte block: ec ff ff ff ff ff ff ff ;
DW_OP_plus; DW_OP_GNU_convert <0x2c>)
[hjl@gnu-6 delta]$


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
  2012-04-03 23:29 ` [Bug debug/52857] " hjl.tools at gmail dot com
  2012-04-06  0:51 ` [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM hjl.tools at gmail dot com
@ 2012-04-06 13:06 ` hjl.tools at gmail dot com
  2012-04-06 14:52 ` hjl.tools at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-06 13:06 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-06 13:05:49 UTC ---
For

(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

   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
we have ptr_mode = SImode and Pmode == DImode.  However,
arg_pointer_rtx and frame_pointer_rtx are special cases.
They should be allowed even if their mode sizes >
DWARF2_ADDR_SIZE.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2012-04-06 13:06 ` hjl.tools at gmail dot com
@ 2012-04-06 14:52 ` hjl.tools at gmail dot com
  2012-04-06 17:42 ` hjl.tools at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-06 14:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-06 14:51:55 UTC ---
Another testcase:

[hjl@gnu-mic-2 delta]$ cat testcase.c
void uw_init_context_1 (void *);
void _Unwind_ForcedUnwind (void)
{
  uw_init_context_1 (__builtin_dwarf_cfa ());
}
[hjl@gnu-mic-2 delta]$ /export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -mx32 -O2 -g  -fPIC -S
-maddress-mode=long testcase.c
testcase.c: In function \u2018_Unwind_ForcedUnwind\u2019:
testcase.c:5:1: internal compiler error: in mem_loc_descriptor, at
dwarf2out.c:11675
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-mic-2 delta]$


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (3 preceding siblings ...)
  2012-04-06 14:52 ` hjl.tools at gmail dot com
@ 2012-04-06 17:42 ` hjl.tools at gmail dot com
  2012-04-25 19:09 ` hjl at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-04-06 17:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2012-04/msg00358.htm
                   |                            |l

--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-06 17:41:01 UTC ---
A patch is posted at

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg00358.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (4 preceding siblings ...)
  2012-04-06 17:42 ` hjl.tools at gmail dot com
@ 2012-04-25 19:09 ` hjl at gcc dot gnu.org
  2012-06-24 14:24 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-04-25 19:09 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #6 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-04-25 19:08:29 UTC ---
Author: hjl
Date: Wed Apr 25 19:08:23 2012
New Revision: 186837

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186837
Log:
Assert dbx_reg_number doesn't return INVALID_REGNUM

    PR debug/52857
    * dwarf2out.c (dbx_reg_number): Assert return value !=
    INVALID_REGNUM.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (5 preceding siblings ...)
  2012-04-25 19:09 ` hjl at gcc dot gnu.org
@ 2012-06-24 14:24 ` hjl.tools at gmail dot com
  2012-08-24 13:22 ` hjl at gcc dot gnu.org
  2012-12-07 22:11 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-06-24 14:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|http://gcc.gnu.org/ml/gcc-p |http://gcc.gnu.org/ml/gcc-p
                   |atches/2012-04/msg00358.htm |atches/2012-04/msg01815.htm
                   |l                           |l

--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> 2012-06-24 14:23:51 UTC ---
The updated patch is at

http://gcc.gnu.org/ml/gcc-patches/2012-04/msg01815.html


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (6 preceding siblings ...)
  2012-06-24 14:24 ` hjl.tools at gmail dot com
@ 2012-08-24 13:22 ` hjl at gcc dot gnu.org
  2012-12-07 22:11 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at gcc dot gnu.org @ 2012-08-24 13:22 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

--- Comment #8 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> 2012-08-24 13:22:02 UTC ---
Author: hjl
Date: Fri Aug 24 13:21:55 2012
New Revision: 190647

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190647
Log:
Allow arg_pointer_rtx/frame_pointer_rtx for based_loc_descr

gcc/

    PR debug/52857
    * dwarf2out.c (mem_loc_descriptor): Allow arg_pointer_rtx and
    frame_pointer_rtx for based_loc_descr.

gcc/testsuite/

    PR debug/52857
    * gcc.target/i386/pr52857-1.c: New.
    * gcc.target/i386/pr52857-2.c: Likewise.

Added:
    trunk/gcc/testsuite/gcc.target/i386/pr52857-1.c
    trunk/gcc/testsuite/gcc.target/i386/pr52857-2.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dwarf2out.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM
  2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
                   ` (7 preceding siblings ...)
  2012-08-24 13:22 ` hjl at gcc dot gnu.org
@ 2012-12-07 22:11 ` hjl.tools at gmail dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hjl.tools at gmail dot com @ 2012-12-07 22:11 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52857

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.8.0

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> 2012-12-07 22:11:26 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2012-12-07 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 23:15 [Bug debug/52857] New: [x32] DW_OP_GNU_regval_type doesn't handle ARG_POINTER_REGNUM properly with -maddress-mode=long hjl.tools at gmail dot com
2012-04-03 23:29 ` [Bug debug/52857] " hjl.tools at gmail dot com
2012-04-06  0:51 ` [Bug debug/52857] DW_OP_GNU_regval_type is generated with INVALID_REGNUM hjl.tools at gmail dot com
2012-04-06 13:06 ` hjl.tools at gmail dot com
2012-04-06 14:52 ` hjl.tools at gmail dot com
2012-04-06 17:42 ` hjl.tools at gmail dot com
2012-04-25 19:09 ` hjl at gcc dot gnu.org
2012-06-24 14:24 ` hjl.tools at gmail dot com
2012-08-24 13:22 ` hjl at gcc dot gnu.org
2012-12-07 22:11 ` hjl.tools at gmail dot com

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).