Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[not-a-bug, powerpc-darwin8] bad_alloc during assembly of RecursiveASTVisitorTest.cpp #15825

Closed Quuxplusone closed 6 years ago

Quuxplusone commented 11 years ago
Bugzilla Link PR15825
Status RESOLVED WONTFIX
Importance P normal
Reported by David Fang (fang@csl.cornell.edu)
Reported on 2013-04-23 00:27:58 -0700
Last modified on 2018-08-20 10:48:02 -0700
Version trunk
Hardware Macintosh MacOS X
CC llvm-bugs@lists.llvm.org, rnk@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also PR31134
This is not a bug, but should be documented.
On powerpc-darwin8, RecursiveASTVisitorTest causes the system assembler to
bad_alloc/out-of-memory.
System compiler is apple-gcc-4.0.1, and assembler is Apple's GNU as 1.38.
This did not occur before r179583, and was first observed r180052.

[ 88%] Building CXX object
tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/RecursiveASTVisitorTest.cpp.o
cd /Users/fang/local/src/LLVM-svn/gcc40-cmake-
build/tools/clang/unittests/Tooling && /Users/fang/local/bin/ccg++   -
DCLANG_ENABLE_ARCMT -DCLANG_ENABLE_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER -
DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -
D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-common -fPIC -fvisibility-
inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wno-missing-
field-initializers -pedantic -Wno-long-long -Wno-uninitialized -Wnon-virtual-
dtor -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -g -
I/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/tools/clang/unittests/Tooling
-I/Users/fang/local/src/LLVM-svn/llvm/tools/clang/unittests/Tooling -
I/Users/fang/local/src/LLVM-svn/llvm/tools/clang/include -
I/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/tools/clang/include -
I/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/include -
I/Users/fang/local/src/LLVM-svn/llvm/include -I/Users/fang/local/src/LLVM-
svn/llvm/utils/unittest/googletest/include    -fno-exceptions  -fno-rtti -Wno-
variadic-macros -o CMakeFiles/ToolingTests.dir/RecursiveASTVisitorTest.cpp.o -c
/Users/fang/local/src/LLVM-svn/llvm/tools/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp
as(20706) malloc: *** vm_allocate(size=2147487744) failed (error code=3)
as(20706) malloc: *** error: can't allocate region
as(20706) malloc: *** set a breakpoint in szone_error to debug
/var/tmp//ccxE0lI4.s:34316:FATAL:virtual memory exceeded
make[3]: ***
[tools/clang/unittests/Tooling/CMakeFiles/ToolingTests.dir/RecursiveASTVisitorTest.cpp.o]
Error 1

This will need to be diagnosed and worked around, I'm afraid.
I cannot resume check-clang without a workaround or fix.
Quuxplusone commented 11 years ago
Interestingly enough, if I copy and rename that translation unit into the build
directory (where I was about to reduce the test case), the failure is no longer
triggered.  Here's a part of the diff between the two .s files:

--- asm-crash.s 2013-04-22 23:04:36.000000000 -0700
+++ RecursiveASTVisitorTest.s   2013-04-22 22:37:14.000000000 -0700
@@ -2,7 +2,7 @@
        .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
        .machine ppc
        .stabs  "/Users/fang/local/src/LLVM-svn/gcc40-cmake-build/tools/clang/unittests/Tooling/",100,0,4,Ltext0
-       .stabs  "asm-crash.cpp",100,0,4,Ltext0
+       .stabs  "/Users/fang/local/src/LLVM-
svn/llvm/tools/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp",100,0,4,
Ltext0
        .text
 Ltext0:
        .stabs  "",102,0,0,0
@@ -414,12 +414,12 @@
        .globl __ZN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_Test10test_info_E
        .const_data
 .zerofill __DATA, __common, __ZN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_Test10test_info_E, 4, 2
-       .globl __ZNSt3tr142_GLOBAL__N_asm_crash.cpp_00000000_E86318056ignoreE
+       .globl
__ZNSt3tr1122_GLOBAL__N__Users_fang_local_src_LLVM_svn_llvm_tools_clang_unittests_Tooling_RecursiveASTVis
itorTest.cpp_00000000_55D24AD66ignoreE
        .data
-.zerofill __DATA, __common,
__ZNSt3tr142_GLOBAL__N_asm_crash.cpp_00000000_E86318056ignoreE, 1, 0
+.zerofill __DATA, __common,
__ZNSt3tr1122_GLOBAL__N__Users_fang_local_src_LLVM_svn_llvm_tools_clang_unittests_Tooling_RecursiveASTVisitorTest.cpp_00000000_55D24AD66ignoreE,
1, 0
        .mod_init_func
        .align 2
