Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28445 Discussions

access violation with unlimited polymorphic function

johnyb_
New Contributor I
352 Views
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
0 Kudos
1 Solution
TimP
Honored Contributor III
352 Views
This problem appears to have been corrected in ifort 13.0, although I see it in 12.1.5.

View solution in original post

0 Kudos
3 Replies
TimP
Honored Contributor III
353 Views
This problem appears to have been corrected in ifort 13.0, although I see it in 12.1.5.
0 Kudos
Steven_L_Intel1
Employee
352 Views
Yes, that does seem to be the case. "13.0" is the next major release, due out later this year.
0 Kudos
johnyb_
New Contributor I
352 Views

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

0 Kudos
Reply