Ericsson / clang

Cross Translation Unit analysis capability for Clang Static Analyzer. (Fork of official clang at http://llvm.org/git/clang)
http://clang.llvm.org/
Other
15 stars 10 forks source link

Assertion `0 && "Invalid SLocOffset or bad function choice"' failed. #645

Closed balazske closed 5 years ago

balazske commented 5 years ago

Assertion during analysis of llvm.

ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/Diagnostic.cpp
warning: missing FunctionTemplateDecl in imported DeclContext <CodeCheckerProjects/llvm/git/llvm/include/llvm/Support/ErrorOr.h:100:3>
warning: missing FunctionTemplateDecl in imported DeclContext <CodeCheckerProjects/llvm/git/llvm/include/llvm/Support/ErrorOr.h:120:3>
warning: missing FunctionTemplateDecl in imported DeclContext <CodeCheckerProjects/llvm/git/llvm/include/llvm/Support/Error.h:486:3>
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/lib/Support/ErrorHandling.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/lib/Support/Debug.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/lib/Support/raw_ostream.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/lib/Support/NativeFormatting.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/lib/Support/SmallVector.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/DiagnosticIDs.cpp
ANALYZE (CTU loaded AST for source file): CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64/astCodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/SourceManager.cpp
clang-7: ../../git/llvm/tools/clang/lib/Basic/SourceManager.cpp:809: clang::FileID clang::SourceManager::getFileIDLoaded(unsigned int) const: Assertion `0 && "Invalid SLocOffset or bad function choice"' failed.
Stack dump:
0.  Program arguments: llvm/build/release_assert/bin/clang-7 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -main-file-name ChainedDiagnosticConsumer.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-eagerly-assume -analyzer-output plist -w -mrelocation-model pic -pic-level 2 -mthread-model posix -relaxed-aliasing -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -ffunction-sections -fdata-sections -nobuiltininc -resource-dir llvm/build/release_assert/lib/clang/7.1.0 -isystem llvm/build/release_assert/lib/clang/7.1.0/include -D GTEST_HAS_RTTI=0 -D _DEBUG -D _GNU_SOURCE -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I CodeCheckerProjects/llvm/build/release_assert/tools/clang/lib/Frontend -I CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Frontend -I CodeCheckerProjects/llvm/git/llvm/tools/clang/include -I CodeCheckerProjects/llvm/build/release_assert/tools/clang/include -I /usr/include/libxml2 -I CodeCheckerProjects/llvm/build/release_assert/include -I CodeCheckerProjects/llvm/git/llvm/include -U NDEBUG -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/x86_64-linux-gnu/c++/7.3.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/backward -internal-isystem /usr/local/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-unused-parameter -Wno-missing-field-initializers -Wno-long-long -Wno-maybe-uninitialized -Wno-comment -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir CodeCheckerProjects/llvm/build/release_assert -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -fno-rtti -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -analyzer-opt-analyze-headers -analyzer-output=plist-multi-file -analyzer-config expand-macros=true -analyzer-disable-checker=alpha.clone.CloneChecker -analyzer-disable-checker=alpha.core.BoolAssignment -analyzer-disable-checker=alpha.core.CallAndMessageUnInitRefArg -analyzer-disable-checker=alpha.core.CastSize -analyzer-disable-checker=alpha.core.CastToStruct -analyzer-disable-checker=alpha.core.Conversion -analyzer-disable-checker=alpha.core.DynamicTypeChecker -analyzer-disable-checker=alpha.core.FixedAddr -analyzer-disable-checker=alpha.core.IdenticalExpr -analyzer-disable-checker=alpha.core.PointerArithm -analyzer-disable-checker=alpha.core.PointerSub -analyzer-disable-checker=alpha.core.SizeofPtr -analyzer-disable-checker=alpha.core.StackAddressAsyncEscape -analyzer-disable-checker=alpha.core.TestAfterDivZero -analyzer-checker=alpha.cplusplus.DeleteWithNonVirtualDtor -analyzer-disable-checker=alpha.cplusplus.IteratorRange -analyzer-disable-checker=alpha.cplusplus.MisusedMovedObject -analyzer-disable-checker=alpha.cplusplus.UninitializedObject -analyzer-disable-checker=alpha.deadcode.UnreachableCode -analyzer-disable-checker=alpha.osx.cocoa.DirectIvarAssignment -analyzer-disable-checker=alpha.osx.cocoa.DirectIvarAssignmentForAnnotatedFunctions -analyzer-disable-checker=alpha.osx.cocoa.InstanceVariableInvalidation -analyzer-disable-checker=alpha.osx.cocoa.MissingInvalidationMethod -analyzer-disable-checker=alpha.osx.cocoa.localizability.PluralMisuseChecker -analyzer-disable-checker=alpha.security.ArrayBound -analyzer-disable-checker=alpha.security.ArrayBoundV2 -analyzer-disable-checker=alpha.security.MallocOverflow -analyzer-disable-checker=alpha.security.MmapWriteExec -analyzer-disable-checker=alpha.security.ReturnPtrRange -analyzer-disable-checker=alpha.security.taint.TaintPropagation -analyzer-disable-checker=alpha.unix.BlockInCriticalSection -analyzer-disable-checker=alpha.unix.Chroot -analyzer-disable-checker=alpha.unix.PthreadLock -analyzer-disable-checker=alpha.unix.SimpleStream -analyzer-disable-checker=alpha.unix.Stream -analyzer-disable-checker=alpha.unix.cstring.BufferOverlap -analyzer-disable-checker=alpha.unix.cstring.NotNullTerminated -analyzer-disable-checker=alpha.unix.cstring.OutOfBounds -analyzer-disable-checker=apiModeling.TrustNonnull -analyzer-checker=apiModeling.google.GTest -analyzer-checker=core.CallAndMessage -analyzer-checker=core.DivideZero -analyzer-checker=core.DynamicTypePropagation -analyzer-checker=core.NonNullParamChecker -analyzer-checker=core.NonnilStringConstants -analyzer-checker=core.NullDereference -analyzer-checker=core.StackAddressEscape -analyzer-checker=core.UndefinedBinaryOperatorResult -analyzer-checker=core.VLASize -analyzer-checker=core.builtin.BuiltinFunctions -analyzer-checker=core.builtin.NoReturnFunctions -analyzer-checker=core.uninitialized.ArraySubscript -analyzer-checker=core.uninitialized.Assign -analyzer-checker=core.uninitialized.Branch -analyzer-checker=core.uninitialized.CapturedBlockVariable -analyzer-checker=core.uninitialized.UndefReturn -analyzer-disable-checker=cplusplus.InnerPointer -analyzer-checker=cplusplus.NewDelete -analyzer-checker=cplusplus.NewDeleteLeaks -analyzer-checker=cplusplus.SelfAssignment -analyzer-checker=deadcode.DeadStores -analyzer-disable-checker=debug.AnalysisOrder -analyzer-disable-checker=debug.ConfigDumper -analyzer-disable-checker=debug.DumpCFG -analyzer-disable-checker=debug.DumpCallGraph -analyzer-disable-checker=debug.DumpCalls -analyzer-disable-checker=debug.DumpDominators -analyzer-disable-checker=debug.DumpLiveVars -analyzer-disable-checker=debug.DumpTraversal -analyzer-disable-checker=debug.ExprInspection -analyzer-disable-checker=debug.Stats -analyzer-disable-checker=debug.TaintTest -analyzer-disable-checker=debug.ViewCFG -analyzer-disable-checker=debug.ViewCallGraph -analyzer-disable-checker=debug.ViewExplodedGraph -analyzer-disable-checker=llvm.Conventions -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-disable-checker=nullability.NullableDereferenced -analyzer-disable-checker=nullability.NullablePassedToNonnull -analyzer-disable-checker=nullability.NullableReturnedFromNonnull -analyzer-disable-checker=optin.cplusplus.VirtualCall -analyzer-disable-checker=optin.mpi.MPI-Checker -analyzer-disable-checker=optin.osx.cocoa.localizability.EmptyLocalizationContextChecker -analyzer-disable-checker=optin.osx.cocoa.localizability.NonLocalizedStringChecker -analyzer-disable-checker=optin.performance.GCDAntipattern -analyzer-disable-checker=optin.performance.Padding -analyzer-checker=optin.portability.UnixAPI -analyzer-disable-checker=osx.API -analyzer-disable-checker=osx.NumberObjectConversion -analyzer-disable-checker=osx.ObjCProperty -analyzer-disable-checker=osx.SecKeychainAPI -analyzer-disable-checker=osx.cocoa.AtSync -analyzer-disable-checker=osx.cocoa.AutoreleaseWrite -analyzer-disable-checker=osx.cocoa.ClassRelease -analyzer-disable-checker=osx.cocoa.Dealloc -analyzer-disable-checker=osx.cocoa.IncompatibleMethodTypes -analyzer-disable-checker=osx.cocoa.Loops -analyzer-disable-checker=osx.cocoa.MissingSuperCall -analyzer-disable-checker=osx.cocoa.NSAutoreleasePool -analyzer-disable-checker=osx.cocoa.NSError -analyzer-disable-checker=osx.cocoa.NilArg -analyzer-disable-checker=osx.cocoa.NonNilReturnValue -analyzer-disable-checker=osx.cocoa.ObjCGenerics -analyzer-disable-checker=osx.cocoa.RetainCount -analyzer-disable-checker=osx.cocoa.RunLoopAutoreleaseLeak -analyzer-disable-checker=osx.cocoa.SelfInit -analyzer-disable-checker=osx.cocoa.SuperDealloc -analyzer-disable-checker=osx.cocoa.UnusedIvars -analyzer-disable-checker=osx.cocoa.VariadicMethodTypes -analyzer-disable-checker=osx.coreFoundation.CFError -analyzer-disable-checker=osx.coreFoundation.CFNumber -analyzer-disable-checker=osx.coreFoundation.CFRetainRelease -analyzer-disable-checker=osx.coreFoundation.containers.OutOfBounds -analyzer-disable-checker=osx.coreFoundation.containers.PointerSizedValues -analyzer-checker=security.FloatLoopCounter -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-disable-checker=security.insecureAPI.bcmp -analyzer-disable-checker=security.insecureAPI.bcopy -analyzer-disable-checker=security.insecureAPI.bzero -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.rand -analyzer-disable-checker=security.insecureAPI.strcpy -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=unix.API -analyzer-checker=unix.Malloc -analyzer-checker=unix.MallocSizeof -analyzer-checker=unix.MismatchedDeallocator -analyzer-checker=unix.StdCLibraryFunctions -analyzer-checker=unix.Vfork -analyzer-checker=unix.cstring.BadSizeArg -analyzer-checker=unix.cstring.NullArg -analyzer-checker=valist.CopyToSelf -analyzer-checker=valist.Uninitialized -analyzer-checker=valist.Unterminated -analyzer-config aggressive-binary-operation-simplification=true -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=CodeCheckerProjects/llvm/build/release_assert/reports/ctu-dir/x86_64 -analyzer-display-ctu-progress -analyzer-ctu-import-threshold=8 -o CodeCheckerProjects/llvm/build/release_assert/reports/ChainedDiagnosticConsumer.cpp_a2824a9324b7b83e288a30bde982d8ef.plist -x c++ CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Frontend/ChainedDiagnosticConsumer.cpp -faddrsig 
1.  <eof> parser at end of file
2.  While analyzing stack: 
    #0 Calling clang::SourceManager::getFileCharacteristic at CodeCheckerProjects/llvm/git/llvm/tools/clang/include/clang/Basic/SourceManager.h:1433:21
    #1 Calling clang::SourceManager::isInSystemHeader at line 488
    #2 Calling clang::DiagnosticIDs::getDiagnosticSeverity at line 412
    #3 Calling clang::DiagnosticIDs::getDiagnosticLevel at line 500
    #4 Calling clang::DiagnosticsEngine::EmitCurrentDiagnostic at CodeCheckerProjects/llvm/git/llvm/tools/clang/include/clang/Basic/Diagnostic.h:1101:19
    #5 Calling clang::DiagnosticBuilder::Emit at CodeCheckerProjects/llvm/git/llvm/tools/clang/include/clang/Basic/Diagnostic.h:1124:5
    #6 Calling clang::DiagnosticBuilder::~DiagnosticBuilder
3.  CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/SourceManager.cpp:1429:3 <Spelling=CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/SourceManager.cpp:1429:10>: Error evaluating statement
4.  CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/SourceManager.cpp:1429:3 <Spelling=CodeCheckerProjects/llvm/git/llvm/tools/clang/lib/Basic/SourceManager.cpp:1429:10>: Error evaluating statement
dkrupp commented 5 years ago

a simple fix is ready, test case is being written.