On Dec 17, 2005, at 6:08 AM, FX Coudert wrote:
I'm trying to understand the gfortran failure large_real_kind_2.F90
on ppc-darwin7.9, which can be reduced to:
$ cat large_real_kind_2.F90
real(kind=16) :: x
real(8) :: y
x = 1
y = x
x = cos (x)
y = cos (y)
print *, x, y, y-x
end
$ ./usr/local/gfortran/bin/gfortran -g large_real_kind_2.F90 && ./
a.out
0.5403023058681397650104827000000 0.540302305868140
1.9841535727186827560257490000000E-0004
But I can't make a C testcase for that. Is "long double" supposed
to be usable on ppc-darwin7.9 ?
The trick is that things like sinl have a linker name like _sinl
$LDBL128. This is to enable 8 byte long doubles to continue to work,
and _sin is an 8 byte long double routine. Don't ask. Binary
compatibility is so very much fun.
Since Geoff invented the scheme, I'm sure he had an idea of how he
thought it should work for Fortran. My guess would be that gcc has
to pick the right library names internally for all languages, thus,
obviating the need for the asm () fun remap the names in C.
Essentially, any routine that does something with a long double needs
to be remapped, a rough survey would be:
___svfscanf$LDBL128 _fmal$LDBL128 _strtold_l$LDBL128
___svfscanf_l$LDBL128 _fmaxl$LDBL128 _swprintf$LDBL128
___vfprintf$LDBL128 _fminl$LDBL128 _swprintf_l$LDBL128
___vfwprintf$LDBL128 _fmodl$LDBL128 _swscanf$LDBL128
___vfwscanf$LDBL128 _fprintf$LDBL128 _swscanf_l$LDBL128
_acoshl$LDBL128 _fprintf_l$LDBL128 _syslog$LDBL128
_acosl$LDBL128 _frexpl$LDBL128 _tanhl$LDBL128
_asinhl$LDBL128 _fscanf$LDBL128 _tanl$LDBL128
_asinl$LDBL128 _fscanf_l$LDBL128 _tgammal$LDBL128
_asl_log$LDBL128 _fwprintf$LDBL128 _truncl$LDBL128
_asl_vlog$LDBL128 _fwprintf_l$LDBL128 _vasprintf$LDBL128
_asprintf$LDBL128 _fwscanf$LDBL128 _vasprintf_l$LDBL128
_asprintf_l$LDBL128 _fwscanf_l$LDBL128 _verr$LDBL128
_atan2l$LDBL128 _hypotl$LDBL128 _verrc$LDBL128
_atanhl$LDBL128 _ilogbl$LDBL128 _verrx$LDBL128
_atanl$LDBL128 _ldexpl$LDBL128 _vfprintf$LDBL128
_cabsl$LDBL128 _lgammal$LDBL128 _vfprintf_l$LDBL128
_cacoshl$LDBL128 _llrintl$LDBL128 _vfscanf$LDBL128
_cacosl$LDBL128 _llroundl$LDBL128 _vfscanf_l$LDBL128
_cargl$LDBL128 _log10l$LDBL128 _vfwprintf$LDBL128
_casinhl$LDBL128 _log1pl$LDBL128 _vfwprintf_l$LDBL128
_casinl$LDBL128 _log2l$LDBL128 _vfwscanf$LDBL128
_catanhl$LDBL128 _logbl$LDBL128 _vfwscanf_l$LDBL128
_catanl$LDBL128 _logl$LDBL128 _vprintf$LDBL128
_cbrtl$LDBL128 _lrintl$LDBL128 _vprintf_l$LDBL128
_ccoshl$LDBL128 _lroundl$LDBL128 _vscanf$LDBL128
_ccosl$LDBL128 _modfl$LDBL128 _vscanf_l$LDBL128
_ceill$LDBL128 _nanl$LDBL128 _vsnprintf$LDBL128
_cexpl$LDBL128 _nearbyintl$LDBL128 _vsnprintf_l$LDBL128
_cimagl$LDBL128 _nextafterl$LDBL128 _vsprintf$LDBL128
_clogl$LDBL128 _nexttoward$LDBL128 _vsprintf_l$LDBL128
_conjl$LDBL128 _nexttowardf$LDBL128 _vsscanf$LDBL128
_copysignl$LDBL128 _nexttowardl$LDBL128 _vsscanf_l$LDBL128
_coshl$LDBL128 _powl$LDBL128 _vswprintf$LDBL128
_cosl$LDBL128 _printf$LDBL128 _vswprintf_l$LDBL128
_cpowl$LDBL128 _printf_l$LDBL128 _vswscanf$LDBL128
_cprojl$LDBL128 _remainderl$LDBL128 _vswscanf_l$LDBL128
_creall$LDBL128 _remquol$LDBL128 _vsyslog$LDBL128
_csinhl$LDBL128 _rintl$LDBL128 _vwarn$LDBL128
_csinl$LDBL128 _roundl$LDBL128 _vwarnc$LDBL128
_csqrtl$LDBL128 _scalblnl$LDBL128 _vwarnx$LDBL128
_ctanhl$LDBL128 _scalbnl$LDBL128 _vwprintf$LDBL128
_ctanl$LDBL128 _scanf$LDBL128 _vwprintf_l$LDBL128
_erfcl$LDBL128 _scanf_l$LDBL128 _vwscanf$LDBL128
_erfl$LDBL128 _sinhl$LDBL128 _vwscanf_l$LDBL128
_err$LDBL128 _sinl$LDBL128 _warn$LDBL128
_errc$LDBL128 _snprintf$LDBL128 _warnc$LDBL128
_errx$LDBL128 _snprintf_l$LDBL128 _warnx$LDBL128
_exp2l$LDBL128 _sprintf$LDBL128 _wcstold$LDBL128
_expl$LDBL128 _sprintf_l$LDBL128 _wcstold_l$LDBL128
_expm1l$LDBL128 _sqrtl$LDBL128 _wprintf$LDBL128
_fabsl$LDBL128 _sscanf$LDBL128 _wprintf_l$LDBL128
_fdiml$LDBL128 _sscanf_l$LDBL128 _wscanf$LDBL128
_floorl$LDBL128 _strtold$LDBL128 _wscanf_l$LDBL128