This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

diagnostics tweak



The recent bootstrap failure manifested with a rather unhelpful error
sequence:

./xgcc -B./ -B/work/inst/i686-pc-linux-gnu/bin/ -isystem /work/inst/i686-pc-linu
x-gnu/include -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wm
issing-prototypes -isystem ./include  -fPIC -g1 -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
 -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../../gcc_vanilla/gcc -I../../../gcc_van
illa/gcc/. -I../../../gcc_vanilla/gcc/config -I../../../gcc_vanilla/gcc/../inclu
de -fexceptions -c ../../../gcc_vanilla/gcc/unwind-dw2.c -o libgcc/./unwind-dw2.
o
../../../gcc_vanilla/gcc/unwind-dw2.c: In function `execute_stack_op':
../../../gcc_vanilla/gcc/unwind-dw2.c:303: warning: `result' might be used unini
tialized in this function
../../../gcc_vanilla/gcc/unwind-dw2.c: In function `_Unwind_GetGR':
../../../gcc_vanilla/gcc/unwind-dw2.c:1187: confused by earlier errors, bailing 
out

One might be forgiven for thinking "*what* earlier error?!"  In fact I spent
a fair amount of time trying to figure out why warnings counted as errors
for the purpose of ICE suppression.

However, it turns out to have nothing to do with that.  This failure,
as I discussed in my other message, is caused by calling memset()
with a bogus size parameter.  We get a segfault inside memset, but
not before it's trashed the malloc arena.  crash_signal() calls
internal_error(), which bumps errorcount, then tries to allocate
memory.  Malloc segfaults, unsurprisingly, and crash_signal calls
internal_error again.  This time round, errorcount is nonzero and
internal_error gives the "confused by earlier errors" message.

The simplest fix seems to be to stick an explicit check of the
diagnostic_lock at the beginning of internal_error, before we
try for ICE suppression.  This isn't as good as getting the real
error out would be, but I don't see a practical way to do that
given that malloc is kaput.

I might add that I don't think ICE suppression is a good idea,
and that diagnostic.c has a serious baroque-osity problem.

zw

	* diagnostic.c (internal_error): Check for error recursion
	before doing ICE suppression.

===================================================================
Index: diagnostic.c
--- diagnostic.c	2001/08/14 19:22:47	1.66
+++ diagnostic.c	2001/08/16 23:09:36
@@ -1314,6 +1314,9 @@ internal_error VPARAMS ((const char *msg
   msgid = va_arg (ap, const char *);
 #endif
 
+  if (diagnostic_lock)
+    error_recursion ();
+
   if (errorcount > 0 || sorrycount > 0)
     {
       fnotice (stderr, "%s:%d: confused by earlier errors, bailing out\n",


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]