public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/26908]  New: -g3 (-ggdb3) emits broken calls to asm-defined functions
@ 2006-03-28 18:29 ed at catmur dot co dot uk
  2006-03-28 18:31 ` [Bug debug/26908] " ed at catmur dot co dot uk
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ed at catmur dot co dot uk @ 2006-03-28 18:29 UTC (permalink / raw)
  To: gcc-bugs

foo.c:
asm (
".globl bar\n\t"
"bar:\n\t"
"movl $5, %eax\n\t"
"ret"
);
main() {
        return bar();
}

$ gcc -g2 foo.c; ./a.out; echo $?
5
$ gcc foo.c -g3; ./a.out; echo $?
Segmentation fault
139

Disassembly of the a.out compiled with -g3 gives:

(gdb) disass main
Dump of assembler code for function main:
0x08048364 <main+0>:    push   %ebp
0x08048365 <main+1>:    mov    %esp,%ebp
0x08048367 <main+3>:    sub    $0x8,%esp
0x0804836a <main+6>:    and    $0xfffffff0,%esp
0x0804836d <main+9>:    mov    $0x0,%eax
0x08048372 <main+14>:   add    $0xf,%eax
0x08048375 <main+17>:   add    $0xf,%eax
0x08048378 <main+20>:   shr    $0x4,%eax
0x0804837b <main+23>:   shl    $0x4,%eax
0x0804837e <main+26>:   sub    %eax,%esp
0x08048380 <main+28>:   call   0x4852
0x08048385 <main+33>:   leave
0x08048386 <main+34>:   ret
End of assembler dump.

Note the call to an invalid location; it is this that causes the segfault.

Seen in the wild in tetex-3.0 (uses asm functions in metafont).

Workaround: don't use -g3.

I will attach gcc -g3 -S foo.c output.


-- 
           Summary: -g3 (-ggdb3) emits broken calls to asm-defined functions
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ed at catmur dot co dot uk
 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=26908


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
@ 2006-03-28 18:31 ` ed at catmur dot co dot uk
  2006-03-28 18:45 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ed at catmur dot co dot uk @ 2006-03-28 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from ed at catmur dot co dot uk  2006-03-28 18:31 -------
Created an attachment (id=11141)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11141&action=view)
foo.s

Output of gcc -g3 -S foo.c


-- 


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
  2006-03-28 18:31 ` [Bug debug/26908] " ed at catmur dot co dot uk
@ 2006-03-28 18:45 ` pinskia at gcc dot gnu dot org
  2006-03-28 19:15 ` ed at catmur dot co dot uk
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-28 18:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-28 18:45 -------
There is no garentee that bar will be in the text section.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
  2006-03-28 18:31 ` [Bug debug/26908] " ed at catmur dot co dot uk
  2006-03-28 18:45 ` pinskia at gcc dot gnu dot org
@ 2006-03-28 19:15 ` ed at catmur dot co dot uk
  2008-11-21  1:29 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ed at catmur dot co dot uk @ 2006-03-28 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ed at catmur dot co dot uk  2006-03-28 19:15 -------
OK, so it's tetex that's broken. Sorry for the invalid report.


-- 


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
                   ` (2 preceding siblings ...)
  2006-03-28 19:15 ` ed at catmur dot co dot uk
@ 2008-11-21  1:29 ` pinskia at gcc dot gnu dot org
  2008-11-21  2:17 ` zuogang at huawei dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-21  1:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2008-11-21 01:27 -------
*** Bug 38186 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zuogang at huawei dot com


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
                   ` (3 preceding siblings ...)
  2008-11-21  1:29 ` pinskia at gcc dot gnu dot org
@ 2008-11-21  2:17 ` zuogang at huawei dot com
  2008-12-28  2:36 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: zuogang at huawei dot com @ 2008-11-21  2:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from zuogang at huawei dot com  2008-11-21 02:15 -------
(In reply to comment #4)
> *** Bug 38186 has been marked as a duplicate of this bug. ***

I post the bug 38186;

I want to know why the asm-defined func is placed in .debug_macinfo section, is
it correct?

info from the obj file generated by option -g3

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf
Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0 
0
  [ 1] .text             PROGBITS        00000000 000034 001b68 00  AX  0   0 
4
...
  [10] .debug_macinfo    PROGBITS        00000000 004567 0a8a53 00      0   0 
1
...
Symbol table '.symtab' contains 64 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
...
     9: 000a8929     0 NOTYPE  LOCAL  DEFAULT   10 MON_OnCallGetIndex
    10: 000a8939     0 NOTYPE  LOCAL  DEFAULT   10 MON_OnRetGetIndex
...


-- 


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
                   ` (4 preceding siblings ...)
  2008-11-21  2:17 ` zuogang at huawei dot com
@ 2008-12-28  2:36 ` pinskia at gcc dot gnu dot org
  2008-12-29 12:29 ` bonzini at gnu dot org
  2008-12-29 12:31 ` bonzini at gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-28  2:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2008-12-28 02:33 -------
*** Bug 33932 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stsp at users dot
                   |                            |sourceforge dot net


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
                   ` (5 preceding siblings ...)
  2008-12-28  2:36 ` pinskia at gcc dot gnu dot org
@ 2008-12-29 12:29 ` bonzini at gnu dot org
  2008-12-29 12:31 ` bonzini at gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gnu dot org @ 2008-12-29 12:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from bonzini at gnu dot org  2008-12-29 12:25 -------
reopening...


-- 

bonzini at gnu dot org changed:

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


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


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

* [Bug debug/26908] -g3 (-ggdb3) emits broken calls to asm-defined functions
  2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
                   ` (6 preceding siblings ...)
  2008-12-29 12:29 ` bonzini at gnu dot org
@ 2008-12-29 12:31 ` bonzini at gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bonzini at gnu dot org @ 2008-12-29 12:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from bonzini at gnu dot org  2008-12-29 12:26 -------
... to close as duplicate (since there's some discussion on the other bug)

*** This bug has been marked as a duplicate of 33932 ***


-- 

bonzini at gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-12-29 12:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-28 18:29 [Bug debug/26908] New: -g3 (-ggdb3) emits broken calls to asm-defined functions ed at catmur dot co dot uk
2006-03-28 18:31 ` [Bug debug/26908] " ed at catmur dot co dot uk
2006-03-28 18:45 ` pinskia at gcc dot gnu dot org
2006-03-28 19:15 ` ed at catmur dot co dot uk
2008-11-21  1:29 ` pinskia at gcc dot gnu dot org
2008-11-21  2:17 ` zuogang at huawei dot com
2008-12-28  2:36 ` pinskia at gcc dot gnu dot org
2008-12-29 12:29 ` bonzini at gnu dot org
2008-12-29 12:31 ` bonzini at gnu dot org

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