|
|
6f1b0c |
--- gcc/system.h.jj 2003-04-08 15:55:41.000000000 +0200
|
|
|
6f1b0c |
+++ gcc/system.h 2003-10-03 19:01:24.000000000 +0200
|
|
|
6f1b0c |
@@ -153,6 +153,10 @@ extern int errno;
|
|
|
6f1b0c |
# endif
|
|
|
6f1b0c |
#endif
|
|
|
6f1b0c |
|
|
|
6f1b0c |
+#ifndef ICE_EXIT_CODE
|
|
|
6f1b0c |
+# define ICE_EXIT_CODE 27
|
|
|
6f1b0c |
+#endif
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
#ifdef HAVE_UNISTD_H
|
|
|
6f1b0c |
# include <unistd.h>
|
|
|
6f1b0c |
#endif
|
|
|
6f1b0c |
--- gcc/gcc.c.jj 2003-06-11 15:08:12.000000000 +0200
|
|
|
6f1b0c |
+++ gcc/gcc.c 2003-10-06 10:10:42.000000000 +0200
|
|
|
6f1b0c |
@@ -112,6 +112,10 @@ extern int getrusage PARAMS ((int, struc
|
|
|
6f1b0c |
#define TARGET_OBJECT_SUFFIX ".o"
|
|
|
6f1b0c |
#endif
|
|
|
6f1b0c |
|
|
|
6f1b0c |
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
|
|
|
6f1b0c |
+static void retry_ice PARAMS ((const char *, const char **));
|
|
|
6f1b0c |
+#endif
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
#ifndef VMS
|
|
|
6f1b0c |
/* FIXME: the location independence code for VMS is hairier than this,
|
|
|
6f1b0c |
and hasn't been written. */
|
|
|
6f1b0c |
@@ -2857,7 +2861,7 @@ execute ()
|
|
|
6f1b0c |
if (commands[i].pid == -1)
|
|
|
6f1b0c |
pfatal_pexecute (errmsg_fmt, errmsg_arg);
|
|
|
6f1b0c |
|
|
|
6f1b0c |
- if (string != commands[i].prog)
|
|
|
6f1b0c |
+ if (i && string != commands[i].prog)
|
|
|
6f1b0c |
free ((PTR) string);
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
|
|
|
6f1b0c |
@@ -2935,6 +2939,17 @@ See %s for instructions.",
|
|
|
6f1b0c |
else if (WIFEXITED (status)
|
|
|
6f1b0c |
&& WEXITSTATUS (status) >= MIN_FATAL_STATUS)
|
|
|
6f1b0c |
{
|
|
|
6f1b0c |
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
|
|
|
6f1b0c |
+ /* For ICEs in cc1, cc1obj, cc1plus see if it is
|
|
|
6f1b0c |
+ reproducible or not. */
|
|
|
6f1b0c |
+ char *p;
|
|
|
6f1b0c |
+ if (WEXITSTATUS (status) == ICE_EXIT_CODE
|
|
|
6f1b0c |
+ && j == 0
|
|
|
6f1b0c |
+ && (p = strrchr (commands[j].argv[0], DIR_SEPARATOR))
|
|
|
6f1b0c |
+ && ! strncmp (p + 1, "cc1", 3))
|
|
|
6f1b0c |
+ retry_ice (commands[j].prog, commands[j].argv);
|
|
|
6f1b0c |
+#endif
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
if (WEXITSTATUS (status) > greatest_status)
|
|
|
6f1b0c |
greatest_status = WEXITSTATUS (status);
|
|
|
6f1b0c |
ret_code = -1;
|
|
|
6f1b0c |
@@ -2946,6 +2961,10 @@ See %s for instructions.",
|
|
|
6f1b0c |
break;
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (commands[0].argv[0] != commands[0].prog)
|
|
|
6f1b0c |
+ free ((PTR) commands[0].argv[0]);
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
return ret_code;
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
@@ -5667,6 +5686,231 @@ give_switch (switchnum, omit_first_word,
|
|
|
6f1b0c |
switches[switchnum].validated = 1;
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
|
|
|
6f1b0c |
+#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS))
|
|
|
6f1b0c |
+#define RETRY_ICE_ATTEMPTS 2
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+static void
|
|
|
6f1b0c |
+retry_ice (prog, argv)
|
|
|
6f1b0c |
+ const char *prog;
|
|
|
6f1b0c |
+ const char **argv;
|
|
|
6f1b0c |
+{
|
|
|
6f1b0c |
+ int nargs, out_arg = -1, quiet = 0, attempt;
|
|
|
6f1b0c |
+ int pid, retries, sleep_interval;
|
|
|
6f1b0c |
+ const char **new_argv;
|
|
|
6f1b0c |
+ char *temp_filenames[RETRY_ICE_ATTEMPTS * 2 + 2];
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (input_filename == NULL || ! strcmp (input_filename, "-"))
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ for (nargs = 0; argv[nargs] != NULL; ++nargs)
|
|
|
6f1b0c |
+ /* Only retry compiler ICEs, not preprocessor ones. */
|
|
|
6f1b0c |
+ if (! strcmp (argv[nargs], "-E"))
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+ else if (argv[nargs][0] == '-' && argv[nargs][1] == 'o')
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ if (out_arg == -1)
|
|
|
6f1b0c |
+ out_arg = nargs;
|
|
|
6f1b0c |
+ else
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ /* If the compiler is going to output any time information,
|
|
|
6f1b0c |
+ it might varry between invocations. */
|
|
|
6f1b0c |
+ else if (! strcmp (argv[nargs], "-quiet"))
|
|
|
6f1b0c |
+ quiet = 1;
|
|
|
6f1b0c |
+ else if (! strcmp (argv[nargs], "-ftime-report"))
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (out_arg == -1 || !quiet)
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ memset (temp_filenames, '\0', sizeof (temp_filenames));
|
|
|
6f1b0c |
+ new_argv = alloca ((nargs + 2) * sizeof (const char *));
|
|
|
6f1b0c |
+ memcpy (new_argv, argv, (nargs + 1) * sizeof (const char *));
|
|
|
6f1b0c |
+ if (new_argv[out_arg][2] == '\0')
|
|
|
6f1b0c |
+ new_argv[out_arg + 1] = "-";
|
|
|
6f1b0c |
+ else
|
|
|
6f1b0c |
+ new_argv[out_arg] = "-o-";
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS + 1; ++attempt)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ int fd;
|
|
|
6f1b0c |
+ int status;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ temp_filenames[attempt * 2] = make_temp_file (".out");
|
|
|
6f1b0c |
+ temp_filenames[attempt * 2 + 1] = make_temp_file (".err");
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (attempt == RETRY_ICE_ATTEMPTS)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ int i;
|
|
|
6f1b0c |
+ int fd1, fd2;
|
|
|
6f1b0c |
+ struct stat st1, st2;
|
|
|
6f1b0c |
+ size_t n, len;
|
|
|
6f1b0c |
+ char *buf;
|
|
|
6f1b0c |
+ char *cpp0;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ buf = xmalloc (8192);
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ for (i = 0; i < 2; ++i)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ fd1 = open (temp_filenames[i], O_RDONLY);
|
|
|
6f1b0c |
+ fd2 = open (temp_filenames[2 + i], O_RDONLY);
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (fd1 < 0 || fd2 < 0)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ i = -1;
|
|
|
6f1b0c |
+ close (fd1);
|
|
|
6f1b0c |
+ close (fd2);
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (fstat (fd1, &st1) < 0 || fstat (fd2, &st2) < 0)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ i = -1;
|
|
|
6f1b0c |
+ close (fd1);
|
|
|
6f1b0c |
+ close (fd2);
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (st1.st_size != st2.st_size)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ close (fd1);
|
|
|
6f1b0c |
+ close (fd2);
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ len = 0;
|
|
|
6f1b0c |
+ for (n = st1.st_size; n; n -= len)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ len = n;
|
|
|
6f1b0c |
+ if (len > 4096)
|
|
|
6f1b0c |
+ len = 4096;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (read (fd1, buf, len) != (int) len
|
|
|
6f1b0c |
+ || read (fd2, buf + 4096, len) != (int) len)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ i = -1;
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (memcmp (buf, buf + 4096, len) != 0)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ close (fd1);
|
|
|
6f1b0c |
+ close (fd2);
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (n)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ free (buf);
|
|
|
6f1b0c |
+ if (i == -1)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (i != 2)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ fd = open (temp_filenames[attempt * 2], O_RDWR);
|
|
|
6f1b0c |
+ if (fd < 0)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ write (fd, "//", 2);
|
|
|
6f1b0c |
+ for (i = 0; i < nargs; i++)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ write (fd, " ", 1);
|
|
|
6f1b0c |
+ write (fd, new_argv[i], strlen (new_argv[i]));
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ write (fd, "\n", 1);
|
|
|
6f1b0c |
+ cpp0 = alloca (strlen (new_argv[0]) + sizeof "cpp0");
|
|
|
6f1b0c |
+ strcpy (cpp0, new_argv[0]);
|
|
|
6f1b0c |
+ new_argv[0] = cpp0;
|
|
|
6f1b0c |
+ cpp0 = strrchr (new_argv[0], DIR_SEPARATOR);
|
|
|
6f1b0c |
+ if (cpp0 != NULL)
|
|
|
6f1b0c |
+ strcpy (cpp0 + 1, "cpp0");
|
|
|
6f1b0c |
+ new_argv[nargs] = "--ice-hack";
|
|
|
6f1b0c |
+ new_argv[nargs + 1] = NULL;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ /* Fork a subprocess; wait and retry if it fails. */
|
|
|
6f1b0c |
+ sleep_interval = 1;
|
|
|
6f1b0c |
+ pid = -1;
|
|
|
6f1b0c |
+ for (retries = 0; retries < 4; retries++)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ pid = fork ();
|
|
|
6f1b0c |
+ if (pid >= 0)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ sleep (sleep_interval);
|
|
|
6f1b0c |
+ sleep_interval *= 2;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (pid < 0)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ else if (pid == 0)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ if (attempt != RETRY_ICE_ATTEMPTS)
|
|
|
6f1b0c |
+ fd = open (temp_filenames[attempt * 2], O_RDWR);
|
|
|
6f1b0c |
+ if (fd < 0)
|
|
|
6f1b0c |
+ exit (-1);
|
|
|
6f1b0c |
+ if (fd != 1)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ close (1);
|
|
|
6f1b0c |
+ dup (fd);
|
|
|
6f1b0c |
+ close (fd);
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ fd = open (temp_filenames[attempt * 2 + 1], O_RDWR);
|
|
|
6f1b0c |
+ if (fd < 0)
|
|
|
6f1b0c |
+ exit (-1);
|
|
|
6f1b0c |
+ if (fd != 2)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ close (2);
|
|
|
6f1b0c |
+ dup (fd);
|
|
|
6f1b0c |
+ close (fd);
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (prog == new_argv[0])
|
|
|
6f1b0c |
+ execvp (prog, (char *const *) new_argv);
|
|
|
6f1b0c |
+ else
|
|
|
6f1b0c |
+ execv (new_argv[0], (char *const *) new_argv);
|
|
|
6f1b0c |
+ exit (-1);
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (waitpid (pid, &status, 0) < 0)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (attempt < RETRY_ICE_ATTEMPTS
|
|
|
6f1b0c |
+ && (! WIFEXITED (status) || WEXITSTATUS (status) != ICE_EXIT_CODE))
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ notice ("The bug is not reproducible, so it is likely a hardware or OS problem.\n");
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ else if (attempt == RETRY_ICE_ATTEMPTS)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ close (fd);
|
|
|
6f1b0c |
+ if (WIFEXITED (status)
|
|
|
6f1b0c |
+ && WEXITSTATUS (status) == SUCCESS_EXIT_CODE)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ notice ("Preprocessed source stored into %s file, please attach this to your bugreport.\n",
|
|
|
6f1b0c |
+ temp_filenames[attempt * 2]);
|
|
|
6f1b0c |
+ /* Make sure it is not deleted. */
|
|
|
6f1b0c |
+ free (temp_filenames[attempt * 2]);
|
|
|
6f1b0c |
+ temp_filenames[attempt * 2] = NULL;
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ for (attempt = 0; attempt < RETRY_ICE_ATTEMPTS * 2 + 2; attempt++)
|
|
|
6f1b0c |
+ if (temp_filenames[attempt])
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ unlink (temp_filenames[attempt]);
|
|
|
6f1b0c |
+ free (temp_filenames[attempt]);
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+}
|
|
|
6f1b0c |
+#endif
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
/* Search for a file named NAME trying various prefixes including the
|
|
|
6f1b0c |
user's -B prefix and some standard ones.
|
|
|
6f1b0c |
Return the absolute file name found. If nothing is found, return NAME. */
|
|
|
6f1b0c |
--- gcc/diagnostic.c.jj 2002-01-24 23:37:04.000000000 +0100
|
|
|
6f1b0c |
+++ gcc/diagnostic.c 2003-10-03 19:01:24.000000000 +0200
|
|
|
6f1b0c |
@@ -1242,7 +1242,7 @@ internal_error VPARAMS ((const char *msg
|
|
|
6f1b0c |
"Please submit a full bug report,\n\
|
|
|
6f1b0c |
with preprocessed source if appropriate.\n\
|
|
|
6f1b0c |
See %s for instructions.\n", GCCBUGURL);
|
|
|
6f1b0c |
- exit (FATAL_EXIT_CODE);
|
|
|
6f1b0c |
+ exit (ICE_EXIT_CODE);
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
|
|
|
6f1b0c |
void
|
|
|
6f1b0c |
@@ -1392,7 +1392,7 @@ error_recursion ()
|
|
|
6f1b0c |
"Please submit a full bug report,\n\
|
|
|
6f1b0c |
with preprocessed source if appropriate.\n\
|
|
|
6f1b0c |
See %s for instructions.\n", GCCBUGURL);
|
|
|
6f1b0c |
- exit (FATAL_EXIT_CODE);
|
|
|
6f1b0c |
+ exit (ICE_EXIT_CODE);
|
|
|
6f1b0c |
}
|
|
|
6f1b0c |
|
|
|
6f1b0c |
/* Given a partial pathname as input, return another pathname that
|
|
|
6f1b0c |
--- gcc/cppmain.c.jj 2002-05-03 20:19:22.000000000 +0200
|
|
|
6f1b0c |
+++ gcc/cppmain.c 2003-10-06 10:35:15.000000000 +0200
|
|
|
6f1b0c |
@@ -111,10 +111,33 @@ do_preprocessing (argc, argv)
|
|
|
6f1b0c |
char **argv;
|
|
|
6f1b0c |
{
|
|
|
6f1b0c |
int argi = 1; /* Next argument to handle. */
|
|
|
6f1b0c |
+ int ice_hack = 0;
|
|
|
6f1b0c |
|
|
|
6f1b0c |
- argi += cpp_handle_options (pfile, argc - argi , argv + argi);
|
|
|
6f1b0c |
- if (CPP_FATAL_ERRORS (pfile))
|
|
|
6f1b0c |
- return;
|
|
|
6f1b0c |
+ if (argc >= 1 && strcmp (argv[argc - 1], "--ice-hack") == 0)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ ice_hack = 1;
|
|
|
6f1b0c |
+ for (argi = 1; argi + 1 < argc; argi++)
|
|
|
6f1b0c |
+ if (strcmp (argv[argi], "-dumpbase") == 0)
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ argv[argi] = "-quiet";
|
|
|
6f1b0c |
+ argv[argi + 1] = "-quiet";
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ argi = 1;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ do
|
|
|
6f1b0c |
+ {
|
|
|
6f1b0c |
+ argi += cpp_handle_options (pfile, argc - argi, argv + argi);
|
|
|
6f1b0c |
+ if (CPP_FATAL_ERRORS (pfile))
|
|
|
6f1b0c |
+ return;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ if (argi >= argc || !ice_hack)
|
|
|
6f1b0c |
+ break;
|
|
|
6f1b0c |
+
|
|
|
6f1b0c |
+ argi++;
|
|
|
6f1b0c |
+ }
|
|
|
6f1b0c |
+ while (argi < argc);
|
|
|
6f1b0c |
|
|
|
6f1b0c |
if (argi < argc)
|
|
|
6f1b0c |
{
|