Bug 6955 - collect2 says "core dumped" when there is no core
Summary: collect2 says "core dumped" when there is no core
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 3.1
: P3 normal
Target Milestone: ---
Assignee: Kaveh Ghazi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-06-07 05:56 UTC by Bruno Haible
Modified: 2010-10-27 16:56 UTC (History)
7 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: sparc64-unknown-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Haible 2002-06-07 05:56:04 UTC
When ld, called by collect2, crashes without a core dump, collect2 says

collect2: ld terminated with signal 11 [Segmentation fault], core dumped

But when I set "ulimit -c unlimited" and repeat the step, so that I
get a core dump, collect2 says merely

collect2: ld terminated with signal 11 [Segmentation fault]

Release:
3.1

Environment:
System: Linux linuix 2.4.18-4GB #1 Wed Mar 27 13:57:05 UTC 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: sparc64-unknown-linux-gnu
configured with: /packages2/gcc-3.1/configure --enable-shared --disable-nls --target=sparc64-linux --prefix=/cross/sparc64-linux-tools --with-local-prefix=/cross/sparc64-linux/local --with-as=/cross/sparc64-linux-tools/bin/sparc64-linux-as --with-gnu-as --with-ld=/cross/sparc64-linux-tools/bin/sparc64-linux-ld --with-gnu-ld --enable-languages=c

How-To-Repeat:
Give a link command line that makes ld crash. Once with "ulimit -c 0",
once with "ulimit -c unlimited".
Comment 1 Bruno Haible 2002-06-07 05:56:04 UTC
Fix:
In collect2.c, function collect_wait, change

  status & 0200 ? "" : ", core dumped"

to

  status & 0200 ? ", core dumped" : ""
Comment 2 Kaveh Ghazi 2003-03-24 22:15:46 UTC
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: bangerth@dealii.org, bruno@clisp.org, gcc-bugs@gcc.gnu.org,
        gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org, gcc-prs@gcc.gnu.org,
        ghazi@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Mon, 24 Mar 2003 22:15:46 -0500 (EST)

  > 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

Comment 3 Wolfgang Bangerth 2003-03-25 02:17:15 UTC
Responsible-Changed-From-To: unassigned->ghazi
Responsible-Changed-Why: 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?
    
    Thanks
      Wolfgang
Comment 4 Wolfgang Bangerth 2003-03-25 09:40:30 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
Cc: bruno@clisp.org, <gcc-bugs@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>,
   <gcc-patches@gcc.gnu.org>
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Tue, 25 Mar 2003 09:40:30 -0600 (CST)

 >  >     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?
 > 
 > Eh?  I don't recall filing or modifying this PR.  How did you
 > determine I was responsible?
 
 I _made_ you responsible :-) You weren't in any legal sense, I just looked 
 at the output of "cvs annotate" to find out that you were the one who 
 checked in the lines of question. This is by now one of the less 
 successless ways to get patches in PRs reviewed ;-)
 
 At any rate, if the patch goes in, drop me a note and I'll be happy to 
 close the report.
 
 Thanks for the quick reply!
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 

Comment 5 Wolfgang Bangerth 2003-03-25 11:00:33 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
Cc: bruno@clisp.org, <gcc-bugs@gcc.gnu.org>, <gcc-gnats@gcc.gnu.org>,
   <gcc-patches@gcc.gnu.org>
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Tue, 25 Mar 2003 11:00:33 -0600 (CST)

 >  > I _made_ you responsible :-) You weren't in any legal sense, I just looked 
 >  > at the output of "cvs annotate" to find out that you were the one who 
 >  > checked in the lines of question.
 > 
 > I hate to be a pedant, but now honor is at stake. :-)
 
 Uh, this is getting out of hand -- I just wanted to get someone to review
 the patch... But then we both live in a country where the end seems to
 justify the means, so I would say I succeeded and my approach was
 justified ;-) (No WMD found while searching CVS, though.)
 
 And, by the way -- note my ingenious (and mostly unconscious) choice of 
 words: I just said that you "checked in" these lines, not "broke" or 
 "botched up"...
 
 > I honestly don't think I introduced this error.  Looking back at the
 > cvs logs, it came in through one of the many infamous gcc2 merges.  It
 > came in over four years ago: "Merge in gcc2 snapshot 19980929".
 
 Well, the line we are talking about is collect2.c:1511. This line has time 
 stamp 1999-11-25, CVS version 1.87, which was your commit. Now, I 
 acknowledge that if I had checked more carefully, then I'd have seen that 
 your patch only preserved existing (wrong) behavior, but I haven't found a 
 way to get the equivalent of cvs annotate of past versions to see who 
 really introduced this.
 
 At any rate, I take back any non-intended blame, hereby fully rehabilitate 
 your honor and assume all guilt myself. Let the patch go in! (I think it 
 qualifies as "obvious".)
 
 Thanks
  Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 

