Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:171: void llvm::DwarfFile::addScopeVariable(llvm::LexicalScope *, llvm::DbgVariable *): Assertion `CurNum != ArgNum && "Duplicate argument"' failed. #22501

Closed Quuxplusone closed 9 years ago

Quuxplusone commented 9 years ago
Bugzilla Link PR22502
Status RESOLVED FIXED
Importance P normal
Reported by Chilledheart (rwindz0@gmail.com)
Reported on 2015-02-07 11:36:56 -0800
Last modified on 2015-02-11 08:08:11 -0800
Version trunk
Hardware PC Linux
CC aprantl@apple.com, dblaikie@gmail.com, echristo@gmail.com, llvm-bugs@lists.llvm.org, rwindz0@gmail.com
Fixed by commit(s)
Attachments MacOSKeychainAPIChecker-41c425.cpp.xz (751504 bytes, application/force-download)
MacOSKeychainAPIChecker-41c425.log (7908 bytes, text/x-log)
MacOSKeychainAPIChecker-41c425.sh (1264 bytes, application/x-shellscript)
MacOSKeychainAPIChecker-41c425.lldb.log (12285 bytes, text/x-log)
Blocks
Blocked by
See also
LLVM trunk: 228493
Clang trunk: 228492
Bootstrap STAGE2 failed.

clang-3.7: /home/chilledheart/sources-
llvm/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:171: void
llvm::DwarfFile::addScopeVariable(llvm::LexicalScope *, llvm::DbgVariable *):
Assertion `CurNum != ArgNum && "Duplicate argument"' failed.
#0 0x7fc92272738e llvm::sys::PrintStackTrace(_IO_FILE*)
/home/chilledheart/sources-llvm/llvm/lib/Support/Unix/Signals.inc:422:15
#1 0x7fc9227289ab PrintStackTraceSignalHandler(void*)
/home/chilledheart/sources-llvm/llvm/lib/Support/Unix/Signals.inc:481:1
#2 0x7fc92272ac6b SignalHandler(int) /home/chilledheart/sources-
llvm/llvm/lib/Support/Unix/Signals.inc:198:60
#3 0x7fc9203a2950 __restore_rt (/lib64/libc.so.6+0x34950)
#4 0x7fc9203a28c7 __GI_raise /usr/src/debug/glibc-
2.20/signal/../sysdeps/unix/sysv/linux/raise.c:55:0
#5 0x7fc9203a452a __GI_abort /usr/src/debug/glibc-2.20/stdlib/abort.c:91:0
#6 0x7fc92039b46d __assert_fail_base /usr/src/debug/glibc-
2.20/assert/assert.c:92:0
#7 0x7fc92039b522 (/lib64/libc.so.6+0x2d522)
#8 0x7fc91fecce98 llvm::DwarfFile::addScopeVariable(llvm::LexicalScope*,
llvm::DbgVariable*) /home/chilledheart/sources-
llvm/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:172:7
#9 0x7fc91fe9aa7f
llvm::DwarfDebug::collectVariableInfoFromMMITable(llvm::SmallPtrSetImpl<llvm::MDNode
const*>&) /home/chilledheart/sources-
llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:773:23
#10 0x7fc91fe9c784
llvm::DwarfDebug::collectVariableInfo(llvm::DwarfCompileUnit&,
llvm::DISubprogram, llvm::SmallPtrSetImpl<llvm::MDNode const*>&)
/home/chilledheart/sources-llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:942:24
#11 0x7fc91fe9f6af llvm::DwarfDebug::endFunction(llvm::MachineFunction const*)
/home/chilledheart/sources-llvm/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp:1263:3
#12 0x7fc91fe351bb llvm::AsmPrinter::EmitFunctionBody()
/home/chilledheart/sources-llvm/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:885:5
#13 0x7fc9272a6a0c
llvm::X86AsmPrinter::runOnMachineFunction(llvm::MachineFunction&)
/home/chilledheart/sources-llvm/llvm/lib/Target/X86/X86AsmPrinter.cpp:70:3
#14 0x7fc924e1b68e llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/chilledheart/sources-llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:41:10
#15 0x7fc9247c26bd llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/chilledheart/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1538:23
#16 0x7fc9247c2bf8 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/chilledheart/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1558:16
#17 0x7fc9247c3553 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/chilledheart/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1616:23
#18 0x7fc9247c2eae llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/chilledheart/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1723:16
#19 0x7fc9247c3d41 llvm::legacy::PassManager::run(llvm::Module&)
/home/chilledheart/sources-llvm/llvm/lib/IR/LegacyPassManager.cpp:1756:10
#20 0x7fc91b388173 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_ostream*) /home/chilledheart/sources-
llvm/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:640:5
#21 0x7fc91b3878d2 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) /home/chilledheart/sources-
llvm/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:652:3
#22 0x7fc91b618706
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:178:7
#23 0x7fc91d148e96 clang::ParseAST(clang::Sema&, bool, bool)
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/Parse/ParseAST.cpp:151:3
#24 0x7fc9213b19ba clang::ASTFrontendAction::ExecuteAction()
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:537:1
#25 0x7fc91b616e51 clang::CodeGenAction::ExecuteAction()
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:726:1
#26 0x7fc9213b0cc0 clang::FrontendAction::Execute() /home/chilledheart/sources-
llvm/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:441:7
#27 0x7fc9213450db
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:803:7
#28 0x7fc920fd2368 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/chilledheart/sources-llvm/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:18
#29 0x41899b cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
/home/chilledheart/sources-llvm/llvm/tools/clang/tools/driver/cc1_main.cpp:110:13
#30 0x40ccf3 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef)
/home/chilledheart/sources-llvm/llvm/tools/clang/tools/driver/driver.cpp:369:12
#31 0x40b4bc main /home/chilledheart/sources-
llvm/llvm/tools/clang/tools/driver/driver.cpp:415:12
#32 0x7fc92038dfe0 __libc_start_main /usr/src/debug/glibc-2.20/csu/libc-
start.c:323:0
#33 0x40ae84 _start (/home/chilledheart/build-debug/bin/clang-3.7+0x40ae84)
Stack dump:
0.  Program arguments: /home/chilledheart/build-debug/bin/clang-3.7 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
MacOSKeychainAPIChecker.cpp -mrelocation-model pic -pic-level 2 -mthread-model
posix -mdisable-fp-elim -relaxed-aliasing -fmath-errno -masm-verbose -
mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu core-avx2 -
momit-leaf-frame-pointer -g -dwarf-column-info -ffunction-sections -fdata-
sections -D CLANG_ENABLE_ARCMT -D CLANG_ENABLE_OBJC_REWRITER -D
CLANG_ENABLE_STATIC_ANALYZER -D GTEST_HAS_RTTI=0 -D _DEBUG -D _GNU_SOURCE -D
__STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -O2 -Wall
-W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-
initializers -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -
Woverloaded-virtual -Wno-nested-anon-types -pedantic -std=c++11 -fdeprecated-
macro -ferror-limit 19 -fmessage-length 0 -fvisibility-inlines-hidden -
mstackrealign -fno-rtti -fobjc-runtime=gcc -fno-common -fdiagnostics-show-
option -fcolor-diagnostics -vectorize-loops -vectorize-slp -x c++
MacOSKeychainAPIChecker-41c425.cpp
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module 'MacOSKeychainAPIChecker-
41c425.cpp'.
4.  Running pass 'X86 Assembly / Object Emitter' on function
'@_ZN5clang4ento5check11DeadSymbols17_checkDeadSymbolsIN12_GLOBAL__N_123MacOSKeychainAPICheckerEEEvPvRNS0_12SymbolReaperERNS0_14CheckerContextE'
MacOSKeychainAPIChecker-41c425.sh: line 1: 15356 Aborted                 (core
dumped) "/home/chilledheart/build-debug/bin/clang-3.7" "-cc1" "-triple" "x86_64-
unknown-linux-gnu" "-emit-obj" "-disable-free" "-main-file-name"
"MacOSKeychainAPIChecker.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-
mthread-model" "posix" "-mdisable-fp-elim" "-relaxed-aliasing" "-fmath-errno" "-
masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-
target-cpu" "core-avx2" "-momit-leaf-frame-pointer" "-g" "-dwarf-column-info" "-
ffunction-sections" "-fdata-sections" "-D" "CLANG_ENABLE_ARCMT" "-D"
"CLANG_ENABLE_OBJC_REWRITER" "-D" "CLANG_ENABLE_STATIC_ANALYZER" "-D"
"GTEST_HAS_RTTI=0" "-D" "_DEBUG" "-D" "_GNU_SOURCE" "-D"
"__STDC_CONSTANT_MACROS" "-D" "__STDC_FORMAT_MACROS" "-D" "__STDC_LIMIT_MACROS"
"-O2" "-Wall" "-W" "-Wno-unused-parameter" "-Wwrite-strings" "-Wcast-qual" "-
Wmissing-field-initializers" "-Wno-long-long" "-Wcovered-switch-default" "-Wnon-
virtual-dtor" "-Woverloaded-virtual" "-Wno-nested-anon-types" "-pedantic" "-
std=c++11" "-fdeprecated-macro" "-ferror-limit" "19" "-fmessage-length" "0" "-
fvisibility-inlines-hidden" "-mstackrealign" "-fno-rtti" "-fobjc-runtime=gcc" "-
fno-common" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-
loops" "-vectorize-slp" "-x" "c++" "MacOSKeychainAPIChecker-41c425.cpp"
Quuxplusone commented 9 years ago

