This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran, patch] PR libfortran/21950
- From: FX Coudert <fxcoudert at gmail dot com>
- To: gfortran <fortran at gcc dot gnu dot org>, patch <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 15 Jun 2005 08:01:37 +0200
- Subject: [gfortran, patch] PR libfortran/21950
Attached patch provides a fallback implementation of scalbn for
platforms that don't have it. It allows gfortran to run on Tru64 UNIX
V4.0F, IRIX 5.3 and 6.5.10 (without this patch, libgfortran builds but
gfortran is not usable, since scalbn can't be resolved at linking).
Successfully built on 3 said platforms (see
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21950 for test results), and
built and regtested on i686-linux.
I'm not sure whether it can be considered obvious, but I hope to have a
quick approval since this actually allows gfortran to work on 3 more
platforms.
OK for mainline and 4.0? (and should I wait for 4.0 to reopen or can I
commit this now, trying to make it for 4.0.1?)
FX
Index: libgfortran/c99_protos.h
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/c99_protos.h,v
retrieving revision 1.3
diff -p -u -r1.3 c99_protos.h
--- libgfortran/c99_protos.h 21 May 2005 06:44:48 -0000 1.3
+++ libgfortran/c99_protos.h 15 Jun 2005 05:51:55 -0000
@@ -89,6 +89,10 @@ extern float logf(float);
extern float log10f(float);
#endif
+#ifndef HAVE_SCALBN
+extern double scalbn(double, int);
+#endif
+
#ifndef HAVE_SCALBNF
extern float scalbnf(float, int);
#endif
Index: libgfortran/configure.ac
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/configure.ac,v
retrieving revision 1.27
diff -p -u -r1.27 configure.ac
--- libgfortran/configure.ac 21 May 2005 06:44:50 -0000 1.27
+++ libgfortran/configure.ac 15 Jun 2005 05:51:55 -0000
@@ -201,6 +201,7 @@ AC_CHECK_LIB([m],[powf],[AC_DEFINE([HAVE
AC_CHECK_LIB([m],[round],[AC_DEFINE([HAVE_ROUND],[1],[libm includes round])])
AC_CHECK_LIB([m],[roundf],[AC_DEFINE([HAVE_ROUNDF],[1],[libm includes roundf])])
AC_CHECK_LIB([m],[scalbnf],[AC_DEFINE([HAVE_SCALBNF],[1],[libm includes scalbnf])])
+AC_CHECK_LIB([m],[scalbn],[AC_DEFINE([HAVE_SCALBN],[1],[libm includes scalbn])])
AC_CHECK_LIB([m],[sinf],[AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
AC_CHECK_LIB([m],[sinhf],[AC_DEFINE([HAVE_SINHF],[1],[libm includes sinhf])])
AC_CHECK_LIB([m],[sqrtf],[AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
Index: libgfortran/intrinsics/c99_functions.c
===================================================================
RCS file: /cvsroot/gcc/gcc/libgfortran/intrinsics/c99_functions.c,v
retrieving revision 1.11
diff -p -u -r1.11 c99_functions.c
--- libgfortran/intrinsics/c99_functions.c 21 May 2005 06:44:50 -0000 1.11
+++ libgfortran/intrinsics/c99_functions.c 15 Jun 2005 05:51:55 -0000
@@ -154,6 +154,14 @@ log10f(float x)
}
#endif
+#ifndef HAVE_SCALBN
+double
+scalbn(double x, int y)
+{
+ return x * pow(FLT_RADIX, y);
+}
+#endif
+
#ifndef HAVE_SCALBNF
float
2005-06-15 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/21950
* intrinsics/c99_functions.c (scalbn): Provide fallback
implentation for scalbn.
* c99_protos.h: Prototype for scalbn.
* configure.ac: Add check for scalbn.
* configure: Regenerate.
* config.h.in: Regenerate.