(j3.2006) (SC22WG5.4126) Problems created by some compiler extended size options

Craig Dedo craig
Fri Nov 13 15:14:42 EST 2009

Craig and Everyone Else:
	The promotion of integers breaks C interoperability ONLY if the
compiler violates the Fortran standard.

	The practice of promoting integers even if the kind parameter is
specified directly contradicts the Fortran standard.  Thus, any compiler
that implements such a "feature" is no longer standard conforming, if such a
"feature" is invoked.  

	Section says, in part, "The INTEGER type specifier is used
to declare entities of intrinsic type integer (4.4.1).  The kind selector,
if present, specifies the integer representation method."

	The second sentence is required behavior.  If the compiler promotes
an integer that has an explicit kind type parameter, then the compiler is
violating this requirement.  

	C interoperability always requires the explicit specification of the
kind type parameters of all variables that are used in C interoperability.

	Promotion of integers with an explicit kind type parameter should be
abolished in compilers that support this abominable practice.  At the very
least, compilers with this "feature" should put out a very big and obvious
WARNING that this practice is being used.

Craig T. Dedo
17130 W. Burleigh Place
P. O. Box 423                  Mobile Phone:  (414) 412-5869
Brookfield, WI   53008-0423    E-mail:  <craig at ctdedo.com>
Linked-In:  http://www.linkedin.com/in/craigdedo

-----Original Message-----
From: j3-bounces at j3-fortran.org [mailto:j3-bounces at j3-fortran.org] On Behalf
Of Craig Rasmussen
Sent: Friday, November 13, 2009 13:18
To: WG5
Subject: (j3.2006) (SC22WG5.4126) Problems created by some compiler extended
size options

There was a discussion at the MPI forum regarding the use of extended  
size compiler options.  It appears that there some options on some  
compilers that promote integers even if the kind parameter is specified.

The problem with this is that it breaks the C interoperability  
standard.  For example, the code,

       integer(C_INT) :: i
       call bindc_function(i)

appears to be broken as the variable i will get promoted.

Is this a common compiler option?  I've been told that users most  
often chose the compiler option that promotes everything, even if an  
explicit kind is provided.

I think this practice is evil!


J3 mailing list
J3 at j3-fortran.org

More information about the J3 mailing list