[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 980109: netcdf3 interface (bug?)



Jim,

>Date: Tue, 27 Jan 1998 10:03:03 -0700 
>From: Jim Edwards <address@hidden>
>Organization: NOAA/FSL
>To: Steve Emmerson <address@hidden>
>Subject: Re: 980109: netcdf3 interface (bug?) 
>Keywords: 199801092007.NAA06889

In the above message, you wrote:

> I hope you don't mind continuing this discussion, i know there are
> times when i want to just filter my e-mail into /dev/null.
> I had to do some flips and twists to get to this point but i think i've
> finally figured out what is going on.  First our netcdf is compiled
> with the f77 compiler which handles the extended types integer*2
> integer*1 and byte.  When I link this to my f90 compiled code which
> does not handle these types I'm asking for trouble.

The SunOS 5.5 f77(1) compiler supports the INTEGER*1 type, which is
an 8-bit signed integer.  The SunOS 5.5 f90(1) compiler also supports
the INTEGER*1 type, but as a 32-bit signed integer.  This means that
one shouldn't use the Fortran "_int1" netCDF functions unless one uses
the same compiler that built the netCDF library.  Since the "_int1"
functions are supplied as a courtesy only, this shouldn't be a problem.

The above also holds for the _int2 functions.

> But your note
> below confused me, if you are in fact compiling with f90 you should
> get the same result i do.  So I went back and starting from the
> netcdf-3.3.1 source attempted to rebuild netcdf using f90 instead of
> f77, it doesn't look like there is a command line option to do this so
> first i took f77 out of my path.  This failed because it told me i
> didn't have fortran at all.  Then I made a link called f77 which
> pointed at f90, this worked up until the test in configure which looks
> like:
> 
>     for type in byte integer*1 integer; do
>       cat >conftest.f <<EOF
>                $type foo
>                end
> EOF
>       doit='$FC -c ${FFLAGS} conftest.f'
>       if { (eval echo configure:1882: \"$doit\") 1>&5; (eval $doit) 2>&5; }; 
> then
>           break;
>       fi
>     done
> 
> and results in part in the following output:
> 
> configure:1882: f90 -c  conftest.f
> 
>                integer*1 foo
>                        ^     
> cf90-391 f90comp: WARNING $MAIN, File = conftest.f, Line = 1, Column = 24 
>   Type INTEGER*1 will be mapped to INTEGER*4.
> 
> f90: SunSoft F90 Version 1.0.1.0  (21229283) Tue Jan 27, 1998  09:55:03
> f90: COMPILE TIME 0.070000 SECONDS
> f90: MAXIMUM FIELD LENGTH 2477680 DECIMAL WORDS
> f90: 2 SOURCE LINES
> f90: 0 ERRORS, 1 WARNINGS, 0 OTHER MESSAGES, 0 ANSI
> f90: CODE: 12 WORDS, DATA: 1 WORDS
> 
> since this is a warning and not an error, the test passes.  In my
> opinion this test should fail,

Possibly the test should fail.  I chose not to do that because it would
prevent porting code that used the "_int1" or "_int2" functions to new
systems.

As I see it, you have the following options:

    1.  Don't use the "_int1" or "_int2" functions.

    2.  Use the same Fortran compiler that was used to build the netCDF
        library.

    3.  Install two versions of the netCDF library (one built using
        f77(1) and the other using f90(1)) and always use the
        one appropriate to the compiler you use.

If you chose option 3, then be sure to execute a "make distclean" prior
to any "make".

--------
Steve Emmerson   <http://www.unidata.ucar.edu>