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]

Re: How does a target make Fortran work?


Hi Paul,

Fortran problems are best discussed on fortran@gcc.gnu.org (in CC) ...

2018-07-12 21:22 GMT+02:00 Paul Koning <paulkoning@comcast.net>:
> I tried to rebuild for target pdp11 with fortran enabled (in the past I've just enabled C).  It builds fine but the resulting compiler crashes at startup:
>
> Paul-Konings-MacBook-Pro:gcc pkoning$ ./xgcc -B. -O2 -S ../../hello.f
> f951: internal compiler error: gfc_validate_kind(): Got bad kind
> libbacktrace could not find executable to open
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <https://gcc.gnu.org/bugs/> for instructions.
>
> "hello.f" is the typical "hello world" program.  Some debugging got me to here:
>
> * thread #1, queue = 'com.apple.main-thread', stop reason = step over
>     frame #0: 0x00000001001c1c93 f951`gfc_init_kinds() [inlined] gfc_validate_kind(type=BT_REAL, kind=<unavailable>, may_fail=false) at trans-types.c:814 [opt]
>    811      }
>    812
>    813    if (rc < 0 && !may_fail)
> -> 814      gfc_internal_error ("gfc_validate_kind(): Got bad kind");
>    815
>    816    return rc;
>    817  }
> Target 0: (f951) stopped.
>
> So it's unhappy about some "kind", for BT_REAL.  I'm not sure what that means.  Is it mapping the available data types to Fortran "KIND" values?  If so, is there something the target has to do for this to work?  Note that this isn't an IEEE target, so if the initialization is expecting IEEE float then that may account for it.  But I have no idea what to do here, and the manual offers no clue.

A "kind" in Fortran is the size of the data type in bytes. E.g.
"real(kind=4)" would be a 'single-precision' 32-bit float number,
while "real(kind=8)" would be a 'double-precision' 64-bit float
number. The default kind for REAL variables is 4 in gfortran, see:

https://gcc.gnu.org/onlinedocs/gcc-8.1.0/gfortran/KIND-Type-Parameters.html

Since pdp-11 seems to be a 16-bit platform, such a 32-bit
floating-point type might not be available there? Possibly it makes
sense to set the default REAL kind to 2 for such a target?

Cheers,
Janus


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