'Avoiding conversion warning in Fortran array of non-default kind
I have the following command to set my array
Use, Intrinsic :: iso_fortran_env
Integer (Int8), Allocatable :: iu(:)
Allocate (iu(4))
iu = [4,3,2,1]
How can I stop the compiler giving me
Allocate (iu(4)); iu = [4,3,2,1]
1
Warning: Possible change of value in conversion
from INTEGER(4) to INTEGER(1) at (1) [-Wconversion]
Solution 1:[1]
Try
iu = [4_int8,3,2,1]
But it is just a warning and the other way to stop the compiler would be to set or unset a flag. Since you're silent on which compiler you're using I won't guess what's in its documentation or what flag to set to what value.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | High Performance Mark |
