Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 317004

Summary: [c-parser] Stack overflow errors when indexing
Product: [Tools] CDT Reporter: Tom Care <tom.care>
Component: cdt-parserAssignee: Markus Schorn <mschorn.eclipse>
Status: RESOLVED FIXED QA Contact: Mike Kucera <mikekucera>
Severity: normal    
Priority: P3 CC: tom.care
Version: 7.0   
Target Milestone: 7.0.1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Clang's stddef.h that is listed in a stack overflow error
none
testcase + fix mschorn.eclipse: iplog-

Description Tom Care CLA 2010-06-16 02:38:12 EDT
Build Identifier: 20100610-0636

I'm currently using the CDT to do development on LLVM and clang. The source tree is quite large (the indexer reports 3782 files). On two different machines running OSX, both encounter frequent stack overflows on the initial indexing.

The stack overflow happens on the same files each time.

Eclipse seems to continue to work as normal if I ignore the errors, and once the initial indexing is done, I do not encounter the errors any more. I have not tried to open a project with these files individually.

I have tried increasing the heap size and stack size in eclipse.ini to try and solve the problem. As expected, heap size doesn't do anything noticeable (tried up to 2gb), and increasing the stack size reduces the number of errors I receive (tried up to 2mb).

I am currently using a CMake project, however this also occurs if I point eclipse at the LLVM root.

Errors always occur as:
Error while parsing <file>.
java.lang.StackOverflowError

The list of files that cause the error is as follows (from LLVM root):
stddef.h (clang's built-installed version)
(from LLVM root)
tools/clang/test/Analysis/outofbound.c
tools/clang/test/Analysis/stream.c
tools/clang/test/Analysis/undef-buffers.c
tools/clang/test/Sema/format-strings.c

Note that everything in our test directory is for the C compiler testing. There's a lot of code in there designed to throw warnings! This may be whats breaking the code :) I'll attach the stddef.h as I'm not sure why it's breaking.

Reproducible: Always

Steps to Reproduce:
1. svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm && cd llvm/tools && svn co http://llvm.org/svn/llvm-project/cfe/trunk clang
2. Either create a cmake project for the LLVM root, or create a new CDT project pointing at the LLVM root.
3. Allow the indexer to parse the files
Comment 1 Tom Care CLA 2010-06-16 02:40:11 EDT
Created attachment 172017 [details]
Clang's stddef.h that is listed in a stack overflow error
Comment 2 Markus Schorn CLA 2010-06-16 02:54:14 EDT
Thanks, I can reproduce the issue.
Comment 3 Markus Schorn CLA 2010-06-23 06:06:56 EDT
Created attachment 172491 [details]
testcase + fix
Comment 4 Markus Schorn CLA 2010-06-23 06:07:57 EDT
Fixed in 7.0.1 > 20100623.
Comment 5 CDT Genie CLA 2010-06-23 06:23:04 EDT
*** cdt cvs genie on behalf of mschorn ***
Bug 317004: Recursive definition of size_t.

[*] CPPVisitor.java 1.124 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java?root=Tools_Project&r1=1.123&r2=1.124

[*] CVisitor.java 1.147 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java?root=Tools_Project&r1=1.146&r2=1.147

[*] AST2Tests.java 1.262 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java?root=Tools_Project&r1=1.261&r2=1.262

[*] MANIFEST.MF 1.25 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF?root=Tools_Project&r1=1.24&r2=1.25

[*] AST2Tests.java 1.258.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java?root=Tools_Project&r1=1.258.2.1&r2=1.258.2.2

[*] MANIFEST.MF 1.24.6.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core.tests/META-INF/MANIFEST.MF?root=Tools_Project&r1=1.24&r2=1.24.6.1

[*] CPPVisitor.java 1.122.2.2 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java?root=Tools_Project&r1=1.122.2.1&r2=1.122.2.2

[*] CVisitor.java 1.146.2.1 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java?root=Tools_Project&r1=1.146&r2=1.146.2.1