other/6955: collect2 says "core dumped" when there is no core

Kaveh R. Ghazi ghazi@caip.rutgers.edu
Tue Mar 25 05:59:00 GMT 2003


 > From: bangerth@dealii.org
 > 
 >     Kaveh, you inserted the lines in question in this PR some
 >     3.5 years ago. Would you mind to take a brief look at this
 >     report and its 1-line patch?
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6955

Eh?  I don't recall filing or modifying this PR.  How did you
determine I was responsible?

Anyway, the patch (or suggested change) in there looks technically
correct to me.  But I would instead do something like the patch below.

(I'm not sure how to test it since I don't have code any handy that
causes ld to crash.)

		--Kaveh


2003-03-24  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	PR other/6955
	* collect2.c (collect_wait): Use WCOREDUMP and fix output message.
	* system.h (WCOREDUMP, WCOREFLG): Define if necessary.

diff -rup orig/egcc-3.2-CVS20030323/gcc/collect2.c egcc-3.2-CVS20030323/gcc/collect2.c
--- orig/egcc-3.2-CVS20030323/gcc/collect2.c	Fri Aug 16 16:02:01 2002
+++ egcc-3.2-CVS20030323/gcc/collect2.c	Mon Mar 24 22:02:35 2003
@@ -1522,7 +1522,7 @@ collect_wait (prog)
 	  int sig = WTERMSIG (status);
 	  error ("%s terminated with signal %d [%s]%s",
 		 prog, sig, strsignal(sig),
-		 status & 0200 ? "" : ", core dumped");
+		 WCOREDUMP(status) ? ", core dumped" : "");
 	  collect_exit (FATAL_EXIT_CODE);
 	}
 
diff -rup orig/egcc-3.2-CVS20030323/gcc/system.h egcc-3.2-CVS20030323/gcc/system.h
--- orig/egcc-3.2-CVS20030323/gcc/system.h	Tue May 21 19:44:39 2002
+++ egcc-3.2-CVS20030323/gcc/system.h	Mon Mar 24 21:59:44 2003
@@ -266,6 +266,12 @@ extern int errno;
 #ifndef WSTOPSIG
 #define WSTOPSIG WEXITSTATUS
 #endif
+#ifndef WCOREDUMP
+#define WCOREDUMP(S) ((S) & WCOREFLG)
+#endif
+#ifndef WCOREFLG
+#define WCOREFLG 0200
+#endif
 
 /* The HAVE_DECL_* macros are three-state, undefined, 0 or 1.  If they
    are defined to 0 then we must provide the relevant declaration



More information about the Gcc-bugs mailing list