This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

MODULO regression on 4.1.x branch


Paul, FX,

You need to remove the MODULO patch from the 4.1.x
branch because it is causing a link failure on any
system without a fmodl libm function.  The problem
is that Uros' patch for builtin expansion of fmod[f,l]
has not and probably will not be committed to 4.1.x.

If you want to keep the MODULO patch, then gfortran
needs to supply a fmodl in c99_function.c.  Here's
an untested patch.

Index: intrinsics/c99_functions.c
===================================================================
--- intrinsics/c99_functions.c	(revision 118930)
+++ intrinsics/c99_functions.c	(working copy)
@@ -1159,3 +1159,25 @@ ctanl (long double complex a)
 }
 #endif
 
+#if !defined(HAVE_FMODL)
+#define HAVE_FMODL 1
+long double
+fmodl (long double x, long double y)
+{
+
+  long double ax, ay;
+
+  if (y == 0)
+    return 0;
+
+  ay = fabsl (y);
+  ax = fabsl (x);
+
+  if (ax < ay)
+    return x;
+
+  return copysignl(ax - (floorl (ax / ay)) * ay, x);
+
+}
+#endif
+
Index: configure.ac
===================================================================
--- configure.ac	(revision 118930)
+++ configure.ac	(working copy)
@@ -235,6 +235,7 @@ AC_CHECK_LIB([m],[cexpl],[AC_DEFINE([HAV
 AC_CHECK_LIB([m],[fabsf],[AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
 AC_CHECK_LIB([m],[fabs],[AC_DEFINE([HAVE_FABS],[1],[libm includes fabs])])
 AC_CHECK_LIB([m],[fabsl],[AC_DEFINE([HAVE_FABSL],[1],[libm includes fabsl])])
+AC_CHECK_LIB([m],[fmodl],[AC_DEFINE([HAVE_FMODL],[1],[libm includes fmodl])])
 AC_CHECK_LIB([m],[cabsf],[AC_DEFINE([HAVE_CABSF],[1],[libm includes cabsf])])
 AC_CHECK_LIB([m],[cabs],[AC_DEFINE([HAVE_CABS],[1],[libm includes cabs])])
 AC_CHECK_LIB([m],[cabsl],[AC_DEFINE([HAVE_CABSL],[1],[libm includes cabsl])])
-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]