View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum ↗

iraf-v216 · Code · Issues (50) · Pull requests (81)

iraf.net Issue #63

[linux] sections fail: integer divide by zero

closed closed olebole opened this issue on 2017-05-16 · 1 comments


olebole commented on 2017-05-16

On linux (32 bit), many (but not all) operations with sections fail due to a divide-by-zero error:

ecl> imhead dev$pix  
dev$pix[512,512][short]: m51  B  600s  
ecl> imhead dev$pix[10:20,10:20]  
dev$pix[10:20,10:20][11,11][short]: m51  B  600s  
ecl> imcopy dev$pix im1  
dev$pix -> im1  
ecl> imcopy dev$pix[10:20,10:20] im2  
dev$pix[10:20,10:20] -> im2  
ERROR: integer divide by zero  

On linux64, that works well.


olebole commented on 2017-05-17

The signal appears in sys/nmemio/msvfwa.x:

[...]  
	} else if (nbits == 32) {   
  
	    if (sizeof(dtype) < sz_align)  
	        offset = (nelem / (SZ_INT / sizeof(dtype))) + 1 # <-----------------  
	    else  
	        offset = (nelem * sizeof (dtype)) / SZB_CHAR  
	}  

If sizeof(dtype) is greater than SZ_INT, then a division by zero appears. This may be connected to #57, since this PR introduces a data size that is smaller than sz_align (8) but bigger than SZ_INT (2), but the marked line looks really buggy.


Fixed in #67


Last updated on 2017-05-23