-       .long
__GLOBAL__I__ZNSt3tr142_GLOBAL__N_asm_crash.cpp_00000000_E86318056ignoreE
+       .long
__GLOBAL__I__ZNSt3tr1122_GLOBAL__N__Users_fang_local_src_LLVM_svn_llvm_tools_clang_unittests_Tooling_RecursiveASTVisitorTest.cpp_00000000_55D24AD66ignoreE
 .lcomm __ZSt8__ioinit,1,0
        .globl __ZTVN7testing8internal15TestFactoryImplIN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_TestEEE
        .weak_definition __ZTVN7testing8internal15TestFactoryImplIN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_TestEEE
@@ -28672,7 +28672,7 @@
        .private_extern __ZN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_TestC1Ev
 __ZN5clang52RecursiveASTVisitor_VisitsBaseClassDeclarations_TestC1Ev:
        .stabd  46,0,0
-       .stabs  "asm-crash.cpp",132,0,0,Ltext65
+       .stabs  "/Users/fang/local/src/LLVM-
svn/llvm/tools/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp",132,0,0,
Ltext65
 Ltext65:
        .stabd  68,0,109
        mflr r0
@@ -30422,7 +30422,7 @@
        .private_extern __ZN5clang70RecursiveASTVisitor_VisitsCXXBaseSpecifiersOfForwardDeclaredClass_TestC1Ev
 __ZN5clang70RecursiveASTVisitor_VisitsCXXBaseSpecifiersOfForwardDeclaredClass_TestC1Ev:
        .stabd  46,0,0
-       .stabs  "asm-crash.cpp",132,0,0,Ltext69
+       .stabs  "/Users/fang/local/src/LLVM-
svn/llvm/tools/clang/unittests/Tooling/RecursiveASTVisitorTest.cpp",132,0,0,
Ltext69
 Ltext69:
        .stabd  68,0,115
        mflr r0
... lots more ...

Something about these stabs debug directives is triggering the error.

At line 34316 in RecursiveASTVisitorTest.s:
        .stabs  "TestVisitor<clang::ConstructExprVisitor>:t(0,28707)=s8!1,020,(0,28708)=xsRecursiveASTVisitor<clang::ConstructExprVisitor>:;_vptr$TestVisitor:(0,5),0,32;Context:/1(0,159),32,32;__base_ctor ::(0,28709)=#(0,28707),(0,1),(0,28706),(0,28710),(0,1);:_ZN5clang11TestVisitorINS_20ConstructExprVisitorEEC2ERKS2_;2A.;__comp_ctor ::(0,28709):_ZN5clang11TestVisitorINS_20ConstructExprVisitorEEC1ERKS2_;2A.;__base_ctor ::(0,28711)=#(0,28707),(0,1),(0,28706),(0,1);:_ZN5clang11TestVisitorINS_20ConstructExprVisitorEEC2Ev;2A.;__comp_ctor ::(0,28711):_ZN5clang11TestVisitorINS_20ConstructExprVisitorEEC1Ev;2A.;__base_dtor ::(0,28711):_ZN5clang11TestVisitorINS_20ConstructExprVisitorEED2Ev;2A.;__comp_dtor ::(0,28711):_ZN5clang11TestVisitorINS_20ConstructExprVisitorEED1Ev;2A*0;(0,28707);;__deleting_dtor ::(0,28711):_ZN5clang11TestVisitorINS_20ConstructExprVisitorEED0Ev;2A*1;(0,28707);;runOver::(0,28712)=#(0,28707),(0,6),(0,28706),(0,1957),(0,28713)=xeLanguage:,(0,1);:_ZN5clang11TestVisitorINS_20ConstructExprVisitorEE7runOverEN4llvm9StringRefENS2_8LanguageE;2A.;shouldVisitTemplateInstantiations::(0,28714)=#(0,28707),(0,6),(0,28715),(0,1);:_ZNK5clang11TestVisitorINS_20ConstructExprVisitorEE33shouldVisitTemplateInstantiationsEv;2B.;CreateTestAction::(0,28716)=#(0,28707),(0,18675),(0,28706),(0,1);:_ZN5clang11TestVisitorINS_20ConstructExprVisitorEE16CreateTestActionEv;1A*2;(0,28707);;;~%(0,28707);",128,0,0,0

The line that follows is so long that it wraps around my terminal window so
many times, that it still doesn't fit on one screen.  The ask-crash.s produced
by the local copy looks similar in size.
Quuxplusone commented 11 years ago
Anyways, the workarounds (any of the following):

* turn of stabs debugging (remove -g)
* link translation unit from srcdir to builddir, and manually compile the local
builddir link with same options

Not particularly motivated to debug /usr/bin/as.

Other things to try: use newer newer 'as' from opendarwin cctools.
Quuxplusone commented 6 years ago

I don't think we need to track this anymore, essentially it was an OOM while compiling RecursiveASTVisitorTest, which is a very large TU.