This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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]

Problem with DTYPE ABI regarding long double vs. __float128


Hi,

While implementing __float128 support in gfortran, I came across what may be a very serious snag. The dtype in the array descriptor structure includes "sizeof(element_type)". As can be seen in libgfortran/libgfortran.h:

> #define GFC_DTYPE_REAL_10  ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
>    | (sizeof(GFC_REAL_10) << GFC_DTYPE_SIZE_SHIFT))
> #define GFC_DTYPE_REAL_16 ((GFC_DTYPE_REAL << GFC_DTYPE_TYPE_SHIFT) \
>    | (sizeof(GFC_REAL_16) << GFC_DTYPE_SIZE_SHIFT))

The problem is that on x86_64, sizeof(long double) == sizeof(__float128) == 16. (On i386, we may get sizeof(long double) == 12 and sizeof(__float128) == 16 on some platforms, and sizeof(long double) == sizeof(__float128) == 16 on others).

This is used in libgfortran to branch into different code paths in intrinsics like cshift (and probably other such cases). However, the sizeof information is not enough to distinguish the types, as explained above. The question becomes: do we really need to differentiate types based on dtype, or is sizeof enough? I think we really need to get the type back, and thus the array descriptor would need to be changed (which I know is planned anyway).

Comments and help are very much welcome!

FX


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