Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-10 Thread Richard Henderson
On 08/10/2011 09:52 AM, Steve Ellcey wrote: > * md5.c (md5_read_ctx): Handle mis-aligned resbuf pointer. Ok. r~

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-10 Thread Steve Ellcey
On Wed, 2011-08-10 at 11:19 +0200, Richard Guenther wrote: > On Wed, Aug 10, 2011 at 10:48 AM, Pedro Alves wrote: > > > > which makes me wonder if the right fix isn't to change > > libiberty internally to not rely on the alignment. > > I think that would be the best fix. It hardly can be a perfo

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-10 Thread Richard Guenther
On Wed, Aug 10, 2011 at 10:48 AM, Pedro Alves wrote: > On Wednesday 10 August 2011 01:02:50, Steve Ellcey wrote: >> On Tue, 2011-08-09 at 16:50 -0700, Richard Henderson wrote: >> > > >> > > I think I like using a union to ensure the alignment of checksum better. >> > > In dwarf2out.c we are always

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-10 Thread Pedro Alves
On Wednesday 10 August 2011 01:02:50, Steve Ellcey wrote: > On Tue, 2011-08-09 at 16:50 -0700, Richard Henderson wrote: > > > > > > I think I like using a union to ensure the alignment of checksum better. > > > In dwarf2out.c we are always using one md5_ctx structure and one > > > checksum buffer

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-09 Thread Steve Ellcey
On Tue, 2011-08-09 at 16:50 -0700, Richard Henderson wrote: > > > > I think I like using a union to ensure the alignment of checksum better. > > In dwarf2out.c we are always using one md5_ctx structure and one > > checksum buffer but in fold-const.c there are routines where we use one > > md5_ctx

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-09 Thread Richard Henderson
On 08/09/2011 02:32 PM, Steve Ellcey wrote: > On Tue, 2011-08-09 at 08:25 -0700, Richard Henderson wrote: >> On 08/08/2011 03:22 PM, Steve Ellcey wrote: >>> Oh, so after I declare md5, I call md5_finish_ctx like: >>> >>> md5_finish_ctx (&md5.ctx, md5.checksum); >>> >>> Is that what you are pro

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-09 Thread Steve Ellcey
On Tue, 2011-08-09 at 08:25 -0700, Richard Henderson wrote: > On 08/08/2011 03:22 PM, Steve Ellcey wrote: > > Oh, so after I declare md5, I call md5_finish_ctx like: > > > > md5_finish_ctx (&md5.ctx, md5.checksum); > > > > Is that what you are proposing? It seems a bit odd to put checksum i

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-09 Thread Richard Henderson
On 08/08/2011 03:22 PM, Steve Ellcey wrote: > Oh, so after I declare md5, I call md5_finish_ctx like: > > md5_finish_ctx (&md5.ctx, md5.checksum); > > Is that what you are proposing? It seems a bit odd to put checksum in a > a structure with ctx just to guarantee its alignment and not to

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-08 Thread Steve Ellcey
On Fri, 2011-08-05 at 11:45 -0700, Richard Henderson wrote: > On 08/05/2011 10:54 AM, Steve Ellcey wrote: > > - unsigned char checksum[16]; > >struct md5_ctx ctx; > > + unsigned char checksum[16]; > > How about > > struct md5_data > { > struct md5_ctx ctx; > unsigned char checks

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-08 Thread Richard Henderson
On 08/08/2011 02:24 PM, Steve Ellcey wrote: > Do you mean a union, as Andreas suggested? No, I mean struct. The union is wrong, because both data elements are live at the same time. r~

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-08 Thread Steve Ellcey
On Fri, 2011-08-05 at 11:45 -0700, Richard Henderson wrote: > On 08/05/2011 10:54 AM, Steve Ellcey wrote: > > - unsigned char checksum[16]; > >struct md5_ctx ctx; > > + unsigned char checksum[16]; > > How about > > struct md5_data > { > struct md5_ctx ctx; > unsigned char checks

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-05 Thread Richard Henderson
On 08/05/2011 10:54 AM, Steve Ellcey wrote: > - unsigned char checksum[16]; >struct md5_ctx ctx; > + unsigned char checksum[16]; How about struct md5_data { struct md5_ctx ctx; unsigned char checksum[16]; }; struct md5_data md5; with the structure definition somewhere inte

Re: [patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-05 Thread Andreas Schwab
Steve Ellcey writes: > Obviously this isn't a perfect fix, it is relying on how GCC is laying > out local variables which isn't gauranteed, but it fixes the problem and > I thought I would see if I could get approval for this simple fix or if > people think we need a more complete fix. Why not m

[patch, ia64] Fix unaligned accesses on IA64 from dwarf2out.c

2011-08-05 Thread Steve Ellcey
Some recent changes in dwarf2out.c have caused GCC to generate unaligned data traps on IA64 Linux. In looking a this I tracked it down to md5_read_ctx in libiberty, which is called by md5_finish_ctx, which in turn is called by various routines in dwarf2out.c. md5_read_ctx has a comment that the b