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

Bill Long longb
Fri Nov 13 15:05:49 EST 2009



Craig Rasmussen wrote:
> 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.

I would hope not, assuming the dummy is declared integer(c_int).  Such 
'promotion' is really 'convert to the KIND of the dummy'.  Since bind(c) 
procedures must have explicit interfaces, the KIND of the dummy is 
visible.   If a compiler blindly converts integers to a particular KIND 
even when it is obvious that it would result in a kind mismatch, then 
that is indeed evil, and grounds for filing a big.

Cheers,
Bill


> 
> 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!
> 
> -craig
> 
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list