- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello:
I am getting a compiler error, and was able to narrow it down to a test case. The error is: The shapes of the array expressions do not conform.
I am using the 14.0.3.202 version of the compiler. When I switch back to version 12.0.5.221, it compiles just fine.
Here is the sample code:
module TestMod implicit none private character (len = 100), dimension(5) :: charArr contains !****************************************************************************** character (len = 100) function GetCharArr() dimension :: GetCharArr(5) GetCharArr = charArr end function GetCharArr !****************************************************************************** end module TestMod
Can anyone explain to me why I'm getting this error message, or, if it is possibly a compiler issue?
Thanks.
Michael
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's a compiler bug. If you do it this way instead, it works:
function GetCharArr() character(len=100),dimension(5) :: GetCharArr
I prefer this version as it keeps all the declaration in one place. For some reason the use of LEN= throws it off here. I will report this to the developers and will let you know of any progress. Thanks. Issue ID is DPD200362719.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the quick reply, and for the workaround.
I'll look forward to hearing about progress,
Thanks.
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
It's a compiler bug. If you do it this way instead, it works:
function GetCharArr() character(len=100),dimension(5) :: GetCharArrI prefer this version as it keeps all the declaration in one place. For some reason the use of LEN= throws it off here. I will report this to the developers and will let you know of any progress. Thanks. Issue ID is DPD200362719.
Michael,
In addition to Steve's suggestion, the following is also an option which provides both flexibility with respect to defining the function result as well as making it more readable:
FUNCTION GetCharArr() RESULT(RetArr) !.. Function result CHARACTER(LEN = 100) :: RetArr(5) RetArr = charArr END FUNCTION GetCharArr
Also, consider adding the PURE attribute to FUNCTION subprograms as the compiler can help flag if the function has "side effects" beyond returning what it is supposed to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I expect this bug to be fixed in Update 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks. Just curious about the expected release date for Update 2?
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like early February.

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