- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I've found a bug in the ifort [(IFORT) 2021.2.0 20210228] compiler. I enclose a test program below. With earlier ifort [19.1.3.304 20200925 and before] , it works, but with the 2021 it doesn't. Outputs below too.
------ ifort 19.1.3.304
$ ifort -g -traceback -CB testbug_prune3.f90
$ ./a.out
Results should be 'T T'.
Without associate
Pre T T
Post T T
With associate
Pre T T
Post T T
-------- ifort 2021.2.0
$ ifort -g -traceback -CB testbug_prune3.f90
$ ./a.out
Results should be 'T T'.
Without associate
Pre T T
Post T T
With associate
Pre T T
Post F T
forrtl: severe (153): allocatable array or pointer is not allocated
Image PC Routine Line Source
a.out 0000000000428FB2 Unknown Unknown Unknown
a.out 0000000000403845 MAIN__ 41 testbug_prune3.f90
a.out 0000000000402C42 Unknown Unknown Unknown
libc-2.27.so 00007F5446ACCBF7 __libc_start_main Unknown Unknown
a.out 0000000000402B2A Unknown Unknown Unknown
------- code - testbug_prune3.f90
module mymod
type p_t
integer, allocatable :: m(:)
end type p_t
type s_t
type(p_t) :: p
end type s_t
end module mymod
subroutine assgn(s, l)
use mymod
implicit none
type(s_t), intent(inout) :: l
type(s_t), intent(inout) :: s
write(6,*) "Results should be 'T T'."
write(6,*) "Without associate"
write(6,*) "Pre ", allocated(s%p%m),allocated(l%p%m)
s%p = l%p
write(6,*) "Post ", allocated(s%p%m),allocated(l%p%m)
write(6,*) "With associate"
associate(p=>l%p)
write(6,*) "Pre ", allocated(s%p%m),allocated(p%m)
s%p = p
write(6,*) "Post ", allocated(s%p%m),allocated(p%m)
end associate
end subroutine assgn
program testbug
use mymod
implicit none
type(s_t) :: l
type(s_t) :: s
allocate(s%p%m(0:1))
allocate(l%p%m(0:1))
call assgn(s, l)
deallocate(s%p%m)
deallocate(l%p%m)
end program
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
RE: associate(p=>l%p)
There used to be an old bug with associate where p, in the above statement, would be associated with l as opposed to l%p.
As a test for this bug, immediately after the associate, insert a "print *, sizeof(p)" to see if you get
8 (size of two integers)
some other number (sizeof type(s_t))
fatal error (other compiler bug)
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please report this issue at the Intel Online Service Center OSC, if you're able to:
https://supporttickets.intel.com/servicecenter?lang=en-US
Otherwise, Intel Support staff is very good at picking up trouble incidents reported at this forum.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good News! I just compiled and ran this reproducer using the compiler that was released last week, 2021.3.0. It works again!
ifort (IFORT) 2021.3.0 20210609
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
+ ifort prune.f90
+ a.out
Results should be 'T T'.
Without associate
Pre T T
Post T T
With associate
Pre T T
Post T T
+ ifort -g -traceback -CB prune.f90
+ a.out
Results should be 'T T'.
Without associate
Pre T T
Post T T
With associate
Pre T T
Post T T
@AlexThom , can you please give the new compiler a try?

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