Attached MacOSKeychainAPIChecker-41c425.cpp.xz (751504 bytes, application/force-download): MacOSKeychainAPIChecker-41c425.cpp.xz

Quuxplusone commented 9 years ago

Attached MacOSKeychainAPIChecker-41c425.log (7908 bytes, text/x-log): MacOSKeychainAPIChecker-41c425.log

Quuxplusone commented 9 years ago

Attached MacOSKeychainAPIChecker-41c425.sh (1264 bytes, application/x-shellscript): MacOSKeychainAPIChecker-41c425.sh

Quuxplusone commented 9 years ago
While using lldb to debug with it, it shows ArgNum == CurNum, which is really
confusing.

[chilledheart@fedora case]$ lldb -- $(cat MacOSKeychainAPIChecker-41c425.sh)
(lldb) target create ""/home/chilledheart/build-debug/bin/clang-3.7""
Current executable set to '/home/chilledheart/build-debug/bin/clang-3.7'
(x86_64).
(lldb) settings set -- target.run-args  '"-cc1"' '"-triple"' '"x86_64-unknown-
linux-gnu"' '"-emit-obj"' '"-disable-free"' '"-main-file-name"'
'"MacOSKeychainAPIChecker.cpp"' '"-mrelocation-model"' '"pic"' '"-pic-level"'
'"2"' '"-mthread-model"' '"posix"' '"-mdisable-fp-elim"' '"-relaxed-aliasing"'
'"-fmath-errno"' '"-masm-verbose"' '"-mconstructor-aliases"' '"-munwind-
tables"' '"-fuse-init-array"' '"-target-cpu"' '"core-avx2"' '"-momit-leaf-frame-
pointer"' '"-g"' '"-dwarf-column-info"' '"-ffunction-sections"' '"-fdata-
sections"' '"-D"' '"CLANG_ENABLE_ARCMT"' '"-D"' '"CLANG_ENABLE_OBJC_REWRITER"'
'"-D"' '"CLANG_ENABLE_STATIC_ANALYZER"' '"-D"' '"GTEST_HAS_RTTI=0"' '"-D"'
'"_DEBUG"' '"-D"' '"_GNU_SOURCE"' '"-D"' '"__STDC_CONSTANT_MACROS"' '"-D"'
'"__STDC_FORMAT_MACROS"' '"-D"' '"__STDC_LIMIT_MACROS"' '"-O2"' '"-Wall"' '"-
W"' '"-Wno-unused-parameter"' '"-Wwrite-strings"' '"-Wcast-qual"' '"-Wmissing-
field-initializers"' '"-Wno-long-long"' '"-Wcovered-switch-default"' '"-Wnon-
virtual-dtor"' '"-Woverloaded-virtual"' '"-Wno-nested-anon-types"' '"-
pedantic"' '"-std=c++11"' '"-fdeprecated-macro"' '"-ferror-limit"' '"19"' '"-
fmessage-length"' '"0"' '"-fvisibility-inlines-hidden"' '"-mstackrealign"' '"-
fno-rtti"' '"-fobjc-runtime=gcc"' '"-fno-common"' '"-fdiagnostics-show-option"'
'"-fcolor-diagnostics"' '"-vectorize-loops"' '"-vectorize-slp"' '"-x"' '"c++"'
'"MacOSKeychainAPIChecker-41c425.cpp"'
(lldb) run
Process 22354 launching
Process 22354 launched: '/home/chilledheart/build-debug/bin/clang-3.7' (x86_64)
warning: (x86_64) /lib64/libtinfo.so.5 DWARF compile unit extends beyond its
bounds cu 0x00001869 at 0x00001883

