(translate_options): For options that take an argument,
authorJim Wilson <wilson@gcc.gnu.org>
Mon, 2 May 1994 20:53:21 +0000 (13:53 -0700)
committerJim Wilson <wilson@gcc.gnu.org>
Mon, 2 May 1994 20:53:21 +0000 (13:53 -0700)
don't skip the argument if it doesn't exist.

From-SVN: r7190

gcc/gcc.c

index 8e11ad3ba320845abc949b3e6286575943764bd4..a9adb8f5a41687562f9752c3b76a65d01f28b06d 100644 (file)
--- 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++];