[R-pkg-devel] Solaris SPARC, Fortran, and logical errors?

Avraham Adler avraham.adler at gmail.com
Fri Mar 31 18:09:39 CEST 2017


On Wed, Mar 15, 2017 at 12:19 PM, William Dunlap <wdunlap at tibco.com> wrote:
> I don't know about the current Sparc Fortran compilers, but over the
> years have learned not to try to pass logicals and character strings
> between C and Fortran.  I have seen Fortran compilers that treated
> integer -1 (all bits 1) as .true. and anything else as .false. and I
> have see ones that looked only at bit 7, counting from the right, to
> determine the value.
>
> I recommend changing your Fortran code to accept an integer instead of
> a logical for boolean inputs and outputs.

Posting for posterity's and future similar questions' sakes [1], I am
relieved to find that removing reliance on the Fortran 2003
ISO_C_binding of c_bool, casting logicals explicitly as integers of 0
or 1, and testing for those integers in Fortran, seems to have finally
sated the SPARCmonster's appetite. [2]

Thank you very much!

Avi

[1] https://xkcd.com/979/
[2] https://cran.r-project.org/web/checks/check_results_Delaporte.html
- Version 6.0.0



More information about the R-package-devel mailing list