public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/29628]  New: [32bit] unused argc/argv missing their DW_AT_location
@ 2006-10-28 20:14 jan dot kratochvil at redhat dot com
  2006-10-28 23:23 ` [Bug debug/29628] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2006-10-28 20:14 UTC (permalink / raw)
  To: gcc-bugs

`main' function (the function with specific prologue/epilogue) is missing DWARF
`DW_AT_location' for its `argc' and `argv' on 32-bit targets - only if these
arguments are never unused.

affected: x86_64-redhat-linux with -m32, i386-redhat-linux
not affected: x86_64-redhat-linux (-m64)

32-bit broken for: gcc-4.1.1, SVN snapshot 4.3.0
always works: gcc-3.4.6

It causes gdb(1) to hide the arguments during backtrace:
#0  main () at test.c:3


correct [i386]:
echo 'int main (int argc, char **argv) { return argc + (int) argv; }' >main.c
;gcc -o main.o main.c -ggdb3;readelf -a --debug main.o|grep -A5 -w argc

incorrect [i386]:
echo 'int main (int argc, char **argv) { return 0; }' >main.c ;gcc -o main.o
main.c -ggdb3;readelf -a --debug main.o|grep -A5 -w argc


correct (gcc-3.4.6):
 <1><ee3>: Abbrev Number: 33 (DW_TAG_subprogram)
     DW_AT_sibling     : <f63>
     DW_AT_external    : 1
     DW_AT_name        : main
     DW_AT_decl_file   : 46
     DW_AT_decl_line   : 267
     DW_AT_prototyped  : 1
     DW_AT_type        : <c4>
     DW_AT_low_pc      : 0x8048c0f
     DW_AT_high_pc     : 0x8048e26
     DW_AT_frame_base  : 616    (location list)
 <2><f02>: Abbrev Number: 34 (DW_TAG_formal_parameter)
     DW_AT_name        : argc
     DW_AT_decl_file   : 46
     DW_AT_decl_line   : 267
     DW_AT_type        : <c4>
     DW_AT_location    : 2 byte block: 91 0     (DW_OP_fbreg: 0)
 <2><f12>: Abbrev Number: 34 (DW_TAG_formal_parameter)
     DW_AT_name        : argv
     DW_AT_decl_file   : 46
     DW_AT_decl_line   : 267
     DW_AT_type        : <f63>
     DW_AT_location    : 2 byte block: 91 4     (DW_OP_fbreg: 4)

incorrect (gcc-4.1.1; appropriately for SVN snapshot - ~4.3.0):
 <1><64>: Abbrev Number: 2 (DW_TAG_subprogram)
     DW_AT_external    : 1
     DW_AT_name        : main
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 2
     DW_AT_prototyped  : 1
     DW_AT_type        : <9b>
     DW_AT_low_pc      : 0x8048324
     DW_AT_high_pc     : 0x804833d
     DW_AT_frame_base  : 0      (location list)
     DW_AT_sibling     : <9b>
 <2><82>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : argc
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 1
     DW_AT_type        : <9b>
 <2><8e>: Abbrev Number: 3 (DW_TAG_formal_parameter)
     DW_AT_name        : argv
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 1
     DW_AT_type        : <a2>



dwarf2.out.c mem_loc_descriptor () GET_CODE (rtl):
`case REG:' for i386 `argc'; it will fail on:
  if (REGNO (rtl) < FIRST_PSEUDO_REGISTER)
Checked there:
        REGNO (rtl) == 61   /* Therefore pseudoreg.  */
        ORIGINAL_REGNO (rtl) == REGNO (rtl)
        reg_renumber [61] == -1

On i386 with the arguments used it is fine as:
        REGNO (rtl) == 1   /* Therefore hard register.  */

On x86_64 it goes the `case PLUS:' way, not `case REG:'.


Could you advice where to find the location information for pseudoregisters
there?


-- 
           Summary: [32bit] unused argc/argv missing their DW_AT_location
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jan dot kratochvil at redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


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

* [Bug debug/29628] unused argc/argv missing their DW_AT_location
  2006-10-28 20:14 [Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location jan dot kratochvil at redhat dot com
@ 2006-10-28 23:23 ` pinskia at gcc dot gnu dot org
  2006-10-30 16:11 ` jakub at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-10-28 23:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|minor                       |normal
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |
            Summary|[32bit] unused argc/argv    |unused argc/argv missing
                   |missing their DW_AT_location|their DW_AT_location


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


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

* [Bug debug/29628] unused argc/argv missing their DW_AT_location
  2006-10-28 20:14 [Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location jan dot kratochvil at redhat dot com
  2006-10-28 23:23 ` [Bug debug/29628] " pinskia at gcc dot gnu dot org
@ 2006-10-30 16:11 ` jakub at gcc dot gnu dot org
  2008-10-13 14:25 ` dodji at gcc dot gnu dot org
  2008-10-13 14:36 ` jan dot kratochvil at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu dot org @ 2006-10-30 16:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jakub at gcc dot gnu dot org  2006-10-30 16:11 -------
This is caused by the stack realignment in i?86 main, the way it is currently
implemented is that address of first argument is loaded into %ecx and
then the stack is realigned.  The pseudo register which shows in the
argument's RTL is that cfun->machine->force_align_arg_pointer (aka %ecx)
copied into a pseudo.


-- 


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


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

* [Bug debug/29628] unused argc/argv missing their DW_AT_location
  2006-10-28 20:14 [Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location jan dot kratochvil at redhat dot com
  2006-10-28 23:23 ` [Bug debug/29628] " pinskia at gcc dot gnu dot org
  2006-10-30 16:11 ` jakub at gcc dot gnu dot org
@ 2008-10-13 14:25 ` dodji at gcc dot gnu dot org
  2008-10-13 14:36 ` jan dot kratochvil at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dodji at gcc dot gnu dot org @ 2008-10-13 14:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dodji at gcc dot gnu dot org  2008-10-13 14:23 -------
Hello,

I can't reproduce this neither on 4.3 nor trunk branch.
In both branch, the variables have the DW_AT_location attribute.
Please see below the attached dwarf output.


-- 


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


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

* [Bug debug/29628] unused argc/argv missing their DW_AT_location
  2006-10-28 20:14 [Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location jan dot kratochvil at redhat dot com
                   ` (2 preceding siblings ...)
  2008-10-13 14:25 ` dodji at gcc dot gnu dot org
@ 2008-10-13 14:36 ` jan dot kratochvil at redhat dot com
  3 siblings, 0 replies; 5+ messages in thread
From: jan dot kratochvil at redhat dot com @ 2008-10-13 14:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jan dot kratochvil at redhat dot com  2008-10-13 14:34 -------
Fedora gcc-4.3.2-6.x86_64 with -m32 is still buggy as described in the Comment
0.
But HEAD works OK now (-m32) so closing, thanks for the test:
GNU C (GCC) version 4.4.0 20081007 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.4.0 20081007 (experimental), GMP version
4.2.2, MPFR version 2.3.1.


-- 

jan dot kratochvil at redhat dot com changed:

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


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


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

end of thread, other threads:[~2008-10-13 14:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-28 20:14 [Bug debug/29628] New: [32bit] unused argc/argv missing their DW_AT_location jan dot kratochvil at redhat dot com
2006-10-28 23:23 ` [Bug debug/29628] " pinskia at gcc dot gnu dot org
2006-10-30 16:11 ` jakub at gcc dot gnu dot org
2008-10-13 14:25 ` dodji at gcc dot gnu dot org
2008-10-13 14:36 ` jan dot kratochvil at redhat 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).