diff options
| author | Nuno Lopes <nunoplopes@sapo.pt> | 2009-03-22 17:47:44 +0000 |
|---|---|---|
| committer | Nuno Lopes <nunoplopes@sapo.pt> | 2009-03-22 17:47:44 +0000 |
| commit | 34cef4c1c82c8f03f174c1388c7c4c1827feeab7 (patch) | |
| tree | ead31e25b049225a4c192d4059885e3da49942ec /clang | |
| parent | b1656c1e1f7c81a5979ce9e9e2e430399140e4d2 (diff) | |
| download | bcm5719-llvm-34cef4c1c82c8f03f174c1388c7c4c1827feeab7.tar.gz bcm5719-llvm-34cef4c1c82c8f03f174c1388c7c4c1827feeab7.zip | |
fix PR3859: crash with 'cc -V'
llvm-svn: 67472
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Driver/Arg.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Driver/Arg.cpp b/clang/lib/Driver/Arg.cpp index c43c9fbe4b1..df75a5dd796 100644 --- a/clang/lib/Driver/Arg.cpp +++ b/clang/lib/Driver/Arg.cpp @@ -162,8 +162,9 @@ void SeparateArg::render(const ArgList &Args, ArgStringList &Output) const { Output.push_back(Args.MakeArgString(Joined.c_str())); } else { Output.push_back(Args.getArgString(getIndex())); - for (unsigned i = 0; i < NumValues; ++i) - Output.push_back(Args.getArgString(getIndex() + 1 + i)); + unsigned limit = std::min(Args.size(), getIndex() + 1 + NumValues); + for (unsigned i = getIndex() + 1; i < limit; ++i) + Output.push_back(Args.getArgString(i)); } } |

