- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know that in the past, Cray, like us, required an option to get automatic reallocation on assignment. However, we always do the reallocation for deferred-length character, maybe Cray does not. I also know that Cray will change that default but don't know if it's in the version you're using. Look up what that Cray option is and turn it on, see what happens.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve - your hint was spot on. This cured all the issues I had. Have a great weekend!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll send the bill to Cray....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ha ha ha :-) ! Actually I just found that their compiler create an ICE with the following code:
PROGRAM TEST_ADJUSTL IMPLICIT NONE CHARACTER(LEN=:),ALLOCATABLE :: S S = ' THIS IS A TEST ' WRITE(*,*) S WRITE(*,*) ADJUSTL(S) END PROGRAM TEST_ADJUSTL
This is easy to work around, so I won't knock too hard on them for this... And let's not forget that they have a pretty solid F08 implementation ;-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In no way would I knock Cray's implementation - we respect and admire it. Be sure to report the ICE to Cray - I'm on good terms with my counterpart on their support team.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just want to clarify one tiny thing here ... Windows does not automatically preprocess based on the case of the extension, that's reserved for Linux and MacOS.
Pedantically yours,
--Lorri

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