[LLVMbugs] [Bug 13160] New: Seg fault during ObjC ARC contraction of ObjC++ code with O1 optimizations enabled for iphoneos target

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 20 16:02:50 PDT 2012


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

             Bug #: 13160
           Summary: Seg fault during ObjC ARC contraction of ObjC++ code
                    with O1 optimizations enabled for iphoneos target
           Product: clang
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jimmyhutson at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8735
  --> http://llvm.org/bugs/attachment.cgi?id=8735
source file, preprocessed source, run script

// main.m 
#include <Foundation/Foundation.h>

void doTest(NSString* stringOne)
{
    NSString* stringOnePrime = [NSString stringWithString:stringOne];    
    NSLog(@"%@", stringOnePrime); 
}

int main(int argc, char *argv[])
{
    @autoreleasepool {
        return 0;
    }
}

Compiling this file with the following options results in a segmentation fault
11:
clang -x objective-c++ -arch armv7 -O1 -v -fobjc-arc -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-c main.m -o main.o

This does not repro if you change any of: language (to ObjC), arch (to i386
with sdk path change), or disable optimizations.

This also does not repro with the version of clang shipped with XCode 4.3.2.

clang version 3.1 (tags/RELEASE_31/final)
Target: arm-apple-darwin11.4.0
Thread model: posix
 "/Users/jimmyhutson/llvm31/bin/clang" -cc1 -triple thumbv7-apple-ios5.1.0
