Description
Seeing an UBSAN failure on Ubuntu 14.04 with clang 3.6.0:
$ ./build/latest/schema-test [==========] Running 12 tests from 2 test cases. [----------] Global test environment set-up. [----------] 11 tests from TestSchema [ RUN ] TestSchema.TestSchema /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:739:16: runtime error: reference binding to null pointer of type 'const kudu::ColumnSchema' SUMMARY: AddressSanitizer: undefined-behavior /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:739 mpercy@mpercy-ThinkPad-T530:~/src/kudu$ clang++ --version clang version 3.6.0 (tags/RELEASE_360/final) Target: x86_64-unknown-linux-gnu Thread model: posix $ /usr/bin/gdb --args ./build/latest/schema-test --gtest_break_on_failure (gdb) b __ubsan::Diag::~Diag Breakpoint 1 at 0x524bb1: file /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_diag.cc, line 319. (gdb) r Starting program: /home/mpercy/src/kudu/build/fastdebug/schema-test --gtest_break_on_failure [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". [New Thread 0x7ffff2642880 (LWP 1120)] [==========] Running 12 tests from 2 test cases. [----------] Global test environment set-up. [----------] 11 tests from TestSchema [ RUN ] TestSchema.TestSchema Breakpoint 1, ~Diag () at /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_diag.cc:319 319 /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_diag.cc: No such file or directory. (gdb) bt #0 ~Diag () at /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_diag.cc:319 #1 0x0000000000525f71 in handleTypeMismatchImpl () at /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_handlers.cc:64 #2 0x000000000052600d in __ubsan_handle_type_mismatch_abort () at /home/development/llvm/3.6.0/final/llvm.src/projects/compiler-rt/lib/ubsan/ubsan_handlers.cc:75 #3 0x00007ffff7b7b7cc in __gnu_cxx::__normal_iterator<kudu::ColumnSchema const*, std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> > >::operator* (this=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:739 #4 0x00007ffff7b7b6fe in std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> >::front (this=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:848 #5 0x00007ffff7b757a2 in std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> >::data (this=0x7fffffffcc00) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:887 #6 0x00007ffff7b6f3c3 in kudu::Schema::memory_footprint_excluding_this (this=0x7fffffffcc00) at src/kudu/common/schema.cc:337 #7 0x000000000052a33d in kudu::tablet::TestSchema_TestSchema_Test::TestBody (this=<optimized out>) at src/kudu/common/schema-test.cc:48 #8 0x00007ffff6283219 in HandleSehExceptionsInMethodIfSupported<testing::Test, void> (location=0x7ffff6298d4c "the test body", method=<optimized out>, object=<optimized out>) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2078 #9 testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0x60200000a690, method=<optimized out>, location=location@entry=0x7ffff6298d4c "the test body") at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2114 #10 0x00007ffff6274cff in testing::Test::Run (this=this@entry=0x60200000a690) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2151 #11 0x00007ffff6274dbd in testing::TestInfo::Run (this=0x60f00000ee60) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2326 #12 0x00007ffff6274ed5 in testing::TestCase::Run (this=0x6110000098c0) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2444 #13 0x00007ffff6275188 in testing::internal::UnitTestImpl::RunAllTests (this=0x61500000fa80) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:4315 #14 0x00007ffff6275429 in HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (location=<optimized out>, method=<optimized out>, object=<optimized out>) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2078 #15 HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (location=0x7ffff629a650 "auxiliary test code (environments or event listeners)", method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x7ffff6274f40 <testing::internal::UnitTestImpl::RunAllTests()>, object=0x61500000fa80) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:2114 #16 testing::UnitTest::Run (this=<optimized out>) at /home/mpercy/src/kudu/thirdparty/gmock-1.7.0/gtest/src/gtest.cc:3929 #17 0x00007ffff7fef508 in main (argc=<optimized out>, argv=<optimized out>) at src/kudu/util/test_main.cc:37 #18 0x00007ffff5051ec5 in __libc_start_main (main=0x47c560 <main@plt>, argc=2, argv=0x7fffffffdb18, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdb08) at libc-start.c:287 #19 0x000000000047d5be in _start () (gdb) f 5 #5 0x00007ffff7b757a2 in std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> >::data (this=0x7fffffffcc00) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:887 887 { return std::__addressof(front()); } (gdb) list 883 #else 884 const_pointer 885 #endif 886 data() const _GLIBCXX_NOEXCEPT 887 { return std::__addressof(front()); } (gdb) f 4 #4 0x00007ffff7b7b6fe in std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> >::front (this=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_vector.h:848 848 { return *begin(); } (gdb) list 846 const_reference 847 front() const 848 { return *begin(); } (gdb) f 3 #3 0x00007ffff7b7b7cc in __gnu_cxx::__normal_iterator<kudu::ColumnSchema const*, std::vector<kudu::ColumnSchema, std::allocator<kudu::ColumnSchema> > >::operator* (this=<optimized out>) at /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/stl_iterator.h:739 (gdb) list 736 // Forward iterator requirements 737 reference 738 operator*() const 739 { return *_M_current; } (gdb) p _M_current $1 = (const kudu::ColumnSchema *) 0x0