Article View: gnu.g++.bug
Article #236pragma interface blocks inlining new-with-placement
From: Doug Moore
Date: Sun, 12 Apr 1992 06:17
Date: Sun, 12 Apr 1992 06:17
55 lines
2307 bytes
2307 bytes
The following program
-------cut here---------
#include <new.h>
class foo
{
public:
int baz;
foo(int b): baz(b) {}
};
main()
{
foo* foop = (foo*) malloc(sizeof(foo));
foop = new {foop} foo(4);
}
-------cut here---------
where new.h comes from libg++-2.0,
does not link successfully.
-------cut here---------
cd /marsh/comp212/.jnkk/
c++ -g -Wall -v bug.cc
Reading specs from /marsh/comp212/lib/gcc-lib/sun4/2.1/specs
gcc version 2.1
/marsh/comp212/lib/gcc-lib/sun4/2.1/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g -Wall bug.cc /usr/tmp/cca14672.i
GNU CPP version 2.1 (sparc)
/marsh/comp212/lib/gcc-lib/sun4/2.1/cc1plus /usr/tmp/cca14672.i -quiet -dumpbase bug.cc -g -Wall -version -o /usr/tmp/cca14672.s
GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
as -o bug.o /usr/tmp/cca14672.s
/marsh/comp212/lib/gcc-lib/sun4/2.1/ld -e start -dc -dp /lib/crt0.o -L/marsh/comp212/lib/gcc-lib/sun4/2.1/ -L/marsh/comp212/lib/ bug.o -lg++ -lm -lgcc -lc -lg -lgcc
ld: Undefined symbol
___nw__FiPv
collect: /usr/bin/ld returned 2 exit status
Compilation exited abnormally with code 1 at Sun Apr 12 01:05:36
-------cut here---------
However, when I comment out the #pragma interface line of new.h, it
does link successfully. The file new.h includes an inline static
definition of the function that is claimed to be undefined.
I am not making the same complaint as the gentleman who complained
that nm showed a particular symbol to be undefined. I am complaining
that inlining does not happen in the presence of #pragma interface, at
least for operator new with placement syntax.
That is why I'm sending this to g++.bug, not to libg++.bug.
Sparc 2. Sunos 4.1. Gcc 2.1, with Tiemann and Stump patches.
Doug Moore
(dougm@cs.rice.edu)
Technical Details
Message-ID:
<9204120617.AA07200@cs.rice.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougmShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.rice.edu!dougm From: dougm@cs.rice.edu (Doug Moore) Subject: pragma interface blocks inlining new-with-placement Message-ID: <9204120617.AA07200@cs.rice.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sun, 12 Apr 1992 06:17:12 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 57