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

strange IFX compiler execution on a simple IF conditional

david47
Novice
808 Views

I am running Fortran 2024.1 on Visual Studio 2022 in Windows.  When I run the following code using the IFX compiler in debug  mode (or release with debug on),

real(kind=8), allocatable :: a(:)

integer :: b, c, d

b = 0

c = 0

d = 0

if (allocated(a)) then

    b = 1

    c = 2

    d = 3

    deallocate (a)

end if

end

The code will step into the IF statement and break at the DEALLOCATE statement  (no matter where it is located in the IF conditional) but not make any changes.   Making the next step will step out of the IF conditional.  No changes to b, c, d, or error in trying to deallocate an unallocated array.

If I use the IFORT compiler, the code will run as expected, i.e., jump over the IF since the array A is unallocated.

This behavior is the same whether A is integer, real or complex.

I am trying to find a memory error/leak in my large code and I had thought I found the problem until I tested this with a small sample code.

 

I assume this is a bug in the IFX compiler?

0 Kudos
1 Solution
TobiasK
Moderator
672 Views

@david47


I cannot reproduce that. Could you please also check with 2024.2.1?


View solution in original post

2 Replies
TobiasK
Moderator
673 Views

@david47


I cannot reproduce that. Could you please also check with 2024.2.1?


david47
Novice
652 Views

Hi TobiasK!

 

I do not have admin rights on my computer as my company is very strict on what software can be installed.  I will try to get  Fortran, version 2024.2.1 but not sure I will be able to.

 

Thank you so much for checking!

 

David

0 Kudos
Reply