Double allocation error in mesh3d.F90
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Siesta | Status tracked in Trunk | |||||
4.0 |
Fix Committed
|
Low
|
Unassigned | |||
4.1 |
Fix Committed
|
Low
|
Unassigned | |||
Trunk |
Fix Committed
|
Low
|
Alberto Garcia |
Bug Description
In the trunk branch, for revnos > 740 (I didn't go earlier), if I compile SIESTA with GCC and the following FFLAGS for debugging:
-g3 -ggdb -fPIC -fbacktrace -fcheck=
I get a runtime error about the nodeboxes array in SiestaXC/
At line 2992 of file /home/pouillon/
Fortran runtime error: Attempting to allocate already allocated variable 'nodeboxes'
GCC 5.4, 6.3 and 6.4 give me the same error, while other compilers with equivalent flags don't detect it. Without the -fcheck and -fno-automatic flags, the error disappears.
The attached patch fixes this minor issue.
Changed in siesta: | |
status: | Triaged → Fix Committed |
Having a 2nd look at the code, it may be even easier to delete the `nodesBoxes`, i.e. something like this:
=== modified file 'Src/SiestaXC/ mesh3d. F90' mesh3d. F90 2017-02-17 13:28:06 +0000 mesh3d. F90 2018-12-14 10:29:28 +0000 len=*), parameter: : errHead = myName//'ERROR: ' distrType) ,pointer: : distr, newDistr, oldDistr allocatable: : axisBox(:,:,:), nodeBoxes(:,:,:), partBox(:,:,:) allocatable: : axisBox(:,:,:), partBox(:,:,:)
factor( maxFactors) , groupSize, & 2,3,0:totNodes- 1) )
--- Src/SiestaXC/
+++ Src/SiestaXC/
@@ -2926,7 +2926,7 @@
character(
integer, parameter:: maxFactors = 100 ! Max prime factors in nNodes
type(
- integer,
+ integer,
integer:: axis, axisNodes(3), blockSize, boxSize, &
i1, i2, i3, iAxis, iBox, iDistr, iFac, iID, iNode, iPow, &
@@ -2989,9 +2989,7 @@
! Handle box argument with priority
if (present(box)) then
! Collect all node boxes and store them
- allocate( nodeBoxes(
- call gatherBoxes( box, nodeBoxes )
- distr%box = nodeBoxes
+ call gatherBoxes( box, distr%box )
goto 999 ! Exit, since no other arguments must be considered in this case
end if ! (present(box))