Comment 6 Kaveh Ghazi 2003-03-25 11:43:25 UTC
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: bangerth@ticam.utexas.edu
Cc: bruno@clisp.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
        gcc-patches@gcc.gnu.org
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Tue, 25 Mar 2003 11:43:25 -0500 (EST)

  > From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
  > 
  > >  >     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?
  > > 
  > > Eh?  I don't recall filing or modifying this PR.  How did you
  > > determine I was responsible?
  > 
  > I _made_ you responsible :-) You weren't in any legal sense, I just looked 
  > at the output of "cvs annotate" to find out that you were the one who 
  > checked in the lines of question. This is by now one of the less 
  > successless ways to get patches in PRs reviewed ;-)
 
 I hate to be a pedant, but now honor is at stake. :-)
 
 I honestly don't think I introduced this error.  Looking back at the
 cvs logs, it came in through one of the many infamous gcc2 merges.  It
 came in over four years ago: "Merge in gcc2 snapshot 19980929".
 
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/collect2.c.diff?r1=1.62&r2=1.63
 
 --
 Kaveh R. Ghazi			ghazi@caip.rutgers.edu

Comment 7 Mike Stump 2003-03-25 12:59:09 UTC
From: Mike Stump <mrs@apple.com>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>, bruno@clisp.org,
   gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Tue, 25 Mar 2003 12:59:09 -0800

 On Tuesday, March 25, 2003, at 09:00 AM, Wolfgang Bangerth wrote:
 > Well, the line we are talking about is collect2.c:1511. This line has 
 > time
 > stamp 1999-11-25, CVS version 1.87, which was your commit. Now, I
 > acknowledge that if I had checked more carefully, then I'd have seen 
 > that
 > your patch only preserved existing (wrong) behavior, but I haven't 
 > found a
 > way to get the equivalent of cvs annotate of past versions to see who
 > really introduced this.
 
 cvs diff will tell you.  From there, cvs log and look at the comment 
 and the date of the change, and from there, it's back the the ChangeLog 
 entry.  Also, the old gcc RCS files can be found on the web site, and 
 can be used to track down things past an old  gcc import.
 

Comment 8 joern.rennecke 2003-03-25 20:32:55 UTC
From: Joern Rennecke <joern.rennecke@superh.com>
To: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
Cc: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>, bruno@clisp.org,
   gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: cvs annotate (Was: Re: other/6955: collect2 says "core dumped" when 
 there is no core)
