pkgsrc-Bugs archive

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

Re: pkg/30106



segv wrote:
 It's not just Solaris problem, it's a 64-bit issue which will bite on 64-bit 
platforms like UltraSparc, not matter which OS is installed

I think source code itself has problem.
I tested this problem with attached source code on sparc64.
Simply compiled code has problem you mentioned.
But shared object created from this source code doesn't dump core.
I don't have much knowledge about toolchain nor sparc asm lang.
I don't known whether data is properly aligned or unaligned access is prevented. Anyway I never see this problem with alpha, amd64, sparc64(all NetBSD). And there is a official distribution for Solaris.
I wonder this patch is really required or not....
#include        <inttypes.h>

#define TX_DOUBLE_HI32_SIGNBIT   0x80000000
#define TX_DOUBLE_HI32_EXPMASK   0x7ff00000 
#define TX_DOUBLE_HI32_MANTMASK  0x000fffff
 
typedef uint32_t PRUint32;

//-- Initialize Double related constants
#ifdef IS_BIG_ENDIAN
const PRUint32 nanMask[2] =    {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK
, 
                                0xffffffff};
const PRUint32 infMask[2] =    {TX_DOUBLE_HI32_EXPMASK, 0};
const PRUint32 negInfMask[2] = {TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_SIGNBIT,
 0};
#else   
const PRUint32 nanMask[2] =    {0xffffffff,
                                TX_DOUBLE_HI32_EXPMASK | TX_DOUBLE_HI32_MANTMASK
};  
const PRUint32 infMask[2] =    {0, TX_DOUBLE_HI32_EXPMASK};
const PRUint32 negInfMask[2] = {0, TX_DOUBLE_HI32_EXPMASK | 
TX_DOUBLE_HI32_SIGNBIT};
#endif
        
const double NaN = *((double*)nanMask); 
const double POSITIVE_INFINITY = *((double*)infMask);
const double NEGATIVE_INFINITY = *((double*)negInfMask);

double
get_double()
{
        return NaN;
}

#if 0
main()
{
        printf("%f", get_double());
}
#endif


Home | Main Index | Thread Index | Old Index