Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Difference between "type" and "data type"?

$
0
0

Dear Intel support,

the following program raises an error, as I expect:

$ cat test.f90
program test
real(kind=8) :: i
i = 1.0
call mysub(i)
contains
subroutine mysub(j)
real(kind=4), intent(in) :: j
print *,j
end subroutine mysub
end program test

$ ifort test.f90 -o test && echo "Success" || echo "Failure"
test.f90(4): error #6633: The type of the actual argument differs from the type of the dummy argument. [I]
call mysub(i)
-------------^
compilation aborted for test.f90 (code 1)
Failure

On the other hand, this next one is successful, and the program actually works, but I do not understand why. To me the program is as "non-conformant" as the previous one, and I expect the compiler to raise an error (and my Makefile to stop), but it does not... Do you have any clue? I use ifort 11.1.

$ cat test.f90
program test
integer(kind=4) :: i
i = 1
call mysub(i)
contains
subroutine mysub(j)
integer(kind=8), intent(in) :: j
print *,j
end subroutine mysub
end program test

$ ifort test.f90 -o test && echo "Success" || echo "Failure"
test.f90(4): warning #6075: The data type of the actual argument does not match the definition. [I]
call mysub(i)
-------------^
Success

$ ./test
1

Thank you,

Sebastien


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>