This is the mail archive of the gcc-bugs@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]

[Bug c/38479] New: Incorrect dwarf generated for function with parameters greater 4 words in length


The following code:


int foo(int p1, int p2, int p3, long long int p4)
{
  return 0;
}


Compiled with:


arm-unknown-elf-gcc -c -g foo.c

Using built-in specs.
Target: arm-unknown-elf
Configured with: /home/products/build/gcc/gnu-4.3.2/sources/gcc-4.3.2/configure
--build i686-pc-linux-gnu --host i686-pc-linux-gnu --target arm-unknown-elf
--prefix=/home/products/build/gcc/gnu-4.3.2/i686-pc-linux-gnu/install
--enable-languages=c++,c
--with-gmp=/home/products/build/gcc/gnu-4.3.2/i686-pc-linux-gnu/install
--with-mpfr=/home/products/build/gcc/gnu-4.3.2/i686-pc-linux-gnu/install
--with-included-gettext
Thread model: single
gcc version 4.3.2 (GCC)


Generates the following:


foo.o:     file format elf32-littlearm

Disassembly of section .text:

00000000 <foo>:
   0:   e1a0c00d        mov     ip, sp
   4:   e24dd004        sub     sp, sp, #4      ; 0x4
   8:   e92dd800        push    {fp, ip, lr, pc}
   c:   e24cb008        sub     fp, ip, #8      ; 0x8
  10:   e24dd00c        sub     sp, sp, #12     ; 0xc
  14:   e50b0010        str     r0, [fp, #-16]
  18:   e50b1014        str     r1, [fp, #-20]
  1c:   e50b2018        str     r2, [fp, #-24]
  20:   e58b3004        str     r3, [fp, #4]
  24:   e3a03000        mov     r3, #0  ; 0x0
  28:   e1a00003        mov     r0, r3
  2c:   e24bd00c        sub     sp, fp, #12     ; 0xc
  30:   e89da800        ldm     sp, {fp, sp, pc}

Contents of the .debug_abbrev section:

  Number TAG
   1      DW_TAG_compile_unit    [has children]
    DW_AT_producer     DW_FORM_strp
    DW_AT_language     DW_FORM_data1
    DW_AT_name         DW_FORM_strp
    DW_AT_comp_dir     DW_FORM_strp
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_high_pc      DW_FORM_addr
    DW_AT_stmt_list    DW_FORM_data4
   2      DW_TAG_subprogram    [has children]
    DW_AT_external     DW_FORM_flag
    DW_AT_name         DW_FORM_string
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_prototyped   DW_FORM_flag
    DW_AT_type         DW_FORM_ref4
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_high_pc      DW_FORM_addr
    DW_AT_frame_base   DW_FORM_data4
    DW_AT_sibling      DW_FORM_ref4
   3      DW_TAG_formal_parameter    [no children]
    DW_AT_name         DW_FORM_string
    DW_AT_decl_file    DW_FORM_data1
    DW_AT_decl_line    DW_FORM_data1
    DW_AT_type         DW_FORM_ref4
    DW_AT_location     DW_FORM_block1
   4      DW_TAG_base_type    [no children]
    DW_AT_byte_size    DW_FORM_data1
    DW_AT_encoding     DW_FORM_data1
    DW_AT_name         DW_FORM_string
   5      DW_TAG_base_type    [no children]
    DW_AT_byte_size    DW_FORM_data1
    DW_AT_encoding     DW_FORM_data1
    DW_AT_name         DW_FORM_strp

The section .debug_info contains:

  Compilation Unit @ offset 0x0:
   Length:        0x82 (32-bit)
   Version:       2
   Abbrev Offset: 0
   Pointer Size:  4
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    < c>   DW_AT_producer    : (indirect string, offset: 0x17): GNU C 4.3.2
    <10>   DW_AT_language    : 1        (ANSI C)
    <11>   DW_AT_name        : (indirect string, offset: 0x31): foo.c
    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0):
/home/products/tmp/gcc
    <19>   DW_AT_low_pc      : 0x0
    <1d>   DW_AT_high_pc     : 0x34
    <21>   DW_AT_stmt_list   : 0x0
 <1><25>: Abbrev Number: 2 (DW_TAG_subprogram)
    <26>   DW_AT_external    : 1
    <27>   DW_AT_name        : foo
    <2b>   DW_AT_decl_file   : 1
    <2c>   DW_AT_decl_line   : 2
    <2d>   DW_AT_prototyped  : 1
    <2e>   DW_AT_type        : <0x77>
    <32>   DW_AT_low_pc      : 0x0
    <36>   DW_AT_high_pc     : 0x34
    <3a>   DW_AT_frame_base  : 0x0      (location list)
    <3e>   DW_AT_sibling     : <0x77>
 <2><42>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <43>   DW_AT_name        : p1
    <46>   DW_AT_decl_file   : 1
    <47>   DW_AT_decl_line   : 1
    <48>   DW_AT_type        : <0x77>
    <4c>   DW_AT_location    : 2 byte block: 91 6c      (DW_OP_fbreg: -20)
 <2><4f>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <50>   DW_AT_name        : p2
    <53>   DW_AT_decl_file   : 1
    <54>   DW_AT_decl_line   : 1
    <55>   DW_AT_type        : <0x77>
    <59>   DW_AT_location    : 2 byte block: 91 68      (DW_OP_fbreg: -24)
 <2><5c>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <5d>   DW_AT_name        : p3
    <60>   DW_AT_decl_file   : 1
    <61>   DW_AT_decl_line   : 1
    <62>   DW_AT_type        : <0x77>
    <66>   DW_AT_location    : 2 byte block: 91 64      (DW_OP_fbreg: -28)
 <2><69>: Abbrev Number: 3 (DW_TAG_formal_parameter)
    <6a>   DW_AT_name        : p4
    <6d>   DW_AT_decl_file   : 1
    <6e>   DW_AT_decl_line   : 1
    <6f>   DW_AT_type        : <0x7e>
    <73>   DW_AT_location    : 2 byte block: 91 0       (DW_OP_fbreg: 0)
 <1><77>: Abbrev Number: 4 (DW_TAG_base_type)
    <78>   DW_AT_byte_size   : 4
    <79>   DW_AT_encoding    : 5        (signed)
    <7a>   DW_AT_name        : int
 <1><7e>: Abbrev Number: 5 (DW_TAG_base_type)
    <7f>   DW_AT_byte_size   : 8
    <80>   DW_AT_encoding    : 5        (signed)
    <81>   DW_AT_name        : (indirect string, offset: 0x23): long long int
The section .debug_frame contains:

00000000 0000000c ffffffff CIE
  Version:               1
  Augmentation:          ""
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 14

  DW_CFA_def_cfa: r13 ofs 0

00000010 0000001c 00000000 FDE cie=00000000 pc=00000000..00000034
  DW_CFA_advance_loc: 4 to 00000004
  DW_CFA_def_cfa_register: r12
  DW_CFA_advance_loc: 8 to 0000000c
  DW_CFA_offset: r14 at cfa-12
  DW_CFA_offset: r13 at cfa-16
  DW_CFA_offset: r11 at cfa-20
  DW_CFA_advance_loc: 4 to 00000010
  DW_CFA_def_cfa: r11 ofs 8
  DW_CFA_nop
  DW_CFA_nop

Contents of the .debug_loc section:

    Offset   Begin    End      Expression
    00000000 00000000 00000004 (DW_OP_reg13)
    00000000 00000004 00000010 (DW_OP_reg12)
    00000000 00000010 00000034 (DW_OP_breg11: 8)
    00000000 <End of list>

Contents of the .debug_pubnames section:

  Length:                              22
  Version:                             2
  Offset into .debug_info section:     0x0
  Size of area in .debug_info section: 134

    Offset      Name
    37                  foo

The section .debug_aranges contains:

  Length:                   28
  Version:                  2
  Offset into .debug_info:  0x0
  Pointer Size:             4
  Segment Size:             0

    Address    Length
00000000 00000034
00000000 00000000

Contents of the .debug_str section:

  0x00000000 2f686f6d 652f7072 6f647563 74732f74 /home/products/t
  0x00000010 6d702f67 63630047 4e552043 20342e33 mp/gcc.GNU C 4.3
  0x00000020 2e32006c 6f6e6720 6c6f6e67 20696e74 .2.long long int
  0x00000030 00666f6f 2e6300                     .foo.c.


Arguments p1, p2, p3 and p4 are stored at fp-16, fp-20, fp-24 and fp+4
respectively however the debug information states that they are located at
fp+8-20, fp+8-24, fp+8-28 and fp+8-0.


-- 
           Summary: Incorrect dwarf generated for function with parameters
                    greater 4 words in length
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: je at rowley dot co dot uk
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-unknown-elf


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


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