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

catastrophic error in SELECT RANK

thomas__paul
Beginner
365 Views

Using ifort (IFORT) 19.1.0.075 20190522 beta, the following generates a catastrophic error:

  integer, dimension(2,2) :: y = reshape ([1,2,3,4],[2,2])
  integer, dimension(4) :: z = [1,2,3,4]
  integer :: i = 42
  call foo(y, "y")
  print '(a, 4i4)', "Return value of y = ", y
  call foo(z, "z")
  call foo(i, "i")
  print '(a, i2)', "Return value of i = ", i
  call bar(y)
contains
  subroutine foo(w, chr)
    integer, dimension(..) :: w
    character(1) :: chr
    select rank (x => w)
      rank (2)
        print '(a, 2i2)', chr//"(1,:) = ", x(1,:)
        print '(a)', chr//" rank 2"
        x = reshape ([10,11,12,13], [2,2])
      rank (0)
        print '(a,i2)', chr//" = ", x
        print '(a)', chr//" rank 0"
        x = 5
      rank (*)
        print '(a, 4i4)', chr//"(1,:) = ", x(1:4)
        print '(a)', chr//" is assumed size"
      rank default
        select rank (x)
          rank (1)
            print '(a, 4i4)', chr//"(1,:) = ", x
        end select
    end select
  end subroutine
  subroutine bar(x)
    integer, dimension(*) :: x
    call foo(x, "w")
  end
end

test.f90(27): catastrophic error: **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.
compilation aborted for test.f90 (code 1)

The line number is correct. The SELECT RANK following RANK DEFAULT is the cause of the problem. As far as I can tell from the F2018 standard it should be OK. Removing the inner SELECT RANK gives the expected result.

Strangely, replacing the offending block with:

...snip...

      rank default
!        print'(a, i4)', chr//" is default. Rank = ", rank(x)
        call foo (x, "q")

...snip...

the test compiles OK and outputs:

q(1,:) = 1012
q rank 2

Uncommenting the PRINT statement causes a segfault.

Best regards

Paul

 

 

0 Kudos
4 Replies
Lorri_M_Intel
Employee
365 Views

If you would please, could you submit a bug (using the orange button at the top of this page) so we can get this appropriately installed in our bugreport system?

                 Thank you! --

                                   --Lorri

0 Kudos
thomas__paul
Beginner
366 Views

Hi Lorri,

I looked everywhere on the site to find out how to submit a bug report rather than posting on this forum but failed to figure it out. Please accept my apologies.

Best regards

Paul

 

0 Kudos
Steve_Lionel
Honored Contributor III
366 Views

At the top of the main forum page is a big orange Bug Report button. There's also the "Tech Support" link up there, but the button gets you there directly.

0 Kudos
mecej4
Honored Contributor III
366 Views

Paul, to see the Big Red button, you should be on the Fortran for Windows page with the list of topics -- not reading your own thread. For your convenience, here is the link: http://www.intel.com/supporttickets .

0 Kudos
Reply