This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[gfortran] Disable "long double" real kind on mingw32
- From: FX Coudert <fxcoudert at gmail dot com>
- To: "fortran at gcc dot gnu dot org List" <fortran at gcc dot gnu dot org>, gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 22 Jan 2007 21:54:05 +0100
- Subject: [gfortran] Disable "long double" real kind on mingw32
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:content-transfer-encoding:message-id:content-type:to:from:subject:date:x-mailer; b=VAPc/2iZvN4k/DSsnNXA6XBa9j3hUMVaH7WnpIa3/xFoNEbvhXVcHouqcmyBXZJwemXKR4C+JtVT9sLcmZw/9fZ5lJVDVYJUncNB2sbGSOlgTgQPb3zzULJsqedZeXzVpZK+K3Jd354ZEJ5nOSAJMPBB/zn992NJVtySLh+En+w=
Hi all,
The Windows printf doesn't handle "long double" right, and since this
all floating-point values are passed to the library as long double,
gfortran is unusable on mingw32 if it thinks it has a long double
type. For more than one year, I've been building my gfortran mingw32
binaries with a hack in the front-end not to use them. I'd like to
install that on mainline, by defining a GFORTRAN_WITHOUT_LONGDOUBLE
macro in the mingw32 config file.
Do I need approval for the config/ part of the patch? (it defines a
macro that only the Fortran front-end will use)
Otherwise, and unless someone objects to the following patch in the
next few days, I'll commit it to mainline.
Thanks,
FX
Index: fortran/trans-types.c
===================================================================
--- fortran/trans-types.c (revision 118930)
+++ fortran/trans-types.c (working copy)
@@ -172,8 +172,10 @@
library assumes these are the only floating point types. */
if (mode != TYPE_MODE (float_type_node)
- && (mode != TYPE_MODE (double_type_node))
- && (mode != TYPE_MODE (long_double_type_node)))
+#ifdef GFORTRAN_WITHOUT_LONGDOUBLE
+ && (mode != TYPE_MODE (long_double_type_node))
+#endif
+ && (mode != TYPE_MODE (double_type_node)))
continue;
/* Let the kind equal the precision divided by 8, rounding
up. Again,
Index: config/i386/mingw32.h
===================================================================
--- config/i386/mingw32.h (revision 118930)
+++ config/i386/mingw32.h (working copy)
@@ -116,3 +116,7 @@
/* mingw32 atexit function is safe to use in shared libraries. Use it
to register C++ static destructors. */
#define TARGET_CXX_USE_ATEXIT_FOR_CXA_ATEXIT hook_bool_void_true
+
+/* mingw32 doesn't have proper I/O support for long double. */
+#undef GFORTRAN_WITHOUT_LONGDOUBLE
+#define GFORTRAN_WITHOUT_LONGDOUBLE