Target control of Fortran options
Paul Koning
paulkoning@comcast.net
Thu Oct 4 15:48:00 GMT 2018
> On Oct 4, 2018, at 11:41 AM, N.M. Maclaren <nmm1@cam.ac.uk> wrote:
>
> On Oct 4 2018, Paul Koning wrote:
>>
>> It appears that Fortran has a different approach. Fortran has syntax like "REAL*8" to request a float of a specific size. And what gfortran does is assume that "REAL" without a size specifier means "REAL*n" for a well known fixed n. Without switches, n is 4, which is indeed the common answer. But in my case, there isn't any 4-byte float type unless you say -mfloat32.
>
> If you don't have a 4-byte REAL, why do you make default REAL 4 bytes?
> Do you mean that the front-end code assumes that it is? In which case,
> I would say that it's a clear design bug! If not, why not just set it to
> your basic floating type?
That's what I expected and apparently I'm not the only one. But the actual code says that the default REAL is the 4 byte one, and if the compiler doesn't supply a float type of that size, the compiler crashes at startup.
Janne raises an interesting point, about Fortran requirements of int and float and double sizes that I was not aware of. Given those, it seems that the correct answer is to do the more traditional thing where "float" (REAL) is SFmode, 4 bytes -- always. In other words, make -mfloat32 be the only operating mode and retire that switch.
paul
More information about the Fortran
mailing list