[MITgcm-devel] character array assignment, g77
Martin Losch
Martin.Losch at awi.de
Wed May 12 03:20:54 EDT 2010
Hi Jean-Michel,
OK you convinced me that I should not do anything. I'll keep a local copy of the changes , in case I ever want to use g77 in that old version again, and use gfortran instead (which seems to work)
Martin
On May 12, 2010, at 12:19 AM, Jean-Michel Campin wrote:
> Hi Martin,
>
> I am not in favour of changing something in the code for that
> until you can reproduce the error with a simple test.
>
> Did you try to add the same common block as in ctrl.h ?
>> common /controlvars_c/
>> & ncvargrd
>> & , yadprefix
>> character*(1) ncvargrd(maxcvars)
>> character*(2) yadprefix
> I don't see why it should matter but who knows.
>
> Apart from that, looking around to linux platforms, I only found
> g77 version working with gcc 3.4.6 (and not 3.4.0).
>
> Cheers,
> Jean-Michel
>
> On Tue, May 11, 2010 at 04:47:55PM +0200, Martin Losch wrote:
>> Hi Jean-Michel,
>>
>> forgot to include my testprogram, where I basically (hope to) do everything as in ctrl_init.F:
>>
>> program testchar
>> implicit none
>> integer i, n
>> parameter ( n = 60 )
>> character*(1) cvar(n)
>> do i=1,n
>> cvar(i) = 'z'
>> c print *, 'ml-z', i, cvar(i)
>> enddo
>> print *, 'ml-z', (cvar(i),i=1,n)
>> end
>>
>>> But in ctrl_pack.F, this is not an assignment (just a "write"), right ?
>> It's true, its not an assignment in ctrl_pack. In the grdchk_* routines, ncvargrd is used in if-statements such as:
>> if ( ncvargrd(grdchkvarindex) .eq. 'c' ) then
>>>
>>> Does this depend on how ncvargrd is declared ?
>> I have not tried changing the declaration, currently its like this:
>> character*(1) ncvargrd(maxcvars)
>> how would you suggest to change that?
>>
>> Martin
>>
>>>
>>> Jean-Michel
>>>
>>> On Tue, May 11, 2010 at 04:12:04PM +0200, Martin Losch wrote:
>>>> Hi there,
>>>>
>>>> I have this problem: with g77 on my AppleBookPro, I am getting an internal error when compiling routines like ctrl_init.F, the reason is this line
>>>> ncvargrd(ivar)= '?'
>>>> If I replace it with
>>>> ncvargrd(ivar)(:)= '?'
>>>> the compilation works. This
>>>> ncvargrd(ivar)(1:1)= '?'
>>>> does not work, the same is true for similar expressions in:
>>>> ctrl_init.F, ctrl_init_ctrlvar.F, ctrl_init_wet.F, grdchk_get_position.F, grdchk_init.F, grdchk_loc.F
>>>>
>>>> This routine has a similar expression for ncvargrd, but it works (can be compiled by g77):
>>>> ctrl_pack.F
>>>> Further I cannot reproduce this problem with a simple test program. What should I do, ignore this problem, because it is only related to g77 (more recent gfortran seems to work)? Or use the fix, which is dangerous as soon as ncvargrd will be longer than (1)?
>>>>
>>>> Martin
>>>>
>>>>> g77 -v
>>>>> Reading specs from /usr/local/lib/gcc/i686-apple-darwin8.8.1/3.4.0/specs
>>>>> Configured with: ../gcc-3.4.0/configure --enable-languages=f77
>>>>> Thread model: posix
>>>>> gcc version 3.4.0
>>>>
>>>>> gfortran -v
>>>>> Using built-in specs.
>>>>> Target: i686-apple-darwin9
>>>>> Configured with: ../gcc-4.3.1/configure --prefix=/sw --prefix=/sw/lib/gcc4.3 --mandir=/sw/share/man --infodir=/sw/share/info --enable-languages=c,c++,fortran,objc,java --with-arch=nocona --with-tune=generic --build=i686-apple-darwin9 --with-gmp=/sw --with-libiconv-prefix=/sw --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --disable-libjava-multilib
>>>>> Thread model: posix
>>>>> gcc version 4.3.1 (GCC)
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> MITgcm-devel mailing list
>>>> MITgcm-devel at mitgcm.org
>>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>>>
>>> _______________________________________________
>>> MITgcm-devel mailing list
>>> MITgcm-devel at mitgcm.org
>>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>>
>>
>> _______________________________________________
>> MITgcm-devel mailing list
>> MITgcm-devel at mitgcm.org
>> http://mitgcm.org/mailman/listinfo/mitgcm-devel
>
> _______________________________________________
> MITgcm-devel mailing list
> MITgcm-devel at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-devel
More information about the MITgcm-devel
mailing list