[LLVMbugs] [Bug 12580] New: Stack appears to become exhausted in recursive-member-access.c

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 17 14:00:59 PDT 2012


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

             Bug #: 12580
           Summary: Stack appears to become exhausted in
                    recursive-member-access.c
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: johnw at boostpro.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I ran across this problem while maintaining a fork of Clang, and it surprised 
me.  This problem is that the stack seems to become exhausted rather quickly in 
a c-index-test test.  To reproduce in current trunk, do this:

Edit test/Index/recursive-member-access.c and add several more instances of 
"->this" in the function that you see there.  I only had to add six more to 
reproduce this against trunk.

Run: c-index-test -test-load-source all 
.../tools/clang/test/Index/recursive-member-access.c

I'm seeing this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x0000000103015ff8
0x0000000100cc6d57 in getLocStartImpl (stmt=0x10405a330, v={ptr = 4308348752, 
ptr = 0}) at .../tools/clang/lib/AST/Stmt.cpp:201

The function in question is:

Dump of assembler code for function getLocStartImpl:
0x0000000100cc6d30 <getLocStartImpl+0>:    push   %rbp
0x0000000100cc6d31 <getLocStartImpl+1>:    mov    %rsp,%rbp
0x0000000100cc6d34 <getLocStartImpl+4>:    sub    $0x40,%rsp
0x0000000100cc6d38 <getLocStartImpl+8>:    mov    %rdi,-0x10(%rbp)
0x0000000100cc6d3c <getLocStartImpl+12>:    mov    %rsi,-0x20(%rbp)
0x0000000100cc6d40 <getLocStartImpl+16>:    mov    %rdx,-0x18(%rbp)
0x0000000100cc6d44 <getLocStartImpl+20>:    mov    -0x20(%rbp),%rsi
0x0000000100cc6d48 <getLocStartImpl+24>:    mov    %rdx,-0x28(%rbp)
0x0000000100cc6d4c <getLocStartImpl+28>:    mov    %rsi,-0x30(%rbp)
0x0000000100cc6d50 <getLocStartImpl+32>:    mov    -0x10(%rbp),%rdx
0x0000000100cc6d54 <getLocStartImpl+36>:    mov    %rdx,%rdi
0x0000000100cc6d57 <getLocStartImpl+39>:    callq  0x100cd0890 
<_ZNK5clang9ParenExpr14getSourceRangeEv>

My PC is current at 0x0000000100cc6d57 at the time of the EXC_BAD_ACCESS, and 
my SP is 0x0000000103016000.  So, the fact that it's trying to access (SP - 
sizeof(void*)) (presumably, to write the return pointer before making the 
call), leads me to believe that I'm now out of stack.  However, setting "ulimit 
-s unlimited" had no effect; though I'm not sure that even does anything in OS 
X anymore.

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



More information about the llvm-bugs mailing list