warning: (x86_64) /lib64/libtinfo.so.5 DWARF compile unit extends beyond its
bounds cu 0x000018e1 at 0x000018fb

warning: (x86_64) /lib64/libtinfo.so.5 DWARF compile unit extends beyond its
bounds cu 0x00001987 at 0x000019a1

clang-3.7: /home/chilledheart/sources-
llvm/llvm/lib/CodeGen/AsmPrinter/DwarfFile.cpp:171: void
llvm::DwarfFile::addScopeVariable(llvm::LexicalScope *, llvm::DbgVariable *):
Assertion `CurNum != ArgNum && "Duplicate argument"' failed.
Process 22354 stopped
* thread #1: tid = 22354, 0x00007fffe82638c7 libc.so.6`__GI_raise(sig=6) + 55
at raise.c:55, name = 'clang-3.7', stop reason = signal SIGABRT
    frame #0: 0x00007fffe82638c7 libc.so.6`__GI_raise(sig=6) + 55 at raise.c:55
   52       if (__glibc_unlikely (pid <= 0))
   53         pid = (pid & INT_MAX) == 0 ? selftid : -pid;
   54
-> 55     return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
   56   }
   57   libc_hidden_def (raise)
   58   weak_alias (raise, gsignal)
(lldb) bt
* thread #1: tid = 22354, 0x00007fffe82638c7 libc.so.6`__GI_raise(sig=6) + 55
at raise.c:55, name = 'clang-3.7', stop reason = signal SIGABRT
  * frame #0: 0x00007fffe82638c7 libc.so.6`__GI_raise(sig=6) + 55 at raise.c:55
    frame #1: 0x00007fffe826552a libc.so.6`__GI_abort + 362 at abort.c:89
    frame #2: 0x00007fffe825c46d libc.so.6`__assert_fail_base(fmt=<unavailable>, assertion=<unavailable>, file=<unavailable>, line=<unavailable>, function=<unavailable>) + 285 at assert.c:92
    frame #3: 0x00007fffe825c522 libc.so.6`__GI___assert_fail(assertion=<unavailable>, file=<unavailable>, line=<unavailable>, function=<unavailable>) + 66 at assert.c:101
    frame #4: 0x00007fffe7d8de98 libLLVMAsmPrinter.so`llvm::DwarfFile::addScopeVariable(this=0x0000000008a31a80, LS=0x000000000b7b6560, Var=0x000000000b7d7170) + 248 at DwarfFile.cpp:171
    frame #5: 0x00007fffe7d5ba7f libLLVMAsmPrinter.so`llvm::DwarfDebug::collectVariableInfoFromMMITable(this=0x0000000008a30db0, Processed=0x00007fffffff8cf0) + 799 at DwarfDebug.cpp:789
    frame #6: 0x00007fffe7d5d784 libLLVMAsmPrinter.so`llvm::DwarfDebug::collectVariableInfo(this=0x0000000008a30db0, TheCU=0x00000000061bc2a0, SP=DISubprogram at 0x00007fffffff8a58, Processed=0x00007fffffff8cf0) + 68 at DwarfDebug.cpp:940
    frame #7: 0x00007fffe7d606af libLLVMAsmPrinter.so`llvm::DwarfDebug::endFunction(this=0x0000000008a30db0, MF=0x000000000bc47580) + 575 at DwarfDebug.cpp:1263
    frame #8: 0x00007fffe7cf61bb libLLVMAsmPrinter.so`llvm::AsmPrinter::EmitFunctionBody(this=0x0000000005f699e0) + 2619 at AsmPrinter.cpp:885
    frame #9: 0x00007fffef167a0c libLLVMX86CodeGen.so`llvm::X86AsmPrinter::runOnMachineFunction(this=0x0000000005f699e0, MF=0x000000000bc47580) + 300 at X86AsmPrinter.cpp:70
    frame #10: 0x00007fffeccdc68e libLLVMCodeGen.so`llvm::MachineFunctionPass::runOnFunction(this=0x0000000005f699e0, F=0x0000000009c2d980) + 110 at MachineFunctionPass.cpp:41
    frame #11: 0x00007fffec6836bd libLLVMCore.so`llvm::FPPassManager::runOnFunction(this=0x000000000668ea80, F=0x0000000009c2d980) + 413 at LegacyPassManager.cpp:1538
    frame #12: 0x00007fffec683bf8 libLLVMCore.so`llvm::FPPassManager::runOnModule(this=0x000000000668ea80, M=0x0000000000677850) + 104 at LegacyPassManager.cpp:1558
    frame #13: 0x00007fffec684553 libLLVMCore.so`(anonymous namespace)::MPPassManager::runOnModule(this=0x00000000093c5a20, M=0x0000000000677850) + 1283 at LegacyPassManager.cpp:1616
    frame #14: 0x00007fffec683eae libLLVMCore.so`llvm::legacy::PassManagerImpl::run(this=0x000000000632bf80, M=0x0000000000677850) + 302 at LegacyPassManager.cpp:1723
    frame #15: 0x00007fffec684d41 libLLVMCore.so`llvm::legacy::PassManager::run(this=0x0000000000fa1f40, M=0x0000000000677850) + 33 at LegacyPassManager.cpp:1756
    frame #16: 0x00007fffe3249173 libclangCodeGen.so`(anonymous namespace)::EmitAssemblyHelper::EmitAssembly(this=0x00007fffffff99d0, Action=Backend_EmitObj, OS=0x000000000066f720) + 1523 at BackendUtil.cpp:640
    frame #17: 0x00007fffe32488d2 libclangCodeGen.so`clang::EmitBackendOutput(Diags=0x0000000000644f30, CGOpts=0x0000000000641b90, TOpts=0x0000000000642160, LOpts=0x0000000000642020, TDesc=(Data = "e-m:e-i64:64-f80:128-n8:16:32:64-S128", Length = 37), M=0x0000000000677850, Action=Backend_EmitObj, OS=0x000000000066f720) + 114 at BackendUtil.cpp:652
    frame #18: 0x00007fffe34d9706 libclangCodeGen.so`clang::BackendConsumer::HandleTranslationUnit(this=0x00000000006773d0, C=0x0000000000669ec0) + 1270 at CodeGenAction.cpp:174
    frame #19: 0x00007fffe5009e96 libclangParse.so`clang::ParseAST(S=0x0000000000692eb0, PrintStats=false, SkipFunctionBodies=false) + 1206 at ParseAST.cpp:151
    frame #20: 0x00007fffe92729ba libclangFrontend.so`clang::ASTFrontendAction::ExecuteAction(this=0x0000000000642cc0) + 522 at FrontendAction.cpp:535
    frame #21: 0x00007fffe34d7e51 libclangCodeGen.so`clang::CodeGenAction::ExecuteAction(this=0x0000000000642cc0) + 3713 at CodeGenAction.cpp:725
    frame #22: 0x00007fffe9271cc0 libclangFrontend.so`clang::FrontendAction::Execute(this=0x0000000000642cc0) + 112 at FrontendAction.cpp:437
    frame #23: 0x00007fffe92060db libclangFrontend.so`clang::CompilerInstance::ExecuteAction(this=0x0000000000641a20, Act=0x0000000000642cc0) + 891 at CompilerInstance.cpp:802
    frame #24: 0x00007fffe8e93368 libclangFrontendTool.so`clang::ExecuteCompilerInvocation(Clang=0x0000000000641a20) + 3032 at ExecuteCompilerInvocation.cpp:222
    frame #25: 0x000000000041899b clang-3.7`cc1_main(Argv=ArrayRef<const char *> at 0x00007fffffffb468, Argv0=0x00007fffffffd87b, MainAddr=0x000000000040af60) + 2299 at cc1_main.cpp:110
    frame #26: 0x000000000040ccf3 clang-3.7`ExecuteCC1Tool(argv=ArrayRef<const char *> at 0x00007fffffffb9e8, Tool=(Data = "", Length = 0)) + 163 at driver.cpp:369
    frame #27: 0x000000000040b4bc clang-3.7`main(argc_=77, argv_=0x00007fffffffd268) + 1212 at driver.cpp:415
    frame #28: 0x00007fffe824efe0 libc.so.6`__libc_start_main(main=0x000000000040b000, argc=77, argv=0x00007fffffffd268, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_end=0x00007fffffffd258) + 240 at libc-start.c:289
    frame #29: 0x000000000040ae84 clang-3.7`_start + 41
