https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94586

--- Comment #11 from Steve Kargl <sgk at troutmask dot apl.washington.edu> ---
On Tue, Apr 14, 2020 at 11:46:36PM +0000, dave.anglin at bell dot net wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94586
> 
> --- Comment #10 from dave.anglin at bell dot net ---
> On 2020-04-14 6:08 p.m., sgk at troutmask dot apl.washington.edu wrote:
> > So, hppa64 has REAL(16), but it does not use __float128 or 
> > GFC_REAL_16_IS_FLOAT128 is somehow not getting set.  Instead 
> > of the above kludge you can do something like
> It appears GFC_REAL_16_IS_FLOAT128 is not getting set.  Will investigate.
> There's a similar problem with the test dec_math.f90 which has started to fail
> 
> We have when the hpux long double library is available:
> 
>       /* Under HPUX, the __float128 type is a synonym for "long double".  */
>       (*lang_hooks.types.register_builtin_type) (long_double_type_node,
>                                                  "__float128");
> 
> We have __builtin_fabsq, __builtin_copysignq, __builtin_infq and
> __builtin_huge_valq.
> I suppose  I could add "l" versions.
> 

This seems to be confusing the simply assumptions in 
libgfortran/kinds-override.h, which states

/* What are the C types corresponding to the real(kind=10) and
   real(kind=16) types? We currently rely on the following assumptions:
     -- if real(kind=10) exists, i.e. if HAVE_GFC_REAL_10 is defined,
        then it is necessarily the "long double" type
     -- if real(kind=16) exists, then:
         * if HAVE_GFC_REAL_10, real(kind=16) is "__float128"
         * otherwise, real(kind=16) is "long double"
   To allow to change this in the future, we create the
   GFC_REAL_16_IS_FLOAT128 macro that is used throughout libgfortran.  */

#if defined(HAVE_GFC_REAL_16)
# if defined(HAVE_GFC_REAL_10)
#  define GFC_REAL_16_IS_FLOAT128
#  if !defined(HAVE_FLOAT128)
#   error "Where has __float128 gone?"
#  endif
# else
#  define GFC_REAL_16_IS_LONG_DOUBLE
# endif
#endif

So, hpux does not have REAL(10) and has REAL(16).  This is doing
what it is designed to do based on the assumption that a target
like hpux with REAL(16) will define the long double functions 
with the 'l' suffix.  It seems the the fix for hpux is to change
the test to something like 

# if defined(HAVE_GFC_REAL_10) || defined(__HPUX__)

using, of course, whatever the relevant macro.  This will then
select the 'q' suffix.

Reply via email to