On Thu, Jan 28, 2010 at 06:07:37PM +0100, Francesco P. Lovergine wrote:
> On Thu, Jan 28, 2010 at 05:48:21PM +0100, Francesco Paolo Lovergine wrote:
> > Package: hdf5
> > Version: 1.8.4-3
> > Severity: normal
> > 
> > H5detect segfaults as follows:
> > 
> >  * Modifications:
> >  *
> >  *      DO NOT MAKE MODIFICATIONS TO THIS FILE!
> >  *      It was generated by code in `H5detect.c'.
> >  *
> >  *-------------------------------------------------------------------------
> >  */
> > 
> > Program received signal SIGBUS, Bus error.
> > 0x00013994 in detect_C89_integers () at ../../../src/H5detect.c:1317
> > 1317        DETECT_I(short,               SHORT,        d_g[nd_g]); nd_g++;
> > 
> 
> This is an already seen error in 1.6 series, cfr:
> http://bugs.gentoo.org/118777
> 

ALIGNMENT macro should install a SIGBUS handler, but it apparently fails (?) in 
doing that...

#if defined(H5_HAVE_LONGJMP) && defined(H5_HAVE_SIGNAL)
#define ALIGNMENT(TYPE,INFO) {                                                \
    char                *volatile _buf = NULL;                                \
    volatile TYPE       _val = 1;                                               
      \
    volatile TYPE       _val2;                                                \
    volatile size_t     _ano = 0;                                             \
    void                (*_handler)(int) = signal(SIGBUS, sigbus_handler);    \
    void                (*_handler2)(int) = signal(SIGSEGV, sigsegv_handler);   
\
                                                                              \
    _buf = (char*)malloc(sizeof(TYPE) + align_g[NELMTS(align_g) - 1]);        \
    if(setjmp(jbuf_g)) _ano++;                                                \
    if(_ano < NELMTS(align_g)) {                                              \
        *((TYPE*)(_buf+align_g[_ano])) = _val; /*possible SIGBUS or SEGSEGV*/   
\
        _val2 = *((TYPE*)(_buf+align_g[_ano])); /*possible SIGBUS or SEGSEGV*/  
\
        /* Cray Check: This section helps detect alignment on Cray's */       \
        /*              vector machines (like the SV1) which mask off */      \
        /*              pointer values when pointing to non-word aligned */   \
        /*              locations with pointers that are supposed to be */    \
        /*              word aligned. -QAK */                                 \
        memset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]);          \
        /*How to handle VAX types?*/                                          \
        if(INFO.perm[0]) /* Big-Endian */                                     \
            
memcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char 
*)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8));
 \
        else /* Little-Endian */                                              \
            memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char 
*)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \
        _val2 = *((TYPE*)(_buf+align_g[_ano]));                               \
        if(_val!=_val2)                                                       \
            longjmp(jbuf_g, 1);                                               \
        /* End Cray Check */                                                  \
        (INFO.align)=align_g[_ano];                                           \
    } else {                                                                  \
        (INFO.align)=0;                                                       \
        fprintf(stderr, "unable to calculate alignment for %s\n", #TYPE);     \
    }                                                                         \
    free(_buf);                                                               \
    signal(SIGBUS, _handler); /*restore original handler*/                    \
    signal(SIGSEGV, _handler2); /*restore original handler*/                  \
}
#else
#define ALIGNMENT(TYPE,INFO) (INFO.align)=0
#endif


-- 
Francesco P. Lovergine



_______________________________________________
Pkg-grass-devel mailing list
Pkg-grass-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-grass-devel

Reply via email to