public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/45299]  New: Dwarf information is wrong with optimised code.
@ 2010-08-16 16:09 hariharans at picochip dot com
  2010-08-16 16:18 ` [Bug debug/45299] " hariharans at picochip dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:09 UTC (permalink / raw)
  To: gcc-bugs

I saw this problem initially on 4.5.0 compiler, but the same problem happens on
mainline too. In function arraysum in the attached example, the parameter
array, which is a pointer to array of


-- 
           Summary: Dwarf information is wrong with optimised code.
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hariharans at picochip dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: picochip-unknown-none


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


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

* [Bug debug/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
@ 2010-08-16 16:18 ` hariharans at picochip dot com
  2010-08-16 16:19 ` hariharans at picochip dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hariharans at picochip dot com  2010-08-16 16:17 -------
Sorry for the incomplete description. The actual description:

I saw this problem initially on 4.5.0 compiler, but the same problem happens on
mainline too. In function arraysum in the attached example, the parameter
array, which is a pointer to array of int actually gets reflected in dwarf
wrong. The dwarf reader that we have says this

      <0x457> (15) Inlined subroutine: "arraySum"
        Called from:
          File: /home/gccuser/Tools/Verification/Debugger/symbolic/symbolic.vhd
          Line: 603
          Column: 0
        Address Ranges: [0x40, 0x63) 
        <0x463> (16) Parameter:
          Name: size
          Type: <0x35a>
          Location: DW_OP_reg1 
        <0x46a> (17) Parameter:
          Name: array
          Type: <0x3f3>
          Location: 
        [47, 51) : DW_OP_reg0 

In the range [47,51) array parameter resides in reg0, according to dwarf. This
is valid only at instruction at 47.  The instruction does this.

ldw (r0)0, r0

So, r0 now contains the first value in the array instead of the address and
hence the dwarf is wrong for the rest of this address range.

Disabling VTA means most of the variables in this testcase become "Not
Present".

I will add the source file, assembly and address encoded assembly so you can
see what is going on. Please let me know if you need any other information.


-- 


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


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

* [Bug debug/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
  2010-08-16 16:18 ` [Bug debug/45299] " hariharans at picochip dot com
@ 2010-08-16 16:19 ` hariharans at picochip dot com
  2010-08-16 16:24 ` hariharans at picochip dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hariharans at picochip dot com  2010-08-16 16:19 -------
Created an attachment (id=21492)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21492&action=view)
The source code


-- 


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


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

* [Bug debug/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (2 preceding siblings ...)
  2010-08-16 16:24 ` hariharans at picochip dot com
@ 2010-08-16 16:24 ` hariharans at picochip dot com
  2010-08-16 16:28 ` hariharans at picochip dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from hariharans at picochip dot com  2010-08-16 16:24 -------
Created an attachment (id=21494)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21494&action=view)
assembly code


-- 


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


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

* [Bug debug/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
  2010-08-16 16:18 ` [Bug debug/45299] " hariharans at picochip dot com
  2010-08-16 16:19 ` hariharans at picochip dot com
@ 2010-08-16 16:24 ` hariharans at picochip dot com
  2010-08-16 16:24 ` hariharans at picochip dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from hariharans at picochip dot com  2010-08-16 16:23 -------
Created an attachment (id=21493)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21493&action=view)
The source code


-- 

hariharans at picochip dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21492|0                           |1
        is obsolete|                            |


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


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

* [Bug debug/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (3 preceding siblings ...)
  2010-08-16 16:24 ` hariharans at picochip dot com
@ 2010-08-16 16:28 ` hariharans at picochip dot com
  2010-08-17 10:06 ` [Bug target/45299] " jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-16 16:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hariharans at picochip dot com  2010-08-16 16:28 -------
Created an attachment (id=21495)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21495&action=view)
address encoded assembly


-- 


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


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

