Crash if trying to write a parameter or a constant in a Fortran application

Philippe Wautelet Philippe.Wautelet at idris.fr
Fri Jul 5 07:31:40 CDT 2013


Hello,

When I try to write a parameter or a constant in a Fortran application, 
pnetcdf crashes.

I attached a simple code that reproduces the problem. If I look at the stack 
trace, I get on my computer:
Program received signal SIGSEGV, Segmentation fault.
0x00000000004287d5 in ncmpii_in_swapn (buf=0x42be38, nelems=1, 
esize=<optimized out>) at convert_swap.c:117
117                 dest[i] = htonl(dest[i]);
(gdb) bt
#0  0x00000000004287d5 in ncmpii_in_swapn (buf=0x42be38, nelems=1, 
esize=<optimized out>) at convert_swap.c:117
#1  0x0000000000418b18 in ncmpii_getput_vars (ncp=0x8e32c0, varp=0x8eb660, 
start=0x0, count=0x0, stride=0x0, buf=0x42be38, bufcount=1, buftype=0x6b3f20, 
rw_flag=0, io_method=0) at getput_vars.c:413
#2  0x00000000004162fa in ncmpi_put_var1_int (ncid=<optimized out>, 
varid=<optimized out>, start=0x0, op=0x42be38) at getput_var1.c:100
#3  0x000000000040b11e in pnetcdf_parameter_bug () at 
pnetcdf_parameter_bug.f90:25
#4  0x000000000040b172 in main (argc=1, argv=0x7fffffffd97a 
'/mnt/lin2/sos/wautelet/a.out\000') at pnetcdf_parameter_bug.f90:2
#5  0x0000003b2242135d in __libc_start_main () from /lib64/libc.so.6
#6  0x000000000040aef9 in _start ()

Apparently, pnetcdf tried to swap bytes of the 'variable'. But as it is a 
parameter, its address is not modifiable. There is an easy workaround: copy the 
data in a 'true' variable but I think it is something that should be 
corrected.

Best regards,

Philippe Wautelet


--------------------------------------------------------------------
Philippe Wautelet (Research Engineer)   wautelet at idris.fr
Tel. : 01 69 35 85 76                   Fax : 01 69 85 37 75
IDRIS, Batiment 506, BP 167, 91403 ORSAY Cedex, France
Prof. website   : http://www.idris.fr
--------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pnetcdf_parameter_bug.f90
Type: text/x-fortran
Size: 851 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20130705/aa26858b/attachment.bin>


More information about the parallel-netcdf mailing list