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

[ICE] intrinsic call with allocatable array and scalar with -assume realloc_lhs

Kacper_Kowalik
Beginner
1,036 Views

Hi,
following code:

program ala
real, dimension(:), allocatable :: a
allocate(a(2))
a = 0.0
a = min(a, 1.0)
print *, a
deallocate(a)
end program ala

causes ICE when compiled with: ifort -assume realloc_lhs ala.f90
Compiler that I've used:
Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 13.0.0.079 Build 20120731
Best regards,
Kacper Kowalik

0 Kudos
9 Replies
Heinz_B_Intel
Employee
1,036 Views
Hello Kacper I will investigate and will escalate to engineering, I will let you know about more details later. Heinz
0 Kudos
Heinz_B_Intel
Employee
1,036 Views
Hello Kacper I have escalated the problem to the compiler developers; case number is DPD200236655. I will let you know when a compiler with a fix will be available, Thanks for providing such a small test case Heinz
0 Kudos
Heinz_B_Intel
Employee
1,036 Views
Might be a good workaround for you: Swapping the arguments for MIN() prevents the bug; a = min(1.0, a) works as expected.
0 Kudos
Kacper_Kowalik
Beginner
1,036 Views

HeinzB (Intel) wrote:

Might be a good workaround for you: Swapping the arguments for MIN() prevents the bug; a = min(1.0, a) works as expected.

That bug is still present in 13.0.1 and that workaround cannot be applied to all intrinsic funtion, like "ishft" where order of arguments matter. Better way to   avoid this is to explictly disable realloc_lhs in offending lines by adding (:), e.g. a(:) = min(a, 1.0)

Cheers,

Kacper

0 Kudos
Kacper_Kowalik
Beginner
1,036 Views

Just noticed that new version of the compiler was released yesterday with the fix, sorry for the noise :-)

0 Kudos
Kacper_Kowalik
Beginner
1,036 Views

Not fixed quite yet. Although it now works for original code with "min" it still ICEs for other functions (with ifort-13.1):

[fortran]

program ala
integer, dimension(:), allocatable :: a
allocate(a(2))
a = 0
a = ishft(a, -1)
deallocate(a)
end program ala

[/fortran]

0 Kudos
Steven_L_Intel1
Employee
1,036 Views

Sigh - I can reproduce this and will report it.  Thanks. Issue ID is DPD200240757.

0 Kudos
Steven_L_Intel1
Employee
1,036 Views

Kacper, the problem with ishft is expected to be fixed in Update 3. We have gone through all of the intrinsics where this could be a problem and implemented a common solution.

0 Kudos
Heinz_B_Intel
Employee
1,036 Views

The ICE has been fixed by 13.0 Update 1 already; sorry for the late update. I just tested Update 2 and it doesn't show the ICE either.

 

Heinz

 

0 Kudos
Reply