standard and @code{C_PTRDIFF_T} of TS 29113, GNU Fortran provides as an
extension named constants for the 128-bit integer types supported by the
C compiler: @code{C_INT128_T, C_INT_LEAST128_T, C_INT_FAST128_T}.
-Furthermore, if @code{__float128} is supported in C, the named constants
-@code{C_FLOAT128, C_FLOAT128_COMPLEX} are defined.
+Furthermore, if @code{_Float128} is supported in C, the named constants
+@code{C_FLOAT128} and @code{C_FLOAT128_COMPLEX} are defined.
@multitable @columnfractions .15 .35 .35 .35
@headitem Fortran Type @tab Named constant @tab C type @tab Extension
@item @code{REAL} @tab @code{C_FLOAT} @tab @code{float}
@item @code{REAL} @tab @code{C_DOUBLE} @tab @code{double}
@item @code{REAL} @tab @code{C_LONG_DOUBLE} @tab @code{long double}
-@item @code{REAL} @tab @code{C_FLOAT128} @tab @code{__float128} @tab Ext.
+@item @code{REAL} @tab @code{C_FLOAT128} @tab @code{_Float128} @tab Ext.
@item @code{COMPLEX}@tab @code{C_FLOAT_COMPLEX} @tab @code{float _Complex}
@item @code{COMPLEX}@tab @code{C_DOUBLE_COMPLEX}@tab @code{double _Complex}
@item @code{COMPLEX}@tab @code{C_LONG_DOUBLE_COMPLEX}@tab @code{long double _Complex}
-@item @code{REAL} @tab @code{C_FLOAT128_COMPLEX} @tab @code{__float128 _Complex} @tab Ext.
+@item @code{COMPLEX}@tab @code{C_FLOAT128_COMPLEX} @tab @code{_Float128 _Complex} @tab Ext.
@item @code{LOGICAL}@tab @code{C_BOOL} @tab @code{_Bool}
@item @code{CHARACTER}@tab @code{C_CHAR} @tab @code{char}
@end multitable
get_real_kind_from_node (long_double_type_node), GFC_STD_F2003)
/* GNU Extension. Note that the equivalence here is specifically to
- the IEEE 128-bit type __float128; if that does not map onto a type
+ the IEEE 128-bit type _Float128; if that does not map onto a type
otherwise supported by the Fortran front end, get_real_kind_from_node
will reject it as unsupported. */
NAMED_REALCST (ISOCBINDING_FLOAT128, "c_float128", \
if (gfc_real_kinds[i].c_float128)
{
- /* For __float128, the story is a bit different, because we return
+ /* For _Float128, the story is a bit different, because we return
a decl to a library function rather than a built-in. */
gfc_intrinsic_map_t *m;
for (m = gfc_intrinsic_map; m->double_built_in != double_built_in ; m++)
resprec = TYPE_PRECISION (restype);
/* Depending on the type of the result, choose the int intrinsic (iround,
- available only as a builtin, therefore cannot use it for __float128), long
+ available only as a builtin, therefore cannot use it for _Float128), long
int intrinsic (lround family) or long long intrinsic (llround). If we
don't have an appropriate function that converts directly to the integer
type (such as kind == 16), just use ROUND, and then convert the result to
if (gfc_real16_is_float128)
{
/* If we have soft-float types, we create the decls for their
- C99-like library functions. For now, we only handle __float128
+ C99-like library functions. For now, we only handle _Float128
q-suffixed functions. */
tree type, complex_type, func_1, func_2, func_cabs, func_frexp;
/* The following flags give us information on the correspondence of
real (and complex) kinds with C floating-point types long double
- and __float128. */
+ and _Float128. */
extern bool gfc_real16_is_float128;
enum gfc_packed {
#include <stdbool.h>
#include <stdio.h>
#include <math.h>
-#include <quadmath.h>
#include <ISO_Fortran_binding.h>
#define CMPLXL(x, y) ((long double complex)((long double)(x) + (long double complex)I * (long double)(y)))
#undef CMPLX
-#define CMPLX(x, y) ((__complex128 )((double)(x) + (double complex)I * (double)(y)))
+#define CMPLX(x, y) ((_Float128 _Complex )((double)(x) + (double complex)I * (double)(y)))
#define N 11
#define M 7
typedef float _Complex c_float_complex;
typedef double _Complex c_double_complex;
typedef long double _Complex c_long_double_complex;
-typedef __complex128 c_float128_complex;
+typedef _Float128 _Complex c_float128_complex;
bool c_vrfy_c_float_complex (const CFI_cdesc_t *restrict);
! { dg-do run { xfail { { x86_64*-*-* i?86*-*-* } && longdouble128 } } }
! { dg-additional-sources PR100914.c }
! { dg-require-effective-target fortran_real_c_float128 }
+! { dg-additional-options "-Wno-pedantic" }
!
! Test the fix for PR100914
!
ctest (CFI_cdesc_t *arg_float128,
CFI_cdesc_t *arg_complex128)
{
- check (arg_float128, sizeof (__float128), CFI_type_float128);
- check (arg_complex128, sizeof (__float128) * 2,
+ check (arg_float128, sizeof (_Float128), CFI_type_float128);
+ check (arg_complex128, sizeof (_Float128) * 2,
CFI_type_float128_Complex);
}
{
/* Extension types.
Note there is no portable C equivalent type for CFI_type_ucs4_char type
- (4-byte Unicode characters), and GCC rejects "__float128 _Complex",
- so this is kind of hacky... */
+ (4-byte Unicode characters), so this is kind of hacky... */
#if CFI_type_int128_t > 0
{ CFI_type_int128_t, "CFI_type_int128_t",
sizeof (__int128), 1 },
#endif
#if CFI_type_float128 > 0
{ CFI_type_float128, "CFI_type_float128",
- sizeof (__float128), 1 },
+ sizeof (_Float128), 1 },
{ CFI_type_float128_Complex, "CFI_type_float128_Complex",
- sizeof (__float128) * 2, 1 },
+ sizeof (_Float128 _Complex), 1 },
#endif
#if CFI_type_cfunptr > 0
{ CFI_type_cfunptr, "CFI_type_cfunptr",
ctest (CFI_cdesc_t *arg_float128,
CFI_cdesc_t *arg_complex128)
{
- check (arg_float128, sizeof (__float128), CFI_type_float128);
- check (arg_complex128, sizeof (__float128) * 2,
+ check (arg_float128, sizeof (_Float128), CFI_type_float128);
+ check (arg_complex128, sizeof (_Float128) * 2,
CFI_type_float128_Complex);
}
# Return 1 if the target supports Fortran real kind C_FLOAT128,
# 0 otherwise. This differs from check_effective_target_fortran_real_16
-# because __float128 has the additional requirement that it be the
-# 128-bit IEEE encoding; even if __float128 is available in C, it may not
+# because _Float128 has the additional requirement that it be the
+# 128-bit IEEE encoding; even if _Float128 is available in C, it may not
# have a corresponding Fortran kind on targets (PowerPC) that use some
# other encoding for long double/TFmode/real(16).
proc check_effective_target_fortran_real_c_float128 { } {
#define CFI_type_long_double (CFI_type_Real + (10 << CFI_type_kind_shift))
#define CFI_type_long_double_Complex (CFI_type_Complex + (10 << CFI_type_kind_shift))
-/* This is the IEEE 128-bit encoding, same as float128. */
+/* This is the IEEE 128-bit encoding, same as _Float128. */
#elif (__CFI_LDBL_MANT_DIG__ == 113 \
&& __CFI_LDBL_MIN_EXP__ == -16381 \
&& __CFI_LDBL_MAX_EXP__ == 16384)
#error "Can't determine kind of long double"
#endif
-/* Similarly for __float128. This always refers to the IEEE encoding
+/* Similarly for _Float128. This always refers to the IEEE encoding
and not some other 128-bit representation, so if we already used
kind 16 for a non-IEEE representation, this one must be unsupported
in Fortran even if it's available in C. */
elem_len and not the kind, we get into trouble with long double kinds
that do not correspond directly to the elem_len, specifically the
kind 10 80-bit long double on x86 targets. On x86_64, this has size
- 16 and cannot be differentiated from true __float128. Prefer the
+ 16 and cannot be differentiated from true _Float128. Prefer the
standard long double type over the GNU extension in that case. */
if (d->type == CFI_type_Real && kind == sizeof (long double))
d->type = CFI_type_long_double;