aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1994-05-02 13:53:21 -0700
committerJim Wilson <wilson@gcc.gnu.org>1994-05-02 13:53:21 -0700
commite184d694d8f474bff290192538d1d6604833644d (patch)
treed153ca69ea896a83acaa401a0a84e1b5bde3e3b9
parente32fe22499cfa3b6713e89130074167f56070b3f (diff)
downloadgcc-e184d694d8f474bff290192538d1d6604833644d.zip
gcc-e184d694d8f474bff290192538d1d6604833644d.tar.gz
gcc-e184d694d8f474bff290192538d1d6604833644d.tar.bz2
(translate_options): For options that take an argument,
don't skip the argument if it doesn't exist. From-SVN: r7190
-rw-r--r--gcc/gcc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 8e11ad3..a9adb8f 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -900,6 +900,12 @@ translate_options (argcp, argvp)
else if (! strcmp (p, "Xlinker"))
nskip += 1;
+ /* Watch out for an option at the end of the command line that
+ is missing arguments, and avoid skipping past the end of the
+ command line. */
+ if (nskip + i > argc)
+ nskip = argc - i;
+
while (nskip > 0)
{
newv[newindex++] = argv[i++];