Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29280 Discussions

Compiler bug involving complex array parts

NCarlson
New Contributor I
2,350 Views

I've encountered another bug with complex array parts using ifx 2025.1.  Here's a small example.  I'll follow-up with a couple workaround attempts that result in either an internal compiler error or incorrect runtime results. The only workaround I've found that works is to manually do copy-in/copy-out to a temporary real array.

type :: foo
  complex :: z(3)
end type
type(foo) :: a
call bar(a%z%re)
contains
  subroutine bar(x)
    real, intent(inout) :: x(:)
  end subroutine
end

 The compiler gives this spurious error. Clearly the actual argument is neither a constant nor an expression.

$ ifx bug.f90 
bug.f90(5): error #6638: An actual argument is an expression or constant; this is not valid since the associated dummy argument has the explicit INTENT(OUT) or INTENT(INOUT) attribute.
call bar(a%z%re)
---------^
compilation aborted for bug.f90 (code 1)
5 Replies
NCarlson
New Contributor I
2,346 Views

This attempt at a workaround using an ASSOCIATE block results in an internal compiler error:

type :: foo
  complex :: z(3)
end type
type(foo) :: a
associate (z => a%z)
  call bar(z%re)
end associate
contains
  subroutine bar(x)
    real, intent(inout) :: x(:)
  end subroutine
end
$ ifx bug.f90
          #0 0x0000000003310581
          #1 0x0000000003375357
         [...]
         #28 0x00007fce2f76b20b __libc_start_main + 139
         #29 0x000000000308f0ee

bug.f90(6): error #5623: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report.  Note: File and line given may not be explicit cause of this error.
  call bar(z%re)
-----------^
compilation aborted for bug.f90 (code 3)

 

 

NCarlson
New Contributor I
2,345 Views

This attempt at a workaround using an ASSOCIATE block compiles without error, but produces incorrect results:

type :: foo
  complex :: z(3)
end type
type(foo) :: a
a%z%re = -1
associate (z_re => a%z%re)
  call bar(z_re)
end associate
print *, a%z%re
if (any(a%z%re /= [1,2,3])) stop 'fail'
contains
  subroutine bar(x)
    real, intent(inout) :: x(:)
    x = [1,2,3]
  end subroutine
end
$ ifx bug.f90
$ ./a.out
  -1.000000      -1.000000      -1.000000    
fail
NCarlson
New Contributor I
2,308 Views

Here's the more complete test code from my compiler bug database that should compile and run with a 0 exit status (unix).

garraleta_fortran
2,023 Views

TYPE :: FOO
   COMPLEX :: Z(3)
END TYPE
TYPE(FOO) :: A
CALL BAR(REAL(A.Z(:)))
CONTAINS
  SUBROUTINE BAR(X)
  REAL, INTENT(IN) :: X(:)
  WRITE(*,*)X
  END SUBROUTINE
END

0 Kudos
Devorah_H_Intel
Moderator
1,935 Views

Thank you for reporting this. This bug report is escalated to engineering for further investigation.

0 Kudos
Reply