public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* optimization/2925: inlined builtins emitted more than once
@ 2001-05-24  7:46 garloff
  0 siblings, 0 replies; only message in thread
From: garloff @ 2001-05-24  7:46 UTC (permalink / raw)
  To: gcc-gnats; +Cc: jan, aj

>Number:         2925
>Category:       optimization
>Synopsis:       inlined builtins emitted more than once
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Thu May 24 07:46:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Kurt Garloff
>Release:        3.0 20010523 (prerelease)
>Organization:
TU/e
>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

	
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
>Description:
	Compiling this little innocent program gives an assembler error,
	if compiled with gcc-3.0 snapshots and optimization turned on.
	
	(The gcc-3.1 branch seems to share the bug, 2.95.x works without
	problems. The bug might have been introduced march or april 2001.)
	
	The assembler complains about the symbol fabs already being defined.
	gcc indeed seems to emit code for fabs() twice. Maybe it gets con-
	fused by the fact that the fn is called once directly and once
	assigned to a fn pointer and used subsequently.
	
>How-To-Repeat:
	garloff@gum07:~/Linux/C $ gcc -O2 -o fabs_inline fabs_inline.cpp -lm
	/tmp/ccyOehYd.s: Assembler messages:
	/tmp/ccyOehYd.s:58: Fatal error: Symbol fabs already defined.
	
	Problem vanishes, if
	* gcc-2.95.x is used  OR
	* -O0 is used         OR
	* the assignment to myfn is commented out.
	
	Prepocessed stuff does not make sense here (the problem occurs
	with all versions of glibc I could find, various kinds of 2.1.3
	and 2.2.2). Here's the program:

/** fabs_inline.cpp
 * trying to reproduce a gcc-3.0 (prerelease) problem
 * WRT inlined std:: builtins
 *
 * Kurt Garloff <kurt@garloff.de>, 5/2001, GNU GPL
 */

#include <cmath>
#include <cstdio>

typedef double (*realfn) (double);

using std::fabs;

int main ()
{
	double a = fabs (-2.4);
	realfn myfn = fabs;
	double b = myfn (-2.5);
	printf ("%f, %f, %p\n", a, b, myfn);
}

>Fix:
	Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-05-24  7:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-24  7:46 optimization/2925: inlined builtins emitted more than once garloff

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).