Re: Something is wrong with integer array in external fortran code

From: 李嘉鹏 <lijpbasin_at_nyahnyahspammersnyahnyah>
Date: Mon May 07 2012 - 19:45:39 MDT

At 2012-05-07 22:59:21,"Mary Haley" <haley@ucar.edu> wrote:
>
>Hi,
>
>The problem seems to be with these two lines in your print_array.stub file:
>
> integer dat
> dimension dat(n)
>
>It works if you do this:
>
> integer dat(n)
>
>I will add this to the list of "issues" with WRAPIT. It seems like what you did should work, but I'm guessing the WRAPIT parser only looks at "integer dat", and misses the "dimension dat(n)" part.
I don't think it's caused by the WRAPIT parser missing the "dimension dat(n)" part. It's something more like Liu said. Since the print_int procedure can handle real array, without printing out a warning message.
At first I thought I might get fortran implicit types messed up, but fortran can produce the expected results (uncomment the fortran main program part in print_array.f and do a test), I guess it's WRAPIT causing the problem.
>
>I will file a ticket on this.
>
>--Mary
>
>
>On May 7, 2012, at 1:17 AM, 李嘉鹏 wrote:
>
>> Hi, Some integer array argument passing failed in my program. The three small bits of code can reproduce it.
>>
>> WRAPIT print_array.f90 print_array.stub
>> ncl my_print.ncl
>>
>> Gives the following results:
>>
>> Copyright (C) 1995-2011 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 6.0.0
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>> (0) 1
>> (1) 2
>> (2) 3
>> (3) 4
>> (4) 5
>> warning:Argument 1 of the current function or procedure was coerced to the appropriate type and thus will not change if the function or procedure modifies its value
>> 1065353216 1073741824 1077936128 1082130432 1084227584
>> (0) 1
>> (1) 2
>> (2) 3
>> (3) 4
>> (4) 5
>> 1.00000000 2.00000000 3.00000000 4.00000000 5.00000000
>>
>> print_real seems to work while print_int fails, is there something wrong with the fortran code?
>>
>>
>> $ gfortran -v
>> Using built-in specs.
>> Target: x86_64-redhat-linux
>> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
>> Thread model: posix
>> gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
>>
>> $ uname -a
>> Linux xxx 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
>>
>>
>>
>> <my_print.ncl><print_array.f90><print_array.stub>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Mon May 7 19:45:51 2012

This archive was generated by hypermail 2.1.8 : Thu May 10 2012 - 16:57:50 MDT