This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: store_bit_field, CONCATs and subregs


On Thu, Dec 09, 2004 at 07:29:02PM +0000, Richard Sandiford wrote:
> A couple of week ago, I noticed that tests like:
> 
>     struct s { _Complex short cs __attribute__((packed)); };
>     void f (struct s *s) { s->cs = 1 + 2i; }
> 
> could fail due to alignment problems.  The value we're storing into
> s->cs is a CHImode constant pool reference:
> 
>     (mem/i:CHI (lo_sum:SI (reg:SI 182)
>                           (symbol_ref/f:SI ("*$LC0")
>         [flags 0x2] <complex_cst 0x401aab70>)) [0 S4 A16])
> 
> and the lowpart generated by the current store_bit_field code is:
> 
>     (mem/i:SI (lo_sum:SI (reg:SI 182)
>                          (symbol_ref/f:SI ("*$LC0")
>         [flags 0x2] <complex_cst 0x401aab70>)) [0 S4 A16])
> 
> Both MEMs say that the reference only has 16-bit alignment, but it's
> unusual (maybe even wrong?) to have unaligned SImode MEMs on a
> strict-alignment target.

Indeed, this is wrong.  If we can still generate it after my changes
to emit_move_insn, we should fix it.

> 	* expmed.c (store_bit_field): Create a temporary when changing the
> 	value to an integer mode.

Ok.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]