Till,
After closer inspection, I see that there were two entries in the CVS
log related to this issue. Attached is the one that applies to
preserving the alignment returned by ::new(). The change reported in my
previous message will have no impact because it is only rearranging
fields in a union. Sorry about the confusion. I added "diff -c" to my
.cvsrc file and I now receive context diffs from CVS.
Revision : 1.22
Date : 2002/1/15 16:46:11
Author : 'jhill'
State : 'Exp'
Lines : +2 -2
Description :
fixed to preserve 8 byte alignment
cvs diff -r 1.22 -r 1.21 tsFreeList.h (in directory
D:\users\hill\epicsDvl\epics\base\src\libCom\cxxTemplates\)
Index: tsFreeList.h
===================================================================
RCS file:
/net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/cxxTemplates/tsFreeL
ist.h,v
retrieving revision 1.22
retrieving revision 1.21
diff -c -r1.22 -r1.21
*** tsFreeList.h 2002/01/15 16:46:11 1.22
--- tsFreeList.h 2001/12/14 00:36:25 1.21
***************
*** 1,5 ****
! /* $Id: tsFreeList.h,v 1.22 2002/01/15 16:46:11 jhill Exp $
*
* L O S A L A M O S
* Los Alamos National Laboratory
--- 1,5 ----
! /* $Id: tsFreeList.h,v 1.21 2001/12/14 00:36:25 jhill Exp $
*
* L O S A L A M O S
* Los Alamos National Laboratory
***************
*** 78,85 ****
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
- tsFreeListItem < T, DEBUG_LEVEL > items [N];
tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
--- 78,85 ----
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
struct tsFreeListChunk {
tsFreeListChunk < T, N, DEBUG_LEVEL > *pNext;
+ tsFreeListItem < T, DEBUG_LEVEL > items [N];
};
template < class T, unsigned N = 0x400, unsigned DEBUG_LEVEL = 0u >
*****CVS exited normally with code 1*****
Jeff
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Till Straumann
> Sent: Tuesday, April 09, 2002 6:35 PM
> To: [email protected]
> Cc: [email protected]
> Subject: Re: ca_test bus error on solaris-sparc-gnu + fix
>
> Jeff Hill wrote:
>
> > Till,
> >
> > I think that we already eradicated that one along the way to the
next
> > R3.14 release. See attached. Nevertheless, thanks for the heads up.
> >
> > Jeff
>
> Jeff.
>
> >From the attached diff it is not obvious to me what your fix is
> - would you mind giving me a hint, please?
>
> I am not sure if 8byte alignment is enough
> (e.g. optimized code on PPC/altivec may need 16 bytes.)
> IMHO, it would be best to preserve the alignment
> returned by malloc()
>
> -- Till
>
> >
> >
> > ----------------------------
> > Revision : 1.23
> > Date : 2002/1/15 20:2:45
> > Author : 'jhill'
> > State : 'Exp'
> > Lines : +2 -2
> > Description :
> > fixed to preserve 8 byte alignment
> >
> > cvs diff -r 1.23 -r 1.22 tsFreeList.h (in directory
> > D:\users\hill\epicsDvl\epics\base\src\libCom\cxxTemplates\)
> > Index: tsFreeList.h
> > ===================================================================
> > RCS file:
> >
>
/net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/cxxTemplates/tsFreeL
> > ist.h,v
> > retrieving revision 1.23
> > retrieving revision 1.22
> > diff -r1.23 -r1.22
> > 2c2
> > < /* $Id: tsFreeList.h,v 1.23 2002/01/15 20:02:45 jhill Exp $
> > ---
> > > /* $Id: tsFreeList.h,v 1.22 2002/01/15 16:46:11 jhill Exp $
> > 75d74
> > < char pad[ sizeof ( T ) ];
> > 76a76
> > > char pad[ sizeof ( T ) ];
> >
> > *****CVS exited normally with code 1*****
> >
> > > -----Original Message-----
> > > From: [email protected]
> > > [mailto:[email protected]] On Behalf Of Till
Straumann
> > > Sent: Thursday, April 04, 2002 9:04 PM
> > > To: [email protected]
> > > Cc: [email protected]
> > > Subject: ca_test bus error on solaris-sparc-gnu + fix
> > >
> > > Hi all.
> > >
> > > We got a SIGBUS (due to an alignment violation)
> > > running ca_test (and other apps)
> > >
> > > EPICS: 3.14.0.beta1
> > > system: solaris-sparc-gnu
> > > compiler: egcs-2.91.66
> > >
> > > I found that
> > >
> > > void *
> > > tsFreeList<T,N,DEBUG_LEVEL>::allocate(size_t)
> > >
> > > may return improperly aligned memory:
> > > Because 'items' are declared
> > >
> > > union {
> > > tsFreeListItem<T,...> *pNext;
> > > char pad[sizeof(T)];
> > > }
> > >
> > > the compiler only makes sure 'items' fulfill
> > > the alignment requirements of pNext.
> > >
> > > However, 'items' may need stricter alignment
> > > (which goes unnoticed because the 'item' pointer
> > > is later cast to (void*)): e.g. it may contain a double
> > > which on sparc needs to be 8byte aligned...
> > >
> > > The proposed fix is to put the 'items' into a
> > > chunk first, so they get the chunk's alignment.
> > >
> > > Unfortunately, this fix breaks binary compatibility
> > > - everything needs to be rebuilt.
> > >
> > > Regards,
> > >
> > > -- Till
- Replies:
- Re: ca_test bus error on solaris-sparc-gnu + fix Till Straumann
- References:
- Re: ca_test bus error on solaris-sparc-gnu + fix Till Straumann
- Navigate by Date:
- Prev:
Re: waveform record question Marty Kraimer
- Next:
NAN and INF Marty Kraimer
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: ca_test bus error on solaris-sparc-gnu + fix Andrew Johnson
- Next:
Re: ca_test bus error on solaris-sparc-gnu + fix Till Straumann
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
<2002>
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|