[Bug fortran/69101] ICE when compiling some tests in gfortran.dg/ieee/ with -fdefault-integer-8 or -finteger-4-integer-8
kargl at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 31 18:49:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69101
--- Comment #1 from kargl at gcc dot gnu.org ---
This has nothing to do with either -fdefault-integer-8 or
-finteger-4-integer-8. The IEEE module is not implemented
correctly.
program foo
use ieee_arithmetic
implicit none
integer(8) n
integer k1
n = precision(0.d0)
k1 = ieee_selected_real_kind(n)
end program foo
% gfc -c yy.f90
yy.f90:7:32:
k1 = ieee_selected_real_kind(n)
1
Error: Type mismatch in argument 'p' at (1); passed INTEGER(8) to INTEGER(4)
The Fortran 2003 standard contains
14.10.17 IEEE_SELECTED_REAL_KIND ([P, R])
Description. Returns a value of the kind type parameter of an IEEE
real data type with decimal precision of at least P digits and
a decimal exponent range of at least R. For data objects of such
a type, IEEE SUPPORT DATATYPE(X) has the value true.
Class. Transformational function.
Arguments. At least one argument shall be present.
P (optional) shall be scalar and of type integer.
R (optional) shall be scalar and of type integer.
Result Characteristics. Default integer scalar.
Note the description of P is 'of type integer' not 'of default
integer type'.
As a bonus, the result is a 'default integer scalar' so to
support the -fdefault-integer-8 or -finteger-4-integer-8 option,
you need to generate code that can return either kind type.
More information about the Gcc-bugs
mailing list