- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
the following code writes an incorrect result:
program p implicit none call fs((/"abc","d "/)) contains subroutine fs(text) character(len=*), intent(in) :: text(:) integer :: i write(*,*) "size(text) = ", size(text) write(*,*) "len_trim = ", (len_trim(text(i)) , i=1,size(text)) write(*,*) "sum(...) = ", sum((/(len_trim(text(i)) , i=1,size(text))/)) end subroutine fs end program p
Using "Intel(R) Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.181 Build 20160204" I get
size(text) = 2 len_trim = 3 1 sum(...) = 259
where I would expect, for sum(...), 4.
This might also be related to this old post: https://software.intel.com/en-us/comment/1878150#comment-1878150 .
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error is present in the current Windows compiler, 17.0.109, as well. If you declare LT as an integer array of size 2, and set LT = (/(len_trim(text(i)) , i=1,size(text))/), and print LT, the two elements are displayed as 3 and 256.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for reporting this MR, and mecej4 for the additional analysis. I will route this to Development.
About the earlier cited thread, that internal error remains fixed in our PSXE 2017 initial release; however, I was never able to make a connection to any similar report of that internal error, so the change responsible for apparently fixing that case is unknown. I still plan to follow-up on that error w/Development.
(Internal tracking id: DPD200414471)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4, Kevin, thank you both for your feedback!
Marco
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page