njoy / NJOY2016

Nuclear data processing with legacy NJOY
https://www.njoy21.io/NJOY2016
Other
98 stars 86 forks source link

Compiler dependent issue when calling tabize in acer multiple times #103

Closed whaeck closed 6 years ago

whaeck commented 6 years ago

Received the following email from A. Trkov (IAEA)

I think I found a compiler-dependent bug when trying to process U-235 from ENDF/B-VIII.0 The array scr is not deallocated. Multiple calls to tabize cause failure. The scr array is local and it should not be a problem in principle, but it is not safe. With Lahey compiler NJOY crashes.

I solved the problem by adding the statement below before each “return” statement (3x): !--- Trkov if (allocated(scr)) deallocate(scr) !--- Trkov

Perhaps the conditional deallocation is superfluous since scr is allocated unconditionally within the subroutine, but it does not do any harm. The but is applicable to the latest NJOY2012 as well.

-- acer... 571.6s An ALLOCATE statement cannot be executed for an allocatable array (1-th argument:scr) which is currently allocated. Error occurs at or near line 789 of _acefc@tabize Called from or near line 472 of _acefc@first Called from or near line 155 of _acefc@acetop Called from or near line 423 of _acem@acer Called from or near line 238 of _MAIN__

whaeck commented 6 years ago

A simpler solution was adopted: by checking if scr is allocated before allocating it. This avoids checking at every return statement.

whaeck commented 6 years ago

Merged in #104