* [Bug target/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (4 preceding siblings ...)
  2010-08-16 16:28 ` hariharans at picochip dot com
@ 2010-08-17 10:06 ` jakub at gcc dot gnu dot org
  2010-08-28 16:14 ` hariharans at picochip dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-08-17 10:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2010-08-17 10:06 -------
Sounds like a target bug.
After variable_tracking_main the notes look correct:
(note 88 23 89 2 (var_location array (reg:HI 0 R0 [ pass_through_array ]))
NOTE_INSN_VAR_LOCATION)

(note 89 88 90 2 (var_location size (reg:HI 1 R1 [ pass_through_size ]))
NOTE_INSN_VAR_LOCATION)

(note 90 89 32 2 (var_location i (const_int 0 [0])) NOTE_INSN_VAR_LOCATION)

(insn:TI 32 90 91 2 (set (reg/v:HI 0 R0 [orig:50 sum ] [50])
        (mem:HI (reg/f:HI 0 R0 [orig:62 pass_through_array ] [62]) [2
*pass_through_array_1(D)+0 S2 A16])) b45299.c:12 15 {movhi}
     (nil))

(note 91 32 92 2 (var_location pass_through_array (reg/v/f:HI 5 R5 [orig:62
pass_through_array ] [62])) NOTE_INSN_VAR_LOCATION)

(note 92 91 93 2 (var_location array (reg/v/f:HI 5 R5 [orig:62
pass_through_array ] [62])) NOTE_INSN_VAR_LOCATION)

but then reorder_var_tracking_notes drops some notes on the floor and moves
others.  Clearly a target bug.  Dropping on the floor is certainly wrong, and
the moving results in invalid debug info too.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|debug                       |target
           Keywords|wrong-debug                 |


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


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

* [Bug target/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (5 preceding siblings ...)
  2010-08-17 10:06 ` [Bug target/45299] " jakub at gcc dot gnu dot org
@ 2010-08-28 16:14 ` hariharans at picochip dot com
  2010-08-28 16:16 ` hariharans at picochip dot com
  2010-08-28 17:17 ` hariharans at picochip dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-28 16:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from hariharans at picochip dot com  2010-08-28 16:14 -------
picochip is a vliw processor and reorder_var_tracking_notes tries to move debug
instructions from middle of vliw instructions out. There was a bug in that
which resulted in this problem. 


-- 


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


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

* [Bug target/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (6 preceding siblings ...)
  2010-08-28 16:14 ` hariharans at picochip dot com
@ 2010-08-28 16:16 ` hariharans at picochip dot com
  2010-08-28 17:17 ` hariharans at picochip dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-28 16:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from hariharans at picochip dot com  2010-08-28 16:15 -------
Created an attachment (id=21585)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21585&action=view)
Patch to fix the problem


-- 


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


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

* [Bug target/45299] Dwarf information is wrong with optimised code.
  2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
                   ` (7 preceding siblings ...)
  2010-08-28 16:16 ` hariharans at picochip dot com
@ 2010-08-28 17:17 ` hariharans at picochip dot com
  8 siblings, 0 replies; 10+ messages in thread
From: hariharans at picochip dot com @ 2010-08-28 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from hariharans at picochip dot com  2010-08-28 17:17 -------
Fixed on mainline.


-- 

hariharans at picochip dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-08-28 17:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-16 16:09 [Bug debug/45299] New: Dwarf information is wrong with optimised code hariharans at picochip dot com
2010-08-16 16:18 ` [Bug debug/45299] " hariharans at picochip dot com
2010-08-16 16:19 ` hariharans at picochip dot com
2010-08-16 16:24 ` hariharans at picochip dot com
2010-08-16 16:24 ` hariharans at picochip dot com
2010-08-16 16:28 ` hariharans at picochip dot com
2010-08-17 10:06 ` [Bug target/45299] " jakub at gcc dot gnu dot org
2010-08-28 16:14 ` hariharans at picochip dot com
2010-08-28 16:16 ` hariharans at picochip dot com
2010-08-28 17:17 ` hariharans at picochip 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).