[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 12419] New: destructor of scoped object not called when ARM division is tail call op
From:       bugzilla-daemon () llvm ! org
Date:       2012-03-30 13:45:37
Message-ID: bug-12419-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

http://llvm.org/bugs/show_bug.cgi?id=12419

             Bug #: 12419
           Summary: destructor of scoped object not called when ARM
                    division is tail call optimized
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs@nondot.org
        ReportedBy: bohrarper@spotify.com
                CC: llvmbugs@cs.uiuc.edu
    Classification: Unclassified


Created attachment 8297
  --> http://llvm.org/bugs/attachment.cgi?id=8297
Code and disassembly showing bug

int cnt = 0;

class MutexLock {
 public:
  explicit MutexLock() {
    ++cnt;
  }
  ~MutexLock() {
    --cnt;
  }
};

int a = 100;

int test1() {
  MutexLock lock;
  return 1000 / a;
}

In test1, the destructor for MutexLock is not executed.

(gdb) disassemble test1
Dump of assembler code for function _Z5test1v:
0x00002e40 <_Z5test1v+0>:    push    {r7, lr}
0x00002e44 <_Z5test1v+4>:    mov    r7, sp
0x00002e48 <_Z5test1v+8>:    sub    sp, sp, #8    ; 0x8
0x00002e4c <_Z5test1v+12>:    bic    sp, sp, #7    ; 0x7
0x00002e50 <_Z5test1v+16>:    mov    r0, sp
0x00002e54 <_Z5test1v+20>:    bl    0x2fe8 <dyld_stub__ZN9MutexLockC1Ev>
0x00002e58 <_Z5test1v+24>:    ldr    r0, [pc, #16]    ; 0x2e70 <_Z5test1v+48>
0x00002e5c <_Z5test1v+28>:    ldr    r1, [pc, r0]
0x00002e60 <_Z5test1v+32>:    mov    r0, #1000    ; 0x3e8
0x00002e64 <_Z5test1v+36>:    mov    sp, r7
0x00002e68 <_Z5test1v+40>:    pop    {r7, lr}
0x00002e6c <_Z5test1v+44>:    b    0x2ff8 <dyld_stub___divsi3>
0x00002e70 <_Z5test1v+48>:    ldrdeq    r0, [r0], -r8
End of assembler dump.

Compiled with:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
--version
Apple clang version 3.1 (tags/Apple/clang-318.0.54) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.3.0
Thread model: posix

Built like this:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-arch armv6 -O1 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
bug.cpp -o bug

See attachment for complete code and disassembly.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic