- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the following code, the `associated` function of ifort and ifx does not behave the same. There should be a bug in ifort:
program main
abstract interface
subroutine foo_fcn()
end subroutine
end interface
procedure(foo_fcn), pointer :: fcn_ptr
fcn_ptr => prt
call fcn_ptr()
print *, associated(fcn_ptr, prt), associated(fcn_ptr)
contains
subroutine prt()
print *, 'Hello, World!'
end subroutine
end program
The results of ifort and ifx:
>> ifort main.f90 && ./a
Hello, World!
F T
>> ifx main.f90 && ./a
Hello, World!
T T
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I like these nice short reproducers! Thank you.
Which compiler version are you using? I used ifort 2021.8.0 and got this.
$ ifort --version
ifort (IFORT) 2021.8.0 20221119
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
$ ifort main.f90
$ a.out
Hello, World!
T T
$ ifx --version
ifx (IFORT) 2023.0.0 20221201
Copyright (C) 1985-2022 Intel Corporation. All rights reserved.
$ ifx main.f90
$ a.out
Hello, World!
T T
These compilers were released as part of oneAPI HPC Toolkit 2023.0 in December 2022. Download it here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Locally, my version is Visual-Studio 2022 + Intel-Fortran 2023.0.0:
Similarly, in godbolt, click this link to see the results of the example source file.
Interestingly, I compiled the example using the visual-studio release mode, and ifort gave the correct results!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just to confirm I did a debug build (on windows) with Intel® Fortran Compiler Classic 2021.8.0 [Intel(R) 64] and got the 'bad' result.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah! The devil's in the details! Debug mode!
I get the wrong answers on both Windows and Linux when I compile with -g or -O0. Other optimization levels are just fine.
I filed a bug, CMPLRIL0-35148. I'll let you know when it's fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In the meantime, use ifx. It works!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We value your input and helping us improve our products. However, the Intel® Fortran Compiler Classic with this issue will not receive a fix. We are concentrating our efforts on our new Intel® Fortran Compiler to make it the best in the industry. For this reason, we will close this issue at this time. We encourage you to try our new oneAPI Compilers. Your feedback and suggestions are important to us. Thank you for your efforts to help us improve our products.
Your reproducer works just fine with ifx. Please use ifx as ifort is now deprecated. Please see this information.
There is an ifort to ifx Porting Guide to help you in this transition.

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