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

[netCDF #YYM-734195]: 64 bit SunStudio cc/f90 netcfd 4.0 run_tests.sh/tst_64bit.sh fails



Hi Udo,

On Feb 2, 2009, you sent us your results confirming the Sun compiler
error that I had suspected in compiling a netCDF source file under
the 64-bit environment.  At the time, you said you would try to
report the problem to Sun.

Did you happen to complete reporting the problem to Sun?  If so, did
you get any response acknowledging the bug report?  Did you get any
indication of a workaround or an estimate when the problem would be
fixed?

I'm asking becasue the bug has come up again on the netcdfgroup mailing
list, and I'd like to be able to report whether Sun was made aware of
the bug.

Thanks!

--Russ

> here's the solution with the Sun compiler:
> 
> ncdump/dumplib.c must be compiled using -O0 explicitly, otherwise
> -O2 is used by default. By hand, just remove dumplib.o, add -O0
> to CFLAGS in the Makefile (second occurence), and gmake . The
> depending programs are recompiled and the tests succeed.
> 
> This seems to be an optimizer bug, I've checked the code produced,
> and it does not set the xmm0 register in the complicated
> version and breaks calling ABI for libc, whereas your simple code
> below shows that it is set as expected. The value printed is just
> a random value in xmm0 used for something before. I've just halted the code
> before entering snprintf and set xmm0 explicitly to the value, continued,
> and, voila, the value printed is correct !
> 
> The instructions generated are TOTALLY different, a symptom I've seen
> very often, just adding a line somewhere completely changes the
> generated code, which makes it really hard to track down such errors.
> 
> I'll report this to Sun, maybe they've a better clue why this happens.
> 
> The tests run ok, but now break in nf_tests for missing symbols :
> 
> gmake[3]: Leaving directory `/home/Processor/software/netcdf-4.0/ncdump'
> gmake[2]: Leaving directory `/home/Processor/software/netcdf-4.0/ncdump'
> gmake[1]: Leaving directory `/home/Processor/software/netcdf-4.0/ncdump'
> Making check in nf_test
> gmake[1]: Entering directory `/home/Processor/software/netcdf-4.0/nf_test'
> gmake  nf_test tst_f77_v2     ftest tst_f90
> gmake[2]: Entering directory `/home/Processor/software/netcdf-4.0/nf_test'
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o test_get.o 
> test_get.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o test_put.o 
> test_put.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o nf_error.o 
> nf_error.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o nf_test.o nf_test.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o test_read.o 
> test_read.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o test_write.o 
> test_write.F
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o util.o util.F
> source='fortlib.c' object='fortlib.o' libtool=no \
> DEPDIR=.deps depmode=none /bin/bash ../depcomp \
> cc -DHAVE_CONFIG_H -I. -I.. -I../fortran     -m64 -xarch=sse3 -c -o
> fortlib.o fortlib.c
> /bin/bash ../libtool --tag=F77   --mode=link f95 -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none        -o nf_test
> test_get.o test_put.o nf_error.o nf_test.o test_read.o test_write.o util.o
> fortlib.o      ../libsrc/libnetcdf.la
> libtool: link: f95 -I../fortran -I../libsrc -I../fortran -M../f90 -m64
> -xarch=sse3 -ftrap=%none -o nf_test test_get.o test_put.o nf_error.o nf_test.o
> test_read.o test_write.o util.o fortlib.o  ../libsrc/.libs/libnetcdf.a
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o tst_f77_v2.o 
> tst_f77_v2.F
> /bin/bash ../libtool --tag=F77   --mode=link f95 -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none        -o tst_f77_v2
> tst_f77_v2.o      ../libsrc/libnetcdf.la
> libtool: link: f95 -I../fortran -I../libsrc -I../fortran -M../f90 -m64
> -xarch=sse3 -ftrap=%none -o tst_f77_v2 tst_f77_v2.o  
> ../libsrc/.libs/libnetcdf.a
> f95 -DHAVE_CONFIG_H -I. -I.. -I../fortran    -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none -c -o ftest.o ftest.F
> /bin/bash ../libtool --tag=F77   --mode=link f95 -I../fortran      -I../libsrc
> -I../fortran  -M../f90 -m64 -xarch=sse3 -ftrap=%none        -o ftest ftest.o
> fortlib.o      ../libsrc/libnetcdf.la
> libtool: link: f95 -I../fortran -I../libsrc -I../fortran -M../f90 -m64
> -xarch=sse3 -ftrap=%none -o ftest ftest.o fortlib.o  
> ../libsrc/.libs/libnetcdf.a
> f95  -I../fortran -I../f90      -I../libsrc -I../fortran   -M../f90 -g -c -o
> tst_f90.o tst_f90.f90
> /bin/bash ../libtool   --mode=link f95  -I../fortran -I../f90      -I../libsrc
> -I../fortran   -M../f90 -g        -o tst_f90 tst_f90.o
> ../libsrc/libnetcdf.la
> libtool: link: f95 -I../fortran -I../f90 -I../libsrc -I../fortran -M../f90 -g 
> -o
> tst_f90 tst_f90.o  ../libsrc/.libs/libnetcdf.a
> Undefined                       first referenced
> symbol                             in file
> nf_copy_att_                        ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_format_                      ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_attid_                       ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_dimid_                       ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_varid_                       ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf__open_mp_                        ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_var1_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_                             ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf__create_mp_                      ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_att_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_dim_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_var_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf__open_                           ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_abort_                           ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_int1_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_int2_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_text_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_text_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_close_                           ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_text_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_real_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vara_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_double_                  ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_double_                  ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_redef_                           ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_var1_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vara_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_var1_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_var1_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vars_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vara_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_double_                 ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_libvers_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_create_                          ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_delete_                          ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf__create_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_var1_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vara_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vara_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_var1_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_var1_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_var1_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vara_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vara_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vara_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_vara_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_var1_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_var1_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_def_dim_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_def_var_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf__enddef_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_enddef_                          ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_open_                            ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_sync_                            ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_del_att_                         ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_attname_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_int_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_set_base_pe_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_att_int_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vars_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_inq_base_pe_                     ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_set_fill_                        ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_strerror_                        ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_int2_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_int1_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_text_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_text_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_real_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_text_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_att_real_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_varm_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_int1_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_get_varm_int2_                   ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_put_vara_int_                    ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_rename_att_                      ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_rename_dim_                      ../libsrc/.libs/libnetcdf.a(netcdf.o)
> nf_rename_var_                      ../libsrc/.libs/libnetcdf.a(netcdf.o)
> ld: fatal: Symbol referencing errors. No output written to tst_f90
> 
> 
> libnetcdf.a seems to have two entries for each of the missing functions:
> 
> nm ../libsrc/.libs/libnetcdf.a |grep nf_create_
> [22]    |                1376|                 381|FUNC |GLOB |0    |2
> |nf_create_
> [359]   |         0|         0|FUNC |GLOB |0    |UNDEF  |nf_create_
> 
> So after the second definition it's undefined again. I started over
> after a gmake clean.
> 
> Any idea ?
> 
> Russ Rew wrote:
> >
> > The simple test case I wrote that duplicates code where the bug occurs
> > unfortunately works fine with cc -m64, so it just demonstrated that it's
> > not a simple compiler bug that can be easily isolated.  the simple test
> > case is here:
> >
> >   #include <stdio.h>
> >   #include <stdlib.h>
> >   #define PRIM_LEN 100
> >   int
> >   main(int argc, char *argv[]) {
> >       double vv = 4.0;
> >       char sout[100];
> >       const char *fmt = "%.15g";
> >
> >       snprintf(sout, PRIM_LEN, fmt, vv);
> >       printf("%s\n", sout);
> >       return 0;
> >   }
> >
> > which prints "4", as expected.  But ncdump using dumplib.c compiled with
> > cc -m64 goes through this same code with the same values for the
> > variables in the ncdouble_val_tostring() function and instead gets
> > "8.88178419700125e-16" in sout, which in hex is 3ccffffffffffffe.
> >
> > So one way to attack the problem would be to run dbx in these two cases,
> > stepping into instructions with stepi and nexti to see where the
> > difference occurred and see if that could be attributed to something
> > haven gotten clobbered or a compiler error.
> >
> > I'd be very grateful if you succeed in tracking this down, as I'm not
> > familiar with x86 machine instructions.
> >
> >>>> Hello again,
> 

> >>> Ticket Details
> >>> ===================
> >>> Ticket ID: YYM-734195
> >>> Department: Support netCDF
> >>> Priority: Normal
> >>> Status: Closed
> >>>
> >>
> >> --
> >> Dr. Udo Grabowski                           email: address@hidden
> >> Institut f. Meteorologie und Klimaforschung ASF,Forschungszentrum Karlsruhe
> >> Postfach 3640, 76021 Karlsruhe, Germany             Tel: (+49) 7247 82-6026
> >> http://www.fzk.de/imk/asf/sat/grabowski/            Fax:         "    -7026
> 
> 
> --
> Dr. Udo Grabowski                           email: address@hidden
> Institut f. Meteorologie und Klimaforschung ASF,Forschungszentrum Karlsruhe
> Postfach 3640, 76021 Karlsruhe, Germany             Tel: (+49) 7247 82-6026
> http://www.fzk.de/imk/asf/sat/grabowski/            Fax:         "    -7026
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: YYM-734195
Department: Support netCDF
Priority: Normal
Status: Closed