[Patch, Fortran, committed] Fix Fortran bug affecting MinGW-w64, only
Tobias Burnus
burnus@net-b.de
Sat Jul 12 20:23:00 GMT 2014
Tim Prince wrote:
>
> On 7/12/2014 3:15 PM, Tobias Burnus wrote:
>> 64bit Windows is special as "long" is only 32bit wide - while
>> pointers are 64bit and, hence, wider.
> Are you distinguishing MinGW-x64 from other gfortran variants which
> use Windows X64 (e.g. cygwin64?)
Well, in this case, it was a just a bug: It simply makes no sense to use
"long" to a value which will later be stored in a "ptrdiff_t". Always
using size_t/ptrdiff_t is the correct use. Note: The value in question
is just used to check whether the array element size is too large for
the array descriptor or not â it does not affect the array descriptor or
any generated code.
> This could increase the confusion (which Fortran is designed to
> avoid). I thought it was clear from the intent of cygwin C and C++ to
> maintain linux compatibility that long there is a 64-bit data type.
> Perhaps if we can be assured that correct usage of C_LONG etc. could
> be counted upon, recognizing that this will change KIND among various
> gfortrans, we will be OK.
Well, for C_LONG, gfortran uses whatever the platform ABI and command
line options tells the compiler. Thus, INTEGER(C_LONG) and C/C++'s
"long" are always compatible.
Tobias
More information about the Fortran
mailing list