[LLVMbugs] [Bug 1317] NEW: cl::ParseCommandLineOptions recurses infinitely

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Apr 9 06:43:24 PDT 2007


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

           Summary: cl::ParseCommandLineOptions recurses infinitely
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Support Libraries
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rspencer at x10sys.com


I'm reporting this for Zhongxing Xu <xuzhongxing at gmail.com>.

Try this:
make -C lib/Transforms/Hello
Debug/lib/opt -load=Debug/lib/LLVMHello.so -help

It will infinitely recurse printing out things like:
opt: CommandLine Error: Argument 'version' defined more than once!
opt: CommandLine Error: Argument 'help-hidden' defined more than once!
opt: CommandLine Error: Argument 'help' defined more than once!
opt: CommandLine Error: Argument 'stats' defined more than once!
opt: CommandLine Error: Argument 'info-output-file' defined more than once!
opt: CommandLine Error: Argument 'track-memory' defined more than once!
opt: CommandLine Error: Argument 'version' defined more than once!
opt: CommandLine Error: Argument 'help-hidden' defined more than once!
opt: CommandLine Error: Argument 'help' defined more than once!
opt: CommandLine Error: Argument 'analyze' defined more than once!
opt: CommandLine Error: Argument 'quiet' defined more than once!
opt: CommandLine Error: Argument 'q' defined more than once!
opt: CommandLine Error: Argument 'std-compile-opts' defined more than once!
opt: CommandLine Error: Argument 'disable-opt' defined more than once!
opt: CommandLine Error: Argument 'disable-inlining' defined more than once!
opt: CommandLine Error: Argument 'strip-debug' defined more than once!
opt: CommandLine Error: Argument 'verify-each' defined more than once!
opt: CommandLine Error: Argument 'disable-verify' defined more than once!
opt: CommandLine Error: Argument 'disable-output' defined more than once!
opt: CommandLine Error: Argument 'p' defined more than once!
opt: CommandLine Error: Argument 'f' defined more than once!
opt: CommandLine Error: Argument 'o' defined more than once!
opt: CommandLine Error: Argument 'disable-compression' defined more than once!
opt: CommandLine Error: Argument 'printm' defined more than once!

ad nasueum.


Randomly breaking into the infinite loop in gdb yielded this stack trace:

#5  0x0034f2de in fwrite () from /lib/libc.so.6
#6  0x0018e367 in __gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char>
>::xsputn (this=0x3, __s=0x3 <Address 0x3 out of bounds>,
    __n=3) at
/proj/gcc/build-4.0.3/i686-pc-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:217
#7  0x001929b1 in std::operator<< <std::char_traits<char> > (__out=@0x86c89c0,
__s=0x86c7b60 "opt")
    at /proj/gcc/build-4.0.3/i686-pc-linux-gnu/libstdc++-v3/include/streambuf:425
#8  0x085d5719 in llvm::BaseStream<std::ostream>::operator<< <char [80]>
(this=0x86cb878, Thing=@0x86c7b60)
    at /proj/llvm/llvm-1/include/llvm/Support/Streams.h:44
#9  0x085d2e01 in GetOptionInfo (PositionalOpts=@0xbf923790,
OptionsMap=@0xbf923778) at CommandLine.cpp:108
#10 0x085db4be in (anonymous namespace)::HelpPrinter::operator= (this=0x86cb774,
Value=true) at CommandLine.cpp:895
#11 0x085dc3f1 in llvm::cl::opt_storage<(anonymous namespace)::HelpPrinter,
true, true>::setValue<bool> (this=0x86cb760, V=@0xbf923837)
    at /proj/llvm/llvm-1/include/llvm/Support/CommandLine.h:715
#12 0x085dc44a in llvm::cl::opt<(anonymous namespace)::HelpPrinter, true,
llvm::cl::parser<bool> >::handleOccurrence (this=0x86cb740,
    pos=2, ArgName=0xbf925634 "help", Arg=@0xbf9238d0) at
/proj/llvm/llvm-1/include/llvm/Support/CommandLine.h:776
#13 0x085d2374 in llvm::cl::Option::addOccurrence (this=0x86cb740, pos=2,
ArgName=0xbf925634 "help", Value=@0xbf9238d0)
    at CommandLine.cpp:672
#14 0x085d25c1 in ProvideOption (Handler=0x86cb740, ArgName=0xbf925634 "help",
Value=0x0, argc=3, argv=0xbf923d74, i=@0xbf923998)
    at CommandLine.cpp:185
#15 0x085d41bf in llvm::cl::ParseCommandLineOptions (argc=@0xbf923cf0,
argv=0xbf923d74,
    Overview=0x860be0c " llvm .bc -> .bc modular optimizer and analysis printer
\n") at CommandLine.cpp:528
#16 0x083341bd in main (argc=3, argv=0xbf923d74) at opt.cpp:248


Additionally, running:
Debug/lib/opt -load=Debug/lib/LLVMHello.so -hello

yields:
opt: Unknown command line argument '-hello'.  Try: 'opt --help'



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.



More information about the llvm-bugs mailing list