- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The program below compiles and runs with gfortran and g95 and also with ifort without the /check:bounds option, giving output 42.0. It also runs if components other than ff of the derived type are removed.
c:\fortran\ifort\sge>ver
Microsoft Windows [Version 10.0.16299.371]
c:\fortran\ifort\sge>type xbug.f90
program xbar
implicit none
integer, parameter :: dp = kind(1.0d0)
type :: foo
integer :: n
real(kind=dp) :: ff,gg,hh
real(kind=dp), allocatable :: cc(:),dd(:),ee(:)
end type
integer, parameter :: nx=2
type(foo), allocatable :: xx(:)
allocate (xx(nx))
xx = bar(["a","b"])
xx(1)%ff = 42.0_dp
print*,xx(1)%ff
contains
function bar(ss) result(yy)
character (len=*), intent(in) :: ss(:)
type(foo) :: yy(size(ss))
end function bar
end program xbar
c:\fortran\ifort\sge>ifort /traceback /check:bounds xbug.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.0.045 Beta Build 20180317
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
ifort: NOTE: The Beta evaluation period for this product ends on 11-oct-2018 UTC.
xbug.f90(16): warning #6178: The return value of this FUNCTION has not been defined. [YY]
function bar(ss) result(yy)
------------------------^
Microsoft (R) Incremental Linker Version 14.00.24234.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:xbug.exe
-subsystem:console
-incremental:no
xbug.obj
c:\fortran\ifort\sge>xbug.exe
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
xbug.exe 00007FF6B4085F21 Unknown Unknown Unknown
xbug.exe 00007FF6B4086447 Unknown Unknown Unknown
xbug.exe 00007FF6B4081526 MAIN__ 12 xbug.f90
xbug.exe 00007FF6B40D6E22 Unknown Unknown Unknown
xbug.exe 00007FF6B40D71C5 Unknown Unknown Unknown
KERNEL32.DLL 00007FFA2B501FE4 Unknown Unknown Unknown
ntdll.dll 00007FFA2BCBF061 Unknown Unknown Unknown
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
andrew_4619 wrote:
But the value of yy is not defined in the function??
When I set the function result the problem remains:
c:\fortran\ifort\sge>type xbug.f90
program xbar
implicit none
integer, parameter :: dp = kind(1.0d0)
type :: foo
integer :: n
real(kind=dp) :: ff,gg,hh
real(kind=dp), allocatable :: cc(:),dd(:),ee(:)
end type
integer, parameter :: nx=2
type(foo), allocatable :: xx(:)
allocate (xx(nx))
xx = bar(["a","b"])
xx(1)%ff = 42.0_dp
print*,xx(1)%ff
contains
function bar(ss) result(yy)
character (len=*), intent(in) :: ss(:)
type(foo) :: yy(size(ss))
integer :: i
do i=1,size(ss)
yy(i)%n = 0
yy(i)%ff = 0.0_dp
yy(i)%gg = 0.0_dp
yy(i)%hh = 0.0_dp
allocate(yy(i)%cc(1),yy(i)%dd(1),yy(i)%ee(1))
yy(i)%cc = 0.0_dp
yy(i)%dd = 0.0_dp
yy(i)%ee = 0.0_dp
end do
end function bar
end program xbar
c:\fortran\ifort\sge>ifort /traceback /check:bounds xbug.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.0.0.045 Beta Build 20180317
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
ifort: NOTE: The Beta evaluation period for this product ends on 11-oct-2018 UTC.
Microsoft (R) Incremental Linker Version 14.00.24234.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:xbug.exe
-subsystem:console
-incremental:no
xbug.obj
c:\fortran\ifort\sge>xbug.exe
forrtl: severe (157): Program Exception - access violation
Image PC Routine Line Source
xbug.exe 00007FF66F43A5A1 Unknown Unknown Unknown
xbug.exe 00007FF66F43AAC7 Unknown Unknown Unknown
xbug.exe 00007FF66F431CAB MAIN__ 12 xbug.f90
xbug.exe 00007FF66F4876E2 Unknown Unknown Unknown
xbug.exe 00007FF66F487A85 Unknown Unknown Unknown
KERNEL32.DLL 00007FFA2B501FE4 Unknown Unknown Unknown
ntdll.dll 00007FFA2BCBF061 Unknown Unknown Unknown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Vivek R.,
it looks a bug in Intel Fortran with the problem existing in the current official release of compiler 18.0 Update 2 as well.
I suggest you submit this at Intel support:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FortranFan wrote:
@Vivek R.,
it looks a bug in Intel Fortran with the problem existing in the current official release of compiler 18.0 Update 2 as well.
I suggest you submit this at Intel support:
Done. Thanks for confirming that it is a bug.

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