- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I am using the newest Ifort compiler and the compilation hangs (running forever) when I compile with -O2. I could narrow it down to a few lines of code where an array is allocated to zero size. The following example demonstrates what I am doing, but compiles without any issues. The actual code (part of a bigger project) is attached. It requires some libraries and MPI to build/

program allocate_zero implicit none type :: tParameters real, allocatable, dimension(:,:) :: & gdot0_slip, & !< reference shear strain rate for slip gdot0_twin end type type(tParameters), dimension(:), allocatable :: param integer :: i allocate(param(3)) do i = 1, 3 associate(p => param(i)) if (i > 2) then allocate(p%gdot0_slip(0,0)) endif end associate enddo end program

Link Copied

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

I don't see any hanging of the program that you posted, neither with -O2 nor without. You mentioned MPI, maybe that is related to MPI? Or is the problem only in the longer example that you attached.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for the help.

To make sure, I cannot reproduce the behavior with a minimal working example.

I have investigated the behavior in more detail and figured out that is is related to the use of the following function which is called after the code I erroneously identified as the culprit in the original post:

!-------------------------------------------------------------------------------------------------- !> @brief vector expansion !> @details takes a set of numbers (a,b,c,...) and corresponding multiples (x,y,z,...) !> to return a vector of x times a, y times b, z times c, ... !-------------------------------------------------------------------------------------------------- pure function math_expand(what,how) implicit none real(pReal), dimension(:), intent(in) :: what integer, dimension(:), intent(in) :: how real(pReal), dimension(sum(how)) :: math_expand integer :: i if (sum(how) == 0) & return do i = 1, size(how) math_expand(sum(how(1:i-1))+1:sum(how(1:i))) = what(mod(i-1,size(what))+1) enddo end function math_expand

I use this function in 6 files and I causes problems only in 2 of them. As soon as I comment it out, it compiles.

It is always used like

prm%burgers_twin = math_expand(prm%burgers_twin,prm%Ntwin)

i.e. the left side gets reallocated according to the return value of the expansion function.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page