Bug 16137 - Fortran compiler unable to produce executables as libfortran depends on C99 math functions
Summary: Fortran compiler unable to produce executables as libfortran depends on C99 m...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libfortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-22 11:10 UTC by Eric Botcazou
Modified: 2004-09-26 15:15 UTC (History)
2 users (show)

See Also:
Host:
Target: sparc*-sun-solaris2.[5-9]
Build:
Known to work:
Known to fail:
Last reconfirmed: 2004-06-22 15:34:41


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Botcazou 2004-06-22 11:10:45 UTC
Every testcase in gfortran.fortran-torture/execute fails to link with:

Undefined                       first referenced
 symbol                             in file
expf                               
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
cosf                               
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
atan2f                             
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
isinf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
sqrtf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
coshf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
nextafterf                         
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
sinf                               
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
scalbnf                            
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
atanf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
log10f                             
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
logf                               
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
sinhf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
acosf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
frexpf                             
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
copysignf                          
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
ceilf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
tanhf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
tanf                               
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
asinf                              
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
hypotf                             
/opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
ld: fatal: Symbol referencing errors. No output written to
/opt/build/eric/gcc/gcc/testsuite/adjustr.x

I guess something along the lines of libstdc++-v3/linkage.m4 would be needed.
Comment 1 Andrew Pinski 2004-06-22 15:34:41 UTC
IIRC Solaris 10 has the math functions but I could be wrong.
Comment 2 Rainer Orth 2004-06-23 12:19:20 UTC
Subject: Re:  New: Fortran compiler unable to produce executables

"ebotcazou at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

> Every testcase in gfortran.fortran-torture/execute fails to link with:
> 
> Undefined                       first referenced
>  symbol                             in file
> expf                               
> /opt/build/eric/gcc/sparc-sun-solaris2.8/./libgfortran/.libs/libgfortran.so
[...]

I already mentioned this in

	http://gcc.gnu.org/ml/fortran/2004-05/msg00259.html

but failed to provide a proper bug report due to many other problems with
libgfortran on all of my platforms.

> I guess something along the lines of libstdc++-v3/linkage.m4 would be needed.

Certainly: libgfortran cannot unconditionally assume the presence of a ISO
C99 C library, or else it would be useless with all but recent versions of
glibc.

	Rainer
Comment 3 Steve Kargl 2004-06-24 04:54:47 UTC
Rainer,

gfortran works on FreeBSD, which does not use glibc.  In fact, if
you are using a glibc that permits gfortran to run, then you may be
using code that may infringe on SunPro's copyright in fdlibm.

On the other hand, you have a point that gfortran should not 
unconditionally assume a C99 compiler.  Indeed, Bud Davis
recently committed c99-functions.c to provide a compatibility
shim.  If you have any patches, please send then to fortran@

Comment 4 Rainer Orth 2004-06-24 17:35:08 UTC
Subject: Re:  Fortran compiler unable to produce executables as libfortran depends on C99 math functions

"sgk at troutmask dot apl dot washington dot edu" <gcc-bugzilla@gcc.gnu.org> writes:

> gfortran works on FreeBSD, which does not use glibc.  In fact, if

... and it probably would on other platforms which include a full ISO C99
libc.  Unfortunately, of the platforms I regularly work on (Solaris 2,
Tru64 UNIX, IRIX), only Solaris 10 and IRIX 6.5.18+ have an ISO C99 libc,
and even that one isn't fully usable with GCC due to the use of
vendor-compiler specific builtins in the system headers.  I wasn't fully
aware about the situation with the various BSDs; thanks for setting me
straight.

> On the other hand, you have a point that gfortran should not 
> unconditionally assume a C99 compiler.  Indeed, Bud Davis
> recently committed c99-functions.c to provide a compatibility
> shim.  If you have any patches, please send then to fortran@

Not at the moment: time for gcc work is far too limited right now, and I
stopped including gfortran when it either wouldn't even build on my
platforms for various reasons (mostly mentioned in PRs) or all test cases
failed with link failures.

	Rainer
Comment 5 GCC Commits 2004-08-03 13:28:31 UTC
Subject: Bug 16137

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-08-03 13:28:26

Modified files:
	libgfortran    : ChangeLog configure.ac config.h.in configure 
	libgfortran/intrinsics: c99_functions.c 

Log message:
	PR libgfortran/16137
	* configure.ac: Add tests for acosf, asinf, atan2f, atanf, ceilf,
	copysignf, cosf, coshf, expf, floorf, frexpf, hypotf, logf, log10f,
	scalbnf, sinf, sinhf, sqrtf, tanf and tanhf in libm.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	
	* instrinsics/c99_functions.c (acosf, asinf, atan2f, atanf, ceilf,
	copysignf, cosf, coshf, expf, floorf, frexpf, hypotf, logf, log10f,
	nextafterf, scalbnf, sinf, sinhf, sqrtf, tanf, tanhf): New stub
	implementations for targets that don't support C99 float functions.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.52&r2=1.53
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.ac.diff?cvsroot=gcc&r1=1.6&r2=1.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/config.h.in.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/c99_functions.c.diff?cvsroot=gcc&r1=1.2&r2=1.3

Comment 6 Andrew Pinski 2004-08-03 14:46:39 UTC
This should be fixed, Can you try again?
Comment 7 Tobias Schlüter 2004-08-23 13:44:19 UTC
Eric, any news on this?
Comment 8 Andrew Pinski 2004-08-31 06:08:43 UTC
Fixed if not please reopen the bug.
Comment 9 Eric Botcazou 2004-09-08 07:30:59 UTC
> Eric, any news on this?

Sorry for the delay.  I confirm that the gfortran.fortran-torture/execute
testsuite is in much better shape now (8 failures) on sparc-sun-solaris2.8.
Comment 10 Eric Botcazou 2004-09-26 07:11:17 UTC
I missed one remaining failure:

FAIL: gfortran.fortran-torture/execute/power.f90 compilation,  -O0

gax% gcc/gfortran -Bgcc power.f90 -L sparc-sun-solaris2.8/libgfortran/.libs
Undefined                       first referenced
 symbol                             in file
powf                                /var/tmp//cc4jBQPc.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
Comment 11 GCC Commits 2004-09-26 14:52:06 UTC
Subject: Bug 16137

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2004-09-26 14:52:04

Modified files:
	libgfortran    : ChangeLog config.h.in configure.ac configure 
	libgfortran/intrinsics: c99_functions.c 

Log message:
	PR libfortran/16137
	* config.h.in (HAVE_POWF): Undefine.
	* configure.ac: Check for 'powf' in library.
	* configure: Regenerate.
	* intrinsics/c99_functions.c (powf): New function.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&r1=1.93&r2=1.94
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/config.h.in.diff?cvsroot=gcc&r1=1.8&r2=1.9
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.ac.diff?cvsroot=gcc&r1=1.10&r2=1.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/configure.diff?cvsroot=gcc&r1=1.14&r2=1.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/intrinsics/c99_functions.c.diff?cvsroot=gcc&r1=1.4&r2=1.5

Comment 12 Tobias Schlüter 2004-09-26 14:54:25 UTC
I'm fairly confident that this is fixed now. Correct me if I'm wrong, Eric. :-)