Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Anything not standard conforming in following code?

$
0
0

I am puzzled by a difference in behavior between the Intel compiler and the Cray compiler on the example below.

PROGRAM TEST_STRING_FUNCTION

IMPLICIT NONE

CHARACTER(LEN=:),ALLOCATABLE :: S
CALL SUB( __LINE__ ,S)
WRITE(*,*) __LINE__
WRITE(*,*) S

CONTAINS

SUBROUTINE SUB(I,O)
INTEGER,INTENT(IN) :: I
CHARACTER(LEN=:),ALLOCATABLE :: O
CHARACTER(LEN=15) :: S15_1
WRITE(S15_1,'(I15)') I
O = TRIM(ADJUSTL(S15_1))
END SUBROUTINE SUB

END PROGRAM TEST_STRING_FUNCTION

When (automatically preprocessed, due to the .F90 extension) and compiled with Intel, I get the expected output (7, then 6). With the Cray compiler, I only get the output from the first WRITE statement.

Am I overlooking something here? What could explain (besides a bug or omission in one of the compilers) the different behavior?


Viewing all articles
Browse latest Browse all 3270

Trending Articles



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