This is the mail archive of the 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]

Implementing real*16 in Fortran

Hash: SHA1

I want to implement real*16 in Fortran.  For that I seem to need two 

(1) For run time libraries, I need a corresponding C type.  I think the 
best thing would be to use long double for that, but it has to have a 
sizeof of 16.  On i386, the option -m128bit-long-double does just this.  
Is there a way to declare a type that does not need this option?  I 

	typedef long double __attribute__((aligned(16)) real16;

but this did not work; the size is still 12.  (Such a mechanism would 
also be very useful to interface between C and Fortran in general.)

(2) In the front end, I have to declare such a type to the middle end.  
The Fortran front end uses currently

#define PUSH_TYPE(name, node) \
  pushdecl (build_decl (TYPE_DECL, get_identifier (name), node))

  gfc_real16_type_node = long_double_type_node;
  PUSH_TYPE ("real16", gfc_real16_type_node);

but this does not make sure that the size is 16 bytes.  The C front end 
has the equivalent of

  gfc_real16_type_node = make_node (REAL_TYPE);
  TYPE_PRECISION (long_double_type_node) = 128;
  layout_type (gfc_real16_type_node);
  PUSH_TYPE ("real16", gfc_real16_type_node);

but can it really be that easy?  Where is the association between the 
constant "128" and the corresponding long double assembler statements 
made?  i386.{c,h,md} still think that a long double has 96 bits.

- -erik

- -- 
Erik Schnetter <>

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from
Version: GnuPG v1.2.2 (GNU/Linux)


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