Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

-heap-arrays flag - does it work?

$
0
0

Hi all.

If I compile the following program with

ifort -m32 -heap-arrays test.f

the array in mytest2() is allocated on the heap, but the one in mytest() is not. According to the documentation, the -heap-arrays flag should put all automatic arrays on the heap. Am I misunderstanding the documentation? Is there a way to force the array in mytest to be allocated on the heap instead of on the stack or in static data?

Regards,

Mark

        program test
        implicit none
        integer i,mytest,mytest2

        i=mytest()
        i=mytest2(100000)

        stop
        end

        function mytest
        implicit none
        integer mytest
        automatic bigarray
        integer bigarray(100000)
        integer i,j

        do i=1,100000
          bigarray(i)=i
        enddo
        do i=1,100000
          j=j+bigarray(i)
        enddo
        mytest=j

        return
        end

        function mytest2(isize)
        implicit none
        integer mytest2,isize
        integer bigarray(isize)
        integer i,j

        do i=1,100000
          bigarray(i)=i
        enddo
        do i=1,100000
          j=j+bigarray(i)
        enddo
        mytest2=j

        return
        end


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>