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

             Bug #: 51517
           Summary: [4.4 regression ] Wrong debug information for pointers
                    with negative strides.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: debug
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: niko...@totalviewtech.com


Created attachment 26062
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26062
Example to demostrate

Consider attached examples, pointer ip: 
integer, dimension (:), pointer :: ip

If you associate it twice for two variables, 
.....
ip   => it  (10:1:-2)
.... 
ip    => unpleasant%small_pad

than stride calculated as zero
 <2><b2>: Abbrev Number: 7 (DW_TAG_variable)
     DW_AT_name        : ip    
     DW_AT_decl_file   : 1    
     DW_AT_decl_line   : 8    
     DW_AT_type        : <165>    
     DW_AT_location    : 3 byte block: 91 b0 7e     (DW_OP_fbreg: -208)
 <1><165>: Abbrev Number: 15 (DW_TAG_array_type)
     DW_AT_data_location: 2 byte block: 97 6     (DW_OP_push_object_address;
DW_OP_deref)
     DW_AT_associated  : 4 byte block: 97 6 30 2e    
(DW_OP_push_object_address; DW_OP_deref; DW_OP_lit0; DW_OP_ne)
     DW_AT_type        : <60>    
     DW_AT_sibling     : <189>
 <2><176>: Abbrev Number: 14 (DW_TAG_subrange_type)
     DW_AT_lower_bound : 4 byte block: 97 23 20 6    
(DW_OP_push_object_address; DW_OP_plus_uconst: 32; DW_OP_deref)
     DW_AT_upper_bound : 4 byte block: 97 23 28 6    
(DW_OP_push_object_address; DW_OP_plus_uconst: 40; DW_OP_deref)
     DW_AT_stride      : 6 byte block: 97 23 18 6 30 1e    
(DW_OP_push_object_address; DW_OP_plus_uconst: 24; DW_OP_deref; DW_OP_lit0;
DW_OP_mul)

I think error is in: DW_OP_lit0. Should be something like DW_OP_lit2

This is regression from 4.4 and is broken in 4.5 and 4.6

I have attached an example that you can compile and verify.

Reply via email to