Commit 8ddcfde1 by Daniel Jacobowitz Committed by Daniel Jacobowitz

expmed.c (extract_bit_field): Always use adjust_address for MEM.

	* expmed.c (extract_bit_field): Always use adjust_address for MEM.

	* gcc.c-torture/execute/20080222-1.c: New test.

From-SVN: r132573
parent 84495fd9
2008-02-23 Daniel Jacobowitz <dan@codesourcery.com>
* expmed.c (extract_bit_field): Always use adjust_address for MEM.
2008-02-23 Uros Bizjak <ubizjak@gmail.com> 2008-02-23 Uros Bizjak <ubizjak@gmail.com>
PR target/22076 PR target/22076
......
...@@ -1339,18 +1339,15 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize, ...@@ -1339,18 +1339,15 @@ extract_bit_field_1 (rtx str_rtx, unsigned HOST_WIDE_INT bitsize,
|| (offset * BITS_PER_UNIT % bitsize == 0 || (offset * BITS_PER_UNIT % bitsize == 0
&& MEM_ALIGN (op0) % bitsize == 0))))) && MEM_ALIGN (op0) % bitsize == 0)))))
{ {
if (mode1 != GET_MODE (op0)) if (MEM_P (op0))
op0 = adjust_address (op0, mode1, offset);
else if (mode1 != GET_MODE (op0))
{ {
if (MEM_P (op0)) rtx sub = simplify_gen_subreg (mode1, op0, GET_MODE (op0),
op0 = adjust_address (op0, mode1, offset); byte_offset);
else if (sub == NULL)
{ goto no_subreg_mode_swap;
rtx sub = simplify_gen_subreg (mode1, op0, GET_MODE (op0), op0 = sub;
byte_offset);
if (sub == NULL)
goto no_subreg_mode_swap;
op0 = sub;
}
} }
if (mode1 != mode) if (mode1 != mode)
return convert_to_mode (tmode, op0, unsignedp); return convert_to_mode (tmode, op0, unsignedp);
......
2008-02-23 Daniel Jacobowitz <dan@codesourcery.com>
* gcc.c-torture/execute/20080222-1.c: New test.
2008-02-23 Uros Bizjak <ubizjak@gmail.com> 2008-02-23 Uros Bizjak <ubizjak@gmail.com>
PR target/22076 PR target/22076
extern void abort (void);
struct container
{
unsigned char data[1];
};
unsigned char space[6] = {1, 2, 3, 4, 5, 6};
int
foo (struct container *p)
{
return p->data[4];
}
int
main ()
{
if (foo ((struct container *) space) != 5)
abort ();
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment