Article View: gnu.g++.bug
Article #1947Found compiler hang bug
From: Michael Tiemann
Date: Fri, 05 May 1989 03:54
Date: Fri, 05 May 1989 03:54
64 lines
2787 bytes
2787 bytes
Date: 28 Apr 89 03:11:39 GMT
From: schmidt@zola.ics.uci.edu (Doug Schmidt)
Organization: University of California at Irvine: ICS Dept.
References: <8904271456.AA18302@lotus.lotus.com>
Sender: bug-g++-request@prep.ai.mit.edu
In article <8904271456.AA18302@lotus.lotus.com> lotus!steveng@GARP.MIT.EDU (Stephen Ng) writes:
++
++ dear gnu,
++
++ i found a bug that hangs g++ version 1.34.0. it is:
++
++ int foo();
++ class C {
++ friend int foo();
++ };
++
++ bar()
++ {
++ foo();
++ }
++
++
This does not hang with g++ 1.35, although I'm not sure if the message is
correct:
----------------------------------------
g++ bug.c
bug.c:3: friend `foo' implicitly overloaded
bug.c:1: after declaration of non-overloaded `int foo ()'
----------------------------------------
Anyone have any comments?
Doug
--
On a clear day, under blue skies, there is no need to seek.
And asking about Buddha +------------------------+
Is like proclaiming innocence, | schmidt@ics.uci.edu |
With loot in your pocket. | office: (714) 856-4043 |
Here's the straight rap: in the world of cfront 1.2, one had to
declare a function to be overloaded before one could use it as such.
Thus, if the compiler encountered a declaration for an innocent
function like `foo', it would think that foo had C linkage. Friends
are implicitly overloaded, which means that calls to friend functions
would be made via the friend's mangled name. This could lead to
inconsistencies which may or may not show up at link time. GNU C++
makes sure that this does not happen.
In the world of cfront 2.0, all functions which have C++ linkage are
implicitly overloaded. Friends or not, calls to these functions go
through mangled names. Functions which have C linkage go through
unmangled names, overloaded or not (you can't overload a function in
C).
In GNU C++ 1.35.0, the extern "C" and extern "C++" linkage specs will
be recognized, and the 2.0 rules for overloading will apply. This
means that the code above is no longer considered erroneous. However,
the debugger will have to be modified to handle this.
Michael
Technical Details
Message-ID:
<8905050354.AA02767@yahi.stanford.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!YAHI.STANFORD.EDU!tiemannReferences:
<12841@paris.ics.uci.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!YAHI.STANFORD.EDU!tiemann From: tiemann@YAHI.STANFORD.EDU (Michael Tiemann) Newsgroups: gnu.g++.bug Subject: Found compiler hang bug Message-ID: <8905050354.AA02767@yahi.stanford.edu> Date: 5 May 89 03:54:01 GMT References: <12841@paris.ics.uci.edu> Sender: daemon@tut.cis.ohio-state.edu Reply-To: tiemann@lurch.stanford.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 64