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++/49260] cpp0x/lambda/lambda-eh2.C fails execution


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

Rainer Orth <ro at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ro at gcc dot gnu.org

--- Comment #3 from Rainer Orth <ro at gcc dot gnu.org> 2011-06-06 10:08:47 UTC ---
I'm seeing this when using Sun as on Solaris, but not with GNU as 2.21, even
when Sun ld is used in both cases.  I've been able to find the root cause: I
set
a breakpoint in _Unwind_IteratePhdrCallback and checked the pc checked there
on i386-pc-solaris2.11.  For the as/ld combination, I get

   0xfee350d5 <_Unwind_RaiseException+52>:    decl   -0x1577b(%ebp)
   0xfef29500 <__cxa_throw+96>:    decl   0x23e82434(%ecx)
   0x8051019 <operator()+47>:    incl   0x874fffa(%ebx)
   0xfef29500 <__cxa_throw+96>:    decl   0x23e82434(%ecx)
   0x8051019 <operator()+47>:    incl   0x874fffa(%ebx)
   0xfee350d5 <_Unwind_RaiseException+52>:    decl   -0x1577b(%ebp)
   0xfef29500 <__cxa_throw+96>:    decl   0x23e82434(%ecx)
   0x8050fcb <operator()+47>:    call   *-0x75(%ebp)
   0x8050fdd <_FUN+17>:    dec    %ecx

then

terminate called after throwing an instance of 'int'

Obviously, the unwind info for _FUNC is missing.  Here's the disassembly

   0x8050fcc <_FUN>:    push   %ebp
   0x8050fcd <_FUN+1>:    mov    %esp,%ebp
   0x8050fcf <_FUN+3>:    sub    $0x18,%esp
   0x8050fd2 <_FUN+6>:    movl   $0x0,(%esp)
   0x8050fd9 <_FUN+13>:    call   0x8050f9c <operator()>
   0x8050fde <_FUN+18>:    leave  
   0x8050fdf <_FUN+19>:    ret    

Looking at the search table, I find:

> elfdump -u lambda-eh2.exe
[...]
  Binary Search Table:
      InitialLoc    FdeLoc
    0x08050f9c    0x08061328    _ZZ4mainENKUlvE_clEv
                      main::{lambda()#1}::operator()() const
    0x08050fea    0x08061350    _ZZ4mainENKUlvE0_clEv
                      main::{lambda()#2}::operator()() const
    0x0805102f    0x08061378    main

i.e. the address above is really missing.  With gas instead, I find

  Binary Search Table:
      InitialLoc    FdeLoc
    0x08050fac    0x0806130c    _ZZ4mainENKUlvE_clEv
                      main::{lambda()#1}::operator()() const
    0x08050fdc    0x08061328    _ZZ4mainENUlvE_4_FUNEv
                      main::{lambda()#1}::_FUN()
    0x08050ff0    0x08061348    _ZZ4mainENKUlvE_cvPFvvEEv
                      main::{lambda()#1}::operator void (*)()() const
    0x08050ffa    0x08061388    _ZZ4mainENKUlvE0_clEv
                      main::{lambda()#2}::operator()() const
    0x0805103f    0x080613a8    main


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