Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Aug 2000 18:28:07 +0200 (CEST)
From:      pfeifer@dbai.tuwien.ac.at
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        pfeifer@dbai.tuwien.ac.at
Subject:   gnu/20966: binutils break C++ in GCC 2.95.x and GCC-current
Message-ID:  <200008311628.SAA55389@taygeta.dbai.tuwien.ac.at>

next in thread | raw e-mail | index | archive | help

>Number:         20966
>Category:       gnu
>Synopsis:       binutils break C++ in GCC 2.95.x and GCC-current
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Aug 31 09:30:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Gerald Pfeifer
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
>Environment:

	FreeBSD deneb.dbai.tuwien.ac.at 4.1-RELEASE FreeBSD 4.1-RELEASE #0:
	Thu Jul 27 04:44:16 GMT 2000
	root@usw4.freebsd.org:/usr/src/sys/compile/GENERIC  i386

>Description:

	[ This is a resend of 20942 which was forwarded to the mailing
	list but then lost by the GNATS machinery. Suggested by sheldonh. ]

	Apparently binutils as of 4.1-RELEASE break static constructors
	in C++ for GCC 2.95.x and GCC-current. Both work fine (w/o FreeBSD
	patches) on FreeBSD 3.x and also GCC 2.95.2 as shipped with
	4.1-RELEASE is fine.

	You'll experience the problem only, if you build GCC by yourself.

	I assume that there is a problem (change) in binutils on 4.1-RELEASE
	that causes this breakage and that has been fixed (also made) in the
	imported version of GCC?

>How-To-Repeat:

	Compile and run the following small C++ program with either GCC 2.95.2
	(original GNU version, w/o FreeBSD patches) or GCC-current and you'll
	get a core dump as the static constructor is not invoked.

	GCC as shipped with 4.1-RELEASE is not affected.

	-------- cut --------
	#include <map>
	#include <iostream>

	struct NAMESTABLE
	    {
	    map<int,int> lookup;

	    NAMESTABLE()
	        : lookup()
	        {
	        cout << "constructor" << endl;
	        }

	    void add(const char *s, const int &item)
	        {
	        cout << s << endl;
	        lookup.insert(pair<int,int>(item,0));
	        }
	    };

	NAMESTABLE q;

	int main() {
	    NAMESTABLE p;
	    p.add("auto",1);
	    q.add("static",1);
	}

>Fix:

	1. Fix (the local copy?) of binutils.
	2. If it is a GCC bug (which I don't believe) that has been fixed in
	   the FreeBSD tree, submit the change back to the GCC maintainers.


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008311628.SAA55389>