Date: Tue, 25 Mar 2003 20:32:55 +0000

 > Well, the line we are talking about is collect2.c:1511. This line has time
 > stamp 1999-11-25, CVS version 1.87, which was your commit. Now, I
 > acknowledge that if I had checked more carefully, then I'd have seen that
 > your patch only preserved existing (wrong) behavior, but I haven't found a
 > way to get the equivalent of cvs annotate of past versions to see who
 > really introduced this.
 
 cvs annotate -r 1.86
 
 repeat with previous version till you find the relevant change (or hit 1.1 ,
 at which point you'll have to resort to the old rcs archives)
 
 -- 
 --------------------------
 SuperH (UK) Ltd.
 2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
 T:+44 1454 465658

Comment 9 Mark Mitchell 2003-03-30 11:19:06 UTC
From: Mark Mitchell <mark@codesourcery.com>
To: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
Cc: bangerth@ices.utexas.edu, bruno@clisp.org, gcc-bugs@gcc.gnu.org,
   gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org,
   gdr@integrable-solutions.net
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: 30 Mar 2003 11:19:06 -0800

 > OK for 3.3 and 3.2?
 
 Yes for 3.3.
 
 -- 
 Mark Mitchell
 CodeSourcery, LLC
 mark@codesourcery.com
 

Comment 10 Kaveh Ghazi 2003-03-30 14:07:12 UTC
From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
To: bangerth@ices.utexas.edu
Cc: bruno@clisp.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
        gcc-patches@gcc.gnu.org, gdr@integrable-solutions.net,
        mark@codesourcery.com
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: Sun, 30 Mar 2003 14:07:12 -0500 (EST)

  > From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
  > 
  > Let the patch go in! (I think it qualifies as "obvious".)
  > Thanks
  >  Wolfgang
 
 Well, "obvious" patches still should be tested somehow.  I figured out
 a way.  After compiling gcc, I replaced "ld" with a shell script like
 so, alternately replacing SEGV with TERM to control whether to
 create a core from "ld".
 
  > #!/bin/bash
  > kill -SEGV $$
 
 I verified that the current compiler's error message is wrong, and the
 patch fixes it.
 
 So I went ahead and installed it on the mainline as "obvious".
 
 Since this PR is a regression (albeit a minor one regarding an error
 message,) I'd like to get it into the branches if possible.
 
 OK for 3.3 and 3.2?
 http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02151.html
 
 		Thanks,
 		--Kaveh
 --
 Kaveh R. Ghazi			ghazi@caip.rutgers.edu

Comment 11 Kaveh Ghazi 2003-03-30 19:01:58 UTC
From: ghazi@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/6955
Date: 30 Mar 2003 19:01:58 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	ghazi@gcc.gnu.org	2003-03-30 19:01:58
 
 Modified files:
 	gcc            : ChangeLog system.h collect2.c 
 
 Log message:
 	PR other/6955
 	* collect2.c (collect_wait): Use WCOREDUMP and fix output message.
 	* system.h (WCOREDUMP, WCOREFLG): Define if necessary.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17253&r2=1.17254
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/system.h.diff?cvsroot=gcc&r1=1.142&r2=1.143
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/collect2.c.diff?cvsroot=gcc&r1=1.146&r2=1.147
 

Comment 12 Gabriel Dos Reis 2003-03-30 21:44:37 UTC
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>
Cc: bangerth@ices.utexas.edu, bruno@clisp.org, gcc-bugs@gcc.gnu.org,
   gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org, mark@codesourcery.com
Subject: Re: other/6955: collect2 says "core dumped" when there is no core
Date: 30 Mar 2003 21:44:37 +0200

 "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu> writes:
 
 [...]
 
 | Since this PR is a regression (albeit a minor one regarding an error
 | message,) I'd like to get it into the branches if possible.
 | 
 | OK for 3.3 and 3.2?
 
 Yes, it is OK.  Thank you very much for your effort.
 
 -- Gaby

Comment 13 Kaveh Ghazi 2003-03-31 01:12:21 UTC
From: ghazi@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/6955
Date: 31 Mar 2003 01:12:21 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	ghazi@gcc.gnu.org	2003-03-31 01:12:20
 
 Modified files:
 	gcc            : ChangeLog system.h collect2.c 
 
 Log message:
 	PR other/6955
 	* collect2.c (collect_wait): Use WCOREDUMP and fix output message.
 	* system.h (WCOREDUMP, WCOREFLG): Define if necessary.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.383&r2=1.16114.2.384
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/system.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.133&r2=1.133.4.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/collect2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.142&r2=1.142.4.1
 

Comment 14 Kaveh Ghazi 2003-03-31 01:14:02 UTC
From: ghazi@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: other/6955
Date: 31 Mar 2003 01:14:02 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	ghazi@gcc.gnu.org	2003-03-31 01:14:02
 
 Modified files:
 	gcc            : ChangeLog system.h collect2.c 
 
 Log message:
 	PR other/6955
 	* collect2.c (collect_wait): Use WCOREDUMP and fix output message.
 	* system.h (WCOREDUMP, WCOREFLG): Define if necessary.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.295&r2=1.13152.2.657.2.296
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/system.h.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.119.2.1.2.1&r2=1.119.2.1.2.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/collect2.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.133.6.1&r2=1.133.6.2
 
Comment 15 Kaveh Ghazi 2003-03-31 01:24:31 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed here:
    http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02151.html