From 673220f1a9e5cd6479886b125d6b5e02a5175df8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 7 Oct 2014 11:41:48 +0200 Subject: [PATCH] Bug in IRP_stack corrected --- src/irp_stack.py | 6 +++--- src/variable.py | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/irp_stack.py b/src/irp_stack.py index 3506ea6..0a5a9d0 100644 --- a/src/irp_stack.py +++ b/src/irp_stack.py @@ -131,15 +131,15 @@ end subroutine !$OMP END PARALLEL !$OMP CRITICAL if (.not.alloc) then - allocate(irp_stack(STACKMAX,nthread+1)) - allocate(irp_cpu(STACKMAX,nthread+1)) + allocate(irp_stack(0:STACKMAX,nthread+1)) + allocate(irp_cpu(0:STACKMAX,nthread+1)) allocate(stack_index(nthread+1)) stack_index = 0 alloc = .True. endif !$OMP END CRITICAL endif - stack_index(ithread+1) = stack_index(ithread+1)+1 + stack_index(ithread+1) = mod(stack_index(ithread+1)+1,STACKMAX) irp_stack(stack_index(ithread+1),ithread+1) = irp_where""") if command_line.do_memory: txt+=""" diff --git a/src/variable.py b/src/variable.py index a5449d1..d678727 100644 --- a/src/variable.py +++ b/src/variable.py @@ -433,7 +433,7 @@ class Variable(object): def free(self): if '_free' not in self.__dict__: name = self.name - result = [ "!","! >>> FREE %s"%(self.name), + result = [ "!","! >>> FREE %s"%(name), " %s_is_built = .False."%(self.same_as) ] if self.dim != []: if command_line.do_memory: @@ -495,7 +495,10 @@ class Variable(object): return result def do_allocate(): - result = " allocate(%s(%s),stat=irp_err)" + if command_line.coarray: + result = " allocate(%s(%s)[*],stat=irp_err)" + else: + result = " allocate(%s(%s),stat=irp_err)" result = result%(name,','.join(self.dim)) if command_line.do_memory: tmp = "\n print *, %s, 'Allocating %s(%s)'"