-emit-obj -disable-free -disable-llvm-verifier -main-file-name main.m
-pic-level 2 -mdisable-fp-elim -masm-verbose -target-abi apcs-gnu -target-cpu
cortex-a8 -mfloat-abi soft -target-feature +soft-float-abi
-target-linker-version 123.2.1 -v -coverage-file main.o -resource-dir
/Users/jimmyhutson/llvm31/bin/../lib/clang/3.1 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-fmodule-cache-path
/var/folders/3v/kc7_ldk520nfws84rcdnn2680000gq/T/clang-module-cache -O1
-fdeprecated-macro -fdebug-compilation-dir
/Users/jimmyhutson/projects/segfaultrepro -ferror-limit 19 -fmessage-length 119
-stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-runtime-has-terminate
-fobjc-default-synthesize-properties -fobjc-arc -fobjc-arc-cxxlib=libstdc++
-fobjc-arc-exceptions -fobjc-exceptions -fcxx-exceptions -fexceptions
-fsjlj-exceptions -fdiagnostics-show-option -fcolor-diagnostics -o main.o -x
objective-c++ main.m
clang -cc1 version 3.1 based upon LLVM 3.1 default target
x86_64-apple-darwin11.4.0
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1/arm-apple-darwin10/v7"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1/arm-apple-darwin10/v6"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/local/include"
ignoring nonexistent directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/Library/Frameworks"
ignoring duplicate directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1"
ignoring duplicate directory
"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1/backward"
#include "..." search starts here:
#include <...> search starts here:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include/c++/4.2.1/backward
 /Users/jimmyhutson/llvm31/bin/../lib/clang/3.1/include

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/usr/include

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks
(framework directory)
End of search list.
0  clang             0x000000010b8574c2
llvm::SmallVectorImpl<char>::swap(llvm::SmallVectorImpl<char>&) + 13298
1  clang             0x000000010b857964
llvm::SmallVectorImpl<char>::swap(llvm::SmallVectorImpl<char>&) + 14484
2  libsystem_c.dylib 0x00007fff91eaccfa _sigtramp + 26
3  libsystem_c.dylib 0x00007fff91e744d6 tiny_malloc_from_free_list + 475
4  clang             0x000000010b7ff1f0 std::vector<llvm::StructType*,
std::allocator<llvm::StructType*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::StructType**,
std::vector<llvm::StructType*, std::allocator<llvm::StructType*> > >,
llvm::StructType* const&) + 24816
5  clang             0x000000010b7ff43b std::vector<llvm::StructType*,
std::allocator<llvm::StructType*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::StructType**,
std::vector<llvm::StructType*, std::allocator<llvm::StructType*> > >,
llvm::StructType* const&) + 25403
6  clang             0x000000010b7ff5db std::vector<llvm::StructType*,
std::allocator<llvm::StructType*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::StructType**,
std::vector<llvm::StructType*, std::allocator<llvm::StructType*> > >,
llvm::StructType* const&) + 25819
7  clang             0x000000010b7ffcf5 std::vector<llvm::StructType*,
std::allocator<llvm::StructType*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::StructType**,
std::vector<llvm::StructType*, std::allocator<llvm::StructType*> > >,
llvm::StructType* const&) + 27637
8  clang             0x000000010b7ffe5d std::vector<llvm::StructType*,
std::allocator<llvm::StructType*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<llvm::StructType**,
std::vector<llvm::StructType*, std::allocator<llvm::StructType*> > >,
llvm::StructType* const&) + 27997
9  clang             0x000000010a6925ee
std::vector<clang::serialization::ModuleFile*,
std::allocator<clang::serialization::ModuleFile*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<clang::serialization::ModuleFile**,
std::vector<clang::serialization::ModuleFile*,
std::allocator<clang::serialization::ModuleFile*> > >,
clang::serialization::ModuleFile* const&) + 6542
10 clang             0x000000010a7692ba llvm::ParseIR(llvm::MemoryBuffer*,
llvm::SMDiagnostic&, llvm::LLVMContext&) + 1818
11 clang             0x000000010a797c96 std::vector<std::pair<llvm::Constant*,
int>, std::allocator<std::pair<llvm::Constant*, int> >
>::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<llvm::Constant*, int>*,
std::vector<std::pair<llvm::Constant*, int>,
std::allocator<std::pair<llvm::Constant*, int> > > >,
std::pair<llvm::Constant*, int> const&) + 83238
12 clang             0x000000010a7680cd std::vector<clang::CXXRecordDecl
const*, std::allocator<clang::CXXRecordDecl const*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<clang::CXXRecordDecl const**,
std::vector<clang::CXXRecordDecl const*, std::allocator<clang::CXXRecordDecl
const*> > >, clang::CXXRecordDecl const* const&) + 4925
13 clang             0x000000010a56fce2 std::vector<clang::CompilerInstance*,
std::allocator<clang::CompilerInstance*>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<clang::CompilerInstance**,
std::vector<clang::CompilerInstance*, std::allocator<clang::CompilerInstance*>
> >, clang::CompilerInstance* const&) + 14626
14 clang             0x000000010a558d73 std::_Rb_tree<std::string, std::string,
std::_Identity<std::string>, std::less<std::string>,
std::allocator<std::string> >::_M_insert_unique(std::string const&) + 3891
15 clang             0x000000010a54f1f4
16 clang             0x000000010a5559e7 std::vector<std::string,
std::allocator<std::string>
>::_M_insert_aux(__gnu_cxx::__normal_iterator<std::string*,
std::vector<std::string, std::allocator<std::string> > >, std::string const&) +
3639
17 clang             0x000000010a54ef34
Stack dump:
0.    Program arguments: /Users/jimmyhutson/llvm31/bin/clang -cc1 -triple
thumbv7-apple-ios5.1.0 -emit-obj -disable-free -disable-llvm-verifier
-main-file-name main.m -pic-level 2 -mdisable-fp-elim -masm-verbose -target-abi
apcs-gnu -target-cpu cortex-a8 -mfloat-abi soft -target-feature +soft-float-abi
-target-linker-version 123.2.1 -v -coverage-file main.o -resource-dir
/Users/jimmyhutson/llvm31/bin/../lib/clang/3.1 -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk
-fmodule-cache-path
/var/folders/3v/kc7_ldk520nfws84rcdnn2680000gq/T/clang-module-cache -O1
-fdeprecated-macro -fdebug-compilation-dir
/Users/jimmyhutson/projects/segfaultrepro -ferror-limit 19 -fmessage-length 119
-stack-protector 1 -mstackrealign -fblocks -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-runtime-has-terminate
-fobjc-default-synthesize-properties -fobjc-arc -fobjc-arc-cxxlib=libstdc++
-fobjc-arc-exceptions -fobjc-exceptions -fcxx-exceptions -fexceptions
-fsjlj-exceptions -fdiagnostics-show-option -fcolor-diagnostics -o main.o -x
objective-c++ main.m 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'main.m'.
4.    Running pass 'ObjC ARC contraction' on function '@_Z6doTestP8NSString'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg:
/var/folders/3v/kc7_ldk520nfws84rcdnn2680000gq/T/main-cbdy7m.mii
clang: note: diagnostic msg:
/var/folders/3v/kc7_ldk520nfws84rcdnn2680000gq/T/main-cbdy7m.sh

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