(lldb) f 4
frame #4: 0x00007fffe7d8de98
libLLVMAsmPrinter.so`llvm::DwarfFile::addScopeVariable(this=0x0000000008a31a80,
LS=0x000000000b7b6560, Var=0x000000000b7d7170) + 248 at DwarfFile.cpp:171
   168        // A later indexed parameter has been found, insert immediately before it.
   169        if (CurNum > ArgNum)
   170          break;
-> 171        assert(CurNum != ArgNum && "Duplicate argument");
   172        ++I;
   173      }
   174      Vars.insert(I, Var);
(lldb) expr CurNum
(unsigned int) $0 = 5
(lldb) expr ArgNum
(unsigned int) $1 = 5
(lldb) expr I
(llvm::DbgVariable **) $2 = 0x000000000b87fb30
(lldb) fr v
(llvm::DwarfFile *) this = 0x0000000008a31a80
(llvm::LexicalScope *) LS = 0x000000000b7b6560
(llvm::DbgVariable *) Var = 0x000000000b7d7170
(llvm::SmallVectorImpl<llvm::DbgVariable *> &) Vars = 0x000000000b87fb18: {
  llvm::SmallVectorTemplateBase<llvm::DbgVariable *, true> = {
    llvm::SmallVectorTemplateCommon<llvm::DbgVariable *> = {
      llvm::SmallVectorBase = (BeginX = 0x000000000b87fb30, EndX = 0x000000000b87fb38, CapacityX = 0x000000000b87fb70)
      FirstEl = {
        llvm::AlignedCharArray<8, 8> = (buffer = "<c0>x88\v")
      }
    }
  }
}
(llvm::DIVariable) DV = {
  llvm::DIDescriptor = {
    DbgNode = 0x0000000009329d88
  }
}
Quuxplusone commented 9 years ago

Attached MacOSKeychainAPIChecker-41c425.lldb.log (12285 bytes, text/x-log): MacOSKeychainAPIChecker-41c425.lldb.log

Quuxplusone commented 9 years ago

Adrian - I've a sneaking suspicion this is more fallout from the SROA changes (a recent change of yours involved the possibility of creating extra variables for padding? Did that result in this assertion, or did it fail elsewhere?).

I'm still poking around with it, but just thought I'd bring it up in case it's something you know about/can figure out relatively quickly.

Quuxplusone commented 9 years ago
I just reduced this piece of code from another bug report that triggers the
same assertion:

long x0, x1;
class x2;
struct x3 {
  bool x4;
  x2 *x5;
  bool x6;
};
struct x7 {
  template <class x8> static void x9(x8);
};
int *x10;
class x2 {
public:
  void x11(x3 x12) { x13(x12); }
  void x13(x3 x12) {
    x10 = (int *)__builtin_operator_new(x1);
    x7::x9(x12);
  }
};
class x14 {
public:
  x14(long);
  ~x14();
};
x2 x15;
void x16() {
  x3 x17;
  x14 x18(x0);
  x17.x6 = x17.x4 = true;
  x15.x11(x17);
}

I'm curious if this is the same bug.
Quuxplusone commented 9 years ago
(In reply to comment #7)
> I just reduced this piece of code from another bug report that triggers the
> same assertion:
>
> long x0, x1;
> class x2;
> struct x3 {
>   bool x4;
>   x2 *x5;
>   bool x6;
> };
> struct x7 {
>   template <class x8> static void x9(x8);
> };
> int *x10;
> class x2 {
> public:
>   void x11(x3 x12) { x13(x12); }
>   void x13(x3 x12) {
>     x10 = (int *)__builtin_operator_new(x1);
>     x7::x9(x12);
>   }
> };
> class x14 {
> public:
>   x14(long);
>   ~x14();
> };
> x2 x15;
> void x16() {
>   x3 x17;
>   x14 x18(x0);
>   x17.x6 = x17.x4 = true;
>   x15.x11(x17);
> }
>
> I'm curious if this is the same bug.

Probably worth fixing one before spending too much time on the other - and just
checking if it fixes both.

What's the -cc1 command line you used to observe the assertion failure on your
reduced example there?
Quuxplusone commented 9 years ago

clang++ -cc1 -triple arm64-apple-ios -emit-obj -disable-free -gdwarf-2 -dwarf-column-info -stdlib=libc++ -O2 -std=gnu++11 -fblocks -fcxx-exceptions -fexceptions -x c++ test.cpp

Quuxplusone commented 9 years ago

I think what's happening is that the dbg.declares describing the SROAed allocas cannot be lowered into dbg.values, so we end up with multiple entries for the same argument (but distinct DIExpressions) in the MMI table.

The resolution may be as simple as making addScopeVariable() aware of DIExpressions.

I'll see if that is actually is the case.

Quuxplusone commented 9 years ago
Both failures should now be fixed:

Author: adrian <adrian@91177308-0d34-0410-b5e6-96231b3b80d8>
Date:   Tue Feb 10 23:18:28 2015 +0000

    Debug Info: Support variables that are described by more than one MMI
    table entry. This happens when SROA splits up an alloca and the resulting
    allocas cannot be lowered to SSA values because their address is passed
    to a function.

    Fixes PR22502.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228764

Author: adrian <adrian@91177308-0d34-0410-b5e6-96231b3b80d8>
Date:   Tue Feb 10 23:32:56 2015 +0000

    Add the missing testcase for r228764.

    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228766
Quuxplusone commented 9 years ago

It bootstraps successfully now (r228827).

Thanks for the quick response!