- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I never noticed that until today, but apparently the following code compiles with any ifort/ifx version, just with a warning, and gives garbage:
program foo
implicit none
integer(8) :: i = huge(0) + 1_8
print*, "i = ", i
call init(i)
contains
subroutine init(a)
integer, intent(in) :: a
print*, "a = ", a
end subroutine init
end
Ouput with ifx 2024:
/app/example.f90(7): warning #6075: The data type of the actual argument does not match the definition. [I]
call init(i)
----------^
Program returned: 0
Program stdout
i = 2147483648
a = -2147483648
This implicit casting is a violation of the standard, but looks intentional. It is restricted to the integer case (no casting between real and integer, or between real kinds). Nonetheless I don't think it's a good idea at all...
BTW, how to disable this behavior?
Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page