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

Internal compiler error: unexpected statement

cpowers534
Beginner
857 Views
[plain]PROGRAM Test

    LOGICAL f_test
    LOGICAL f_test2

    CALL Set_Test_Vbls(f_test, f_test2)

    IF (f_test) &
         IF (f_test2) &
              WRITE(*,*) 'Test1 and Test2 set'

END PROGRAM Test
[/plain]
I'm not sure the nesting of IF statements is legal, but I think it should give a friendlier error message if it's not allowed.

ifort -V reports:
Intel Fortran Intel 64 Compiler Professional for applications running on Intel 64, Version 11.0 Build 20081105 Package ID: l_cprof_p_11.0.074

Compiling as:
ifort -c -fpp -assume byterecl -traceback -g -check all test.f90

Yields:
(14): catastrophic error: Internal Compiler Error: Unexpected statement
compilation aborted for test.f90 (code 1)
0 Kudos
4 Replies
TimP
Honored Contributor III
857 Views
Internal error, particularly as it still happens with a current release, would always be suitable for a bug report. That said, I don't think it's "legal" or desirable syntax. Why not
IF (f_test .and. f_test2) &
WRITE(*,*) 'Test1 and Test2 set'

I've spent more time in my career than I should have cleaning up these compound conditionals. If you're serious about specifying order of shortcut evaluation, use
if(f_test)then
....
endif

0 Kudos
cpowers534
Beginner
857 Views
Quoting - tim18
Internal error, particularly as it still happens with a current release, would always be suitable for a bug report. That said, I don't think it's "legal" or desirable syntax. Why not
IF (f_test .and. f_test2) &
WRITE(*,*) 'Test1 and Test2 set'

I've spent more time in my career than I should have cleaning up these compound conditionals. If you're serious about specifying order of shortcut evaluation, use
if(f_test)then
....
endif


In the live code that I reduced into the report above, I did the latter. The ICE arose when I added the 'if (f_test)' part to an existing 'if (f_test2)' part as a bugfix for an instance where the f_test2 expression wasn't allocated.

0 Kudos
Steven_L_Intel1
Employee
857 Views
Amusing. I can reproduce the error and will report it to the developers. The issue ID is DPD200139149.

You should use IF..THEN for this nesting. For the form of IF you used, the "action-stmt" "shall not be an if-stmt, end-program-stmt,, end-function-stmt or end-subroutine-stmt".
0 Kudos
Steven_L_Intel1
Employee
857 Views
This has been fixed for a future release.
0 Kudos
Reply