[libcxxabi] r256323 - Add new tests for throwing incomplete pointer types

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 19 09:30:37 PST 2016


Nico pointed out his revert should probably be merged to 3.8.

Has there been any follow-up here, e.g. fixes, that I should be aware of?

Thanks,
Hans

On Fri, Jan 15, 2016 at 7:48 AM, Nico Weber via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> I reverted this and 322 for now in 257896.
>
> On Fri, Jan 15, 2016 at 10:36 AM, Nico Weber <thakis at chromium.org> wrote:
>>
>> This test fails on OS X for me:
>>
>>
>> Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
>> FAIL: libc++abi :: incomplete_type.sh.cpp (29529 of 29545)
>> ******************** TEST 'libc++abi :: incomplete_type.sh.cpp' FAILED
>> ********************
>> Script:
>> --
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
>> -v -DLIBCXXABI_NO_TIMER -funwind-tables -std=c++1z -nostdinc++
>> -I/Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include
>> -I/Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>> -isysroot
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
>> -c
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/test/incomplete_type.sh.cpp
>> -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.one.o
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
>> -v -DLIBCXXABI_NO_TIMER -funwind-tables -std=c++1z -nostdinc++
>> -I/Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include
>> -I/Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>> -isysroot
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
>> -c
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/test/incomplete_type.sh.cpp
>> -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.two.o
>> -DTU_ONE
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
>> -v -nodefaultlibs
>> -L/Users/thakis/src/chrome/src/third_party/llvm-bootstrap/lib
>> -Wl,-rpath,/Users/thakis/src/chrome/src/third_party/llvm-bootstrap/lib -lc++
>> -lc++abi -lSystem -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.exe
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.one.o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.two.o
>>
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.exe
>> --
>> Exit Code: 134
>>
>> Command Output (stderr):
>> --
>> Apple LLVM version 7.0.0 (clang-700.1.76)
>> Target: x86_64-apple-darwin15.0.0
>> Thread model: posix
>>
>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
>> -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage
>> -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free
>> -disable-llvm-verifier -main-file-name incomplete_type.sh.cpp
>> -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
>> -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.6
>> -v -dwarf-column-info -coverage-file
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.one.o
>> -nostdinc++ -resource-dir
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0
>> -isysroot
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
>> -D LIBCXXABI_NO_TIMER -I
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include -I
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>> -stdlib=libc++ -std=c++1z -fdeprecated-macro -fdebug-compilation-dir
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test
>> -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign
>> -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature
>> -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
>> -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.one.o
>> -x c++
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/test/incomplete_type.sh.cpp
>> clang -cc1 version 7.0.0 based upon LLVM 3.7.0svn default target
>> x86_64-apple-darwin15.0.0
>> ignoring nonexistent directory
>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local/include"
>> ignoring nonexistent directory
>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Library/Frameworks"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include
>>  /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
>>
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
>>
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks
>> (framework directory)
>> End of search list.
>> Apple LLVM version 7.0.0 (clang-700.1.76)
>> Target: x86_64-apple-darwin15.0.0
>> Thread model: posix
>>
>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
>> -cc1 -triple x86_64-apple-macosx10.11.0 -Wdeprecated-objc-isa-usage
>> -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free
>> -disable-llvm-verifier -main-file-name incomplete_type.sh.cpp
>> -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
>> -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.6
>> -v -dwarf-column-info -coverage-file
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.two.o
>> -nostdinc++ -resource-dir
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0
>> -isysroot
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk
>> -D LIBCXXABI_NO_TIMER -D TU_ONE -I
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include -I
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>> -stdlib=libc++ -std=c++1z -fdeprecated-macro -fdebug-compilation-dir
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test
>> -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -mstackrealign
>> -fblocks -fobjc-runtime=macosx-10.11.0 -fencode-extended-block-signature
>> -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option
>> -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.two.o
>> -x c++
>> /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/test/incomplete_type.sh.cpp
>> clang -cc1 version 7.0.0 based upon LLVM 3.7.0svn default target
>> x86_64-apple-darwin15.0.0
>> ignoring nonexistent directory
>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/local/include"
>> ignoring nonexistent directory
>> "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/Library/Frameworks"
>> #include "..." search starts here:
>> #include <...> search starts here:
>>  /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxx/include
>>  /Users/thakis/src/chrome/src/third_party/llvm/projects/libcxxabi/include
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include
>>
>> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
>>
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include
>>
>> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks
>> (framework directory)
>> End of search list.
>> Apple LLVM version 7.0.0 (clang-700.1.76)
>> Target: x86_64-apple-darwin15.0.0
>> Thread model: posix
>>
>> "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
>> -demangle -dynamic -arch x86_64 -macosx_version_min 10.11.0 -o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.exe
>> -L/Users/thakis/src/chrome/src/third_party/llvm-bootstrap/lib -rpath
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/lib -lc++ -lc++abi
>> -lSystem
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.one.o
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.two.o
>> libc++abi.dylib: terminating with uncaught exception of type int
>> NeverDefined::*
>>
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.script:
>> line 4: 58282 Abort trap: 6
>> /Users/thakis/src/chrome/src/third_party/llvm-bootstrap/projects/libcxxabi/test/Output/incomplete_type.sh.cpp.tmp.exe
>>
>> --
>>
>> On Wed, Dec 23, 2015 at 2:04 AM, Eric Fiselier via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>>>
>>> Author: ericwf
>>> Date: Wed Dec 23 01:04:32 2015
>>> New Revision: 256323
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=256323&view=rev
>>> Log:
>>> Add new tests for throwing incomplete pointer types
>>>
>>> Modified:
>>>     libcxxabi/trunk/test/incomplete_type.sh.cpp
>>>
>>> Modified: libcxxabi/trunk/test/incomplete_type.sh.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/incomplete_type.sh.cpp?rev=256323&r1=256322&r2=256323&view=diff
>>>
>>> ==============================================================================
>>> --- libcxxabi/trunk/test/incomplete_type.sh.cpp (original)
>>> +++ libcxxabi/trunk/test/incomplete_type.sh.cpp Wed Dec 23 01:04:32 2015
>>> @@ -14,9 +14,9 @@
>>>  // incomplete flags set, equality can be tested by comparing the
>>> type_info
>>>  // addresses.
>>>
>>> -// RUN: %cxx %compile_flags -c %s -o %t.one.o
>>> -// RUN: %cxx %compile_flags -c %s -o %t.two.o -DTU_ONE
>>> -// RUN: %cxx %link_flags -o %t.exe %t.one.o %t.two.o
>>> +// RUN: %cxx %flags %compile_flags -c %s -o %t.one.o
>>> +// RUN: %cxx %flags %compile_flags -c %s -o %t.two.o -DTU_ONE
>>> +// RUN: %cxx %flags %link_flags -o %t.exe %t.one.o %t.two.o
>>>  // RUN: %t.exe
>>>
>>>  #include <stdio.h>
>>> @@ -24,28 +24,42 @@
>>>  #include <typeinfo>
>>>
>>>  struct NeverDefined;
>>> -void ThrowNeverDefined();
>>> +void ThrowNeverDefinedMP();
>>>
>>>  struct IncompleteAtThrow;
>>> -void ThrowIncomplete();
>>> -std::type_info const& ReturnTypeInfoIncomplete();
>>> +void ThrowIncompleteMP();
>>> +void ThrowIncompletePP();
>>> +void ThrowIncompletePMP();
>>> +std::type_info const& ReturnTypeInfoIncompleteMP();
>>> +std::type_info const& ReturnTypeInfoIncompletePP();
>>>
>>>  struct CompleteAtThrow;
>>> -void ThrowComplete();
>>> -std::type_info const& ReturnTypeInfoComplete();
>>> +void ThrowCompleteMP();
>>> +void ThrowCompletePP();
>>> +void ThrowCompletePMP();
>>> +std::type_info const& ReturnTypeInfoCompleteMP();
>>> +std::type_info const& ReturnTypeInfoCompletePP();
>>>
>>>  void ThrowNullptr();
>>>
>>>  #ifndef TU_ONE
>>>
>>> -void ThrowNeverDefined() { throw (int NeverDefined::*)nullptr; }
>>> +void ThrowNeverDefinedMP() { throw (int NeverDefined::*)nullptr; }
>>>
>>> -void ThrowIncomplete() { throw (int IncompleteAtThrow::*)nullptr; }
>>> -std::type_info const& ReturnTypeInfoIncomplete() { return typeid(int
>>> IncompleteAtThrow::*); }
>>> +void ThrowIncompleteMP() { throw (int IncompleteAtThrow::*)nullptr; }
>>> +void ThrowIncompletePP() { throw (IncompleteAtThrow**)nullptr; }
>>> +void ThrowIncompletePMP() { throw (int IncompleteAtThrow::**)nullptr; }
>>> +
>>> +std::type_info const& ReturnTypeInfoIncompleteMP() { return typeid(int
>>> IncompleteAtThrow::*); }
>>> +std::type_info const& ReturnTypeInfoIncompletePP() { return
>>> typeid(IncompleteAtThrow**); }
>>>
>>>  struct CompleteAtThrow {};
>>> -void ThrowComplete() { throw (int CompleteAtThrow::*)nullptr; }
>>> -std::type_info const& ReturnTypeInfoComplete() { return typeid(int
>>> CompleteAtThrow::*); }
>>> +void ThrowCompleteMP() { throw (int CompleteAtThrow::*)nullptr; }
>>> +void ThrowCompletePP() { throw (CompleteAtThrow**)nullptr; }
>>> +void ThrowCompletePMP() { throw (int CompleteAtThrow::**)nullptr; }
>>> +
>>> +std::type_info const& ReturnTypeInfoCompleteMP() { return typeid(int
>>> CompleteAtThrow::*); }
>>> +std::type_info const& ReturnTypeInfoCompletePP() { return
>>> typeid(CompleteAtThrow**); }
>>>
>>>  void ThrowNullptr() { throw nullptr; }
>>>
>>> @@ -54,16 +68,81 @@ void ThrowNullptr() { throw nullptr; }
>>>  struct IncompleteAtThrow {};
>>>
>>>  int main() {
>>> -  assert(ReturnTypeInfoIncomplete() != typeid(int
>>> IncompleteAtThrow::*));
>>>    try {
>>> -    ThrowIncomplete();
>>> +    ThrowNeverDefinedMP();
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (int CompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (int NeverDefined::*) {}
>>> +
>>> +  assert(ReturnTypeInfoIncompleteMP() != typeid(int
>>> IncompleteAtThrow::*));
>>> +  try {
>>> +    ThrowIncompleteMP();
>>> +    assert(false);
>>> +  } catch (CompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int CompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {
>>> +    assert(false);
>>>    } catch (int IncompleteAtThrow::*) {}
>>>
>>> -  assert(ReturnTypeInfoComplete() != typeid(int CompleteAtThrow::*));
>>> +  assert(ReturnTypeInfoIncompletePP() != typeid(IncompleteAtThrow**));
>>> +  try {
>>> +    ThrowIncompletePP();
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {}
>>> +
>>>    try {
>>> -    ThrowComplete();
>>> +    ThrowIncompletePMP();
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::**) {}
>>> +
>>> +  assert(ReturnTypeInfoCompleteMP() != typeid(int CompleteAtThrow::*));
>>> +  try {
>>> +    ThrowCompleteMP();
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (CompleteAtThrow**) {
>>> +    assert(false);
>>>    } catch (int CompleteAtThrow::*) {}
>>>
>>> +  assert(ReturnTypeInfoCompletePP() != typeid(CompleteAtThrow**));
>>> +  try {
>>> +    ThrowCompletePP();
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (int CompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (CompleteAtThrow**) {}
>>> +
>>> +  try {
>>> +    ThrowCompletePMP();
>>> +    assert(false);
>>> +  } catch (IncompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int IncompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (int CompleteAtThrow::*) {
>>> +    assert(false);
>>> +  } catch (CompleteAtThrow**) {
>>> +    assert(false);
>>> +  } catch (int CompleteAtThrow::**) {}
>>> +
>>>  #if __cplusplus >= 201103L
>>>    // Catch nullptr as complete type
>>>    try {
>>> @@ -76,7 +155,7 @@ int main() {
>>>    } catch (int CompleteAtThrow::*) {}
>>>    // Catch nullptr as a type that is never complete.
>>>    try {
>>> -    ThrowNeverDefined();
>>> +    ThrowNullptr();
>>>    } catch (int NeverDefined::*) {}
>>>  #endif
>>>  }
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>
>>
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>


More information about the cfe-commits mailing list