- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when I run the following test case, which is the smallest one I can provide,
[fortran]module mtest contains function to_str(obj) result( s ) character(:),allocatable :: s class(*) :: obj integer :: j character(len=100) :: temp select type(obj) type is (integer(4)) j = obj write(temp, fmt="(i0)") j end select s = trim(temp) end function end module program test use mtest print *, "i:", to_str(5) print *, "i:" // to_str(5) end program [/fortran]
I get an access violation on the second print statement:
[bash]C:\TEMP>ifort test.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.4.325 Build 20120410 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:test.exe -subsystem:console test.obj C:\TEMP>test i:5 forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source test.exe 00409E79 Unknown Unknown Unknown test.exe 00401305 Unknown Unknown Unknown test.exe 0044F2A3 Unknown Unknown Unknown test.exe 0043524F Unknown Unknown Unknown kernel32.dll 7C817067 Unknown Unknown Unknown C:\TEMP>[/bash]
If instead of making the result of the function allocatable, I make it a fixed lenght string, there is no problem.
Johny
[fortran]module mtest contains function to_str(obj) result( s ) character(:),allocatable :: s class(*) :: obj integer :: j character(len=100) :: temp select type(obj) type is (integer(4)) j = obj write(temp, fmt="(i0)") j end select s = trim(temp) end function end module program test use mtest print *, "i:", to_str(5) print *, "i:" // to_str(5) end program [/fortran]
I get an access violation on the second print statement:
[bash]C:\TEMP>ifort test.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.1.4.325 Build 20120410 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:test.exe -subsystem:console test.obj C:\TEMP>test i:5 forrtl: severe (157): Program Exception - access violation Image PC Routine Line Source test.exe 00409E79 Unknown Unknown Unknown test.exe 00401305 Unknown Unknown Unknown test.exe 0044F2A3 Unknown Unknown Unknown test.exe 0043524F Unknown Unknown Unknown kernel32.dll 7C817067 Unknown Unknown Unknown C:\TEMP>[/bash]
If instead of making the result of the function allocatable, I make it a fixed lenght string, there is no problem.
Johny
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem appears to have been corrected in ifort 13.0, although I see it in 12.1.5.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This problem appears to have been corrected in ifort 13.0, although I see it in 12.1.5.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that does seem to be the case. "13.0" is the next major release, due out later this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tim, Steve,
thanks for your answers.
I can work around the bug for the moment, so I can wait for the next major version. I think our support runs 'til then
Johny
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page