public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/3377: missing std::__cmath_power<double>(double,unsigned)
@ 2001-06-22 11:06 garloff
  0 siblings, 0 replies; 2+ messages in thread
From: garloff @ 2001-06-22 11:06 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3377
>Category:       libstdc++
>Synopsis:       missing std::__cmath_power<double>(double,unsigned)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 22 11:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Kurt Garloff
>Release:        3.0.1 20010620 (prerelease)
>Organization:
TU/e, SuSE
>Environment:
System: Linux gum07.etpnet.phys.tue.nl 2.4.0-test13-pre3 #18 Sat Dec 23 00:22:26 CET 2000 i686 unknown
Architecture: i686
Libraries: glibc-2.1.3
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --with-gcc-version-trigger=/usr/src/gcc-2.96/gcc/version.c --host=i686-pc-linux-gnu --prefix=/usr/src/i686-pc-gcc297 --enable-shared --with-gnu-as --with-gnu-ld --enable-haifa --with-system-zlib : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured)  : (reconfigured) 
>Description:
	http://gcc.gnu.org/ml/gcc/2001-06/msg01190.html
	compiling my templated C++ numeric library with gcc-3.0.0, I use
	-fno-implicit-templates to prevent multiple instantiations and explicitly
	instantiate all the templates that are supposed to be in the library.
	I stumbled across this:
	../lina/bin-ix86/libtbcidouble.so: undefined reference to double
	std::__cmath_power<double>(double, unsigned)' I'm rather sure this
	is a bug: -fno-implicit-templates is not supposed to
	change the underlying C++ std library, is it?
	
	The compiler probably can't just ignore the flag for included C++ std
	headers, but then, those symbols should be (weakly) present in libstdc++.so.
	At least for the templates only used internally.
>How-To-Repeat:
	Compile this program with -fno-inline-functions
/** cmath_pow.cc
 * 
 * Trying to reproduce linking  errors for
 * double std::__cmath_power<double>(double, unsigned)
 * in gcc-3.0.0, if -fno=implicit-templates is used.
 * The flag also affects the internally used (invisible) templates 
 * from the C++ std library :-( and at least std::__cmath_power
 * is missing from libstdc++.so.
 *
 * (c) Kurt Garloff, garloff@suse.de, 2001-06-20, GNU GPL
 * 
 * Compile with g++ -o cmath_pow cmath_pow.cc -fno-implicit-templates
 * 
 */

#include <cstdlib>
#include <cstdio>
#include <cmath>

namespace testns {
template <typename T>
double our_pow (const T v, const int pw)
{
	return std::pow ((double)v, pw);
};
};


// Explicitly instantiate (needed because -fno-implicit-templates)
namespace testns {
template double our_pow<long> (const long, const int);
};

int main (int argc, char* argv[])
{
	long int arg = 2; int pw = 4;
	if (argc >= 2)
		arg = std::atol (argv[1]);
	if (argc >= 3)
		pw = std::atol (argv[2]);
	long int res = (long int) testns::our_pow (arg, pw);
	std::printf ("%li\n", res);
	return 0;
}

// The problem ...
#ifdef WORKAROUND
template double std::__cmath_power<double>(double, unsigned);
#endif

>Fix:
	Workaround:
	Add -DWORKAROUND to the compiler switches.
	
	Fix:
	Add the needed std::__cmath_power<*>(*,unsigned)
	to libstdc++.
	
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libstdc++/3377: missing std::__cmath_power<double>(double,unsigned)
@ 2001-06-26 11:11 pme
  0 siblings, 0 replies; 2+ messages in thread
From: pme @ 2001-06-26 11:11 UTC (permalink / raw)
  To: garloff, gcc-bugs, gcc-prs, nobody, pme

Synopsis: missing std::__cmath_power<double>(double,unsigned)

Responsible-Changed-From-To: unassigned->pme
Responsible-Changed-By: pme
Responsible-Changed-When: Tue Jun 26 11:10:59 2001
Responsible-Changed-Why:
    Because.
State-Changed-From-To: open->closed
State-Changed-By: pme
State-Changed-When: Tue Jun 26 11:10:59 2001
State-Changed-Why:
    
    Fixed with
    http://gcc.gnu.org/ml/libstdc++/2001-06/msg00435.html ;
    submitter reports success.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3377&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-26 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-22 11:06 libstdc++/3377: missing std::__cmath_power<double>(double,unsigned) garloff
2001-06-26 11:11 pme

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).