Integer types used in libgfortran

Paul Brook paul@codesourcery.com
Wed May 25 13:23:00 GMT 2005


On Wednesday 25 May 2005 12:38, FX wrote:
> I've recently been thinking again about PR 21647 and all the PR
> related to -fdefault-integer-8. Lots of library function calls use
> GFC_INTEGER_4 arguments (or GFC_INTEGER_4 fields in structures) and
> the'yre not happy when being given GFC_INTEGER_8 arguments.
>
> If I understand correctly, one way to solve this would be to switch
> the entire library to using GFC_INTEGER_8, but then the same problem
> could happen with codes using larger kinds of integer. So, my question
> is the following: how could we define a new GFC_INTEGER_LARGER type as
> the larger integer type available on a given architecture, and is
> there any objection to use such a scheme in most of the library
> functions calls?

That won't work.

The problem is that the library routine takes a *pointer* to an integer, and 
uses that to return the status. The object it points to must be of the 
correct type.

Most other library routines either take an argument by value (and the compiler 
explicitly does the conversion to an appropriate type), or we provide library 
routines for both the possible default integer types. The IO routines were 
poorly written, and do not do this.

The other alternative is to copy the value to a temporary of the apropriate 
size, pass a pointer to that, then copy the value back to the user variable 
after the call.

Paul



More information about the Fortran mailing list