From ead15be71b6009004b07c9c2013b8c2e066fa02b Mon Sep 17 00:00:00 2001 From: eschnett Date: Wed, 9 Nov 2011 13:15:43 +0000 Subject: Pass unallocated arrays to Fortran as NULL pointers The deleted comment is wrong. We should always pass unallocated arrays to Fortran to catch allocation errors. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4768 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/sbin/GridFuncStuff.pl | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'lib/sbin') diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index f564d954..20081246 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -98,25 +98,8 @@ sub CreateVariableBindings push(@data, '#define PASS_GROUPLEN(thorn, group) CCTKGROUPNUM_##group >= 0 ? \\'); push(@data, ' CCTKi_GroupLengthAsPointer(#thorn "::" #group) : &_cctk_zero'); push(@data, ''); - push(@data, '/*'); - push(@data, ' * References to non-existing or non-allocated variables should be passed'); - push(@data, ' * as NULL pointers in order to catch any invalid access immediately'); - push(@data, ' * However, this runtime debugging feature may cause problems'); - push(@data, ' * with some fortran compilers which require all fortran routine arguments'); - push(@data, ' * to refer to a valid memory location (eg. to enable the code optimizer'); - push(@data, ' * to generate conditional load/store instructions if applicable).'); - push(@data, ' * For this reason, we pass NULL pointers only for debugging configurations,'); - push(@data, ' * and a pointer to a user-accessable memory location (a local dummy variable)'); - push(@data, ' * otherwise.'); - push(@data, ' */'); - push(@data, '#ifdef CCTK_DEBUG'); push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 ? \\'); push(@data, ' GH->data[CCTKARGNUM_##var][level] : 0'); - push(@data, '#else'); - push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 && \\'); - push(@data, ' GH->data[CCTKARGNUM_##var][level] ? \\'); - push(@data, ' GH->data[CCTKARGNUM_##var][level] : _cctk_dummy_var'); - push(@data, '#endif'); push(@data, ''); push(@data, '#define CCTK_ARGUMENTS CCTK_CARGUMENTS'); @@ -225,16 +208,10 @@ sub CreateVariableBindings push(@data, '{'); push(@data, ' cGH *GH = _GH;'); push(@data, ' const int _cctk_zero = 0;'); - push(@data, '#ifndef CCTK_DEBUG'); - push(@data, ' CCTK_COMPLEX _cctk_dummy_var[4];'); - push(@data, '#endif'); push(@data, " void (*function)(\U$thorn\E_C2F_PROTO);"); push(@data, " DECLARE_\U$thorn\E_C2F"); push(@data, " INITIALISE_\U$thorn\E_C2F"); push(@data, ' (void) (_cctk_zero + 0);'); - push(@data, '#ifndef CCTK_DEBUG'); - push(@data, ' (void) (_cctk_dummy_var + 0);'); - push(@data, '#endif'); push(@data, ''); push(@data, " function = (void (*) (\U$thorn\E_C2F_PROTO)) fpointer;"); push(@data, " function (PASS_\U$thorn\E_C2F (GH));"); -- cgit v1.2.3