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

IFX 2024.0.2 incorrect results when calling windows function PtInRect

ZlamalJakub
New Contributor III
534 Views

I discovered a problem with the IFX 2024.0.2 compiler (but it's also in 2024.0.0 and 2023.x) when using the windows PtInRect function. The function returns an incorrect value because it is incorrectly called. If I compile source code with IFORT it works correctly.

My sample code is the following

...

type (T_POINT) point
type (T_RECT) Rect
Rect%left=15
Rect%right=100
Rect%top=90
Rect%bottom=100
point%x=0
point%y=95
iret=PtInRect(Rect,point) ! should return 0 point is out of rect

...

 

IFORT generates assembly code:

lea rcx,[RECT (07FF7896E80C0h)]
mov rdx,qword ptr [POINT (07FF7896E80D0h)]
call PtInRect (07FF7896E1410h)

(address of Rect is in rcx, values of point x and y coordinates in rdx according to calling conventions)

IFX generates assembly code:

lea rcx,[RECT (07FF7723460A0h)]
mov r8d,dword ptr [POINT+4h (07FF7723460C4h)]
mov edx,dword ptr [POINT (07FF7723460C0h)]
call PtInRect (07FF772341380h)

(address of Rect is in rcx, value of point x coordinate is in edx and value of y coordinate is in r8). IFX handles type (T_POINT) as two integers instead as one 64bit value.

 

Sample project is attached (compiler should be changet to IFORT if needed)

2 Replies
Barbara_P_Intel
Employee
485 Views

Thank you for the great reproducer! I duplicated the wrong answers you got with ifx. I filed a bug report, CMPLRLLVM-54891, for you.


0 Kudos
Barbara_P_Intel
Employee
403 Views

Good news! This issue is fixed in ifx 2024.1.0. It's planned for release in March/April 2024.



0 Kudos
Reply