+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>
PR target/22076
|| (offset * BITS_PER_UNIT % 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))
- op0 = adjust_address (op0, mode1, offset);
- else
- {
- rtx sub = simplify_gen_subreg (mode1, op0, GET_MODE (op0),
- byte_offset);
- if (sub == NULL)
- goto no_subreg_mode_swap;
- op0 = sub;
- }
+ rtx sub = simplify_gen_subreg (mode1, op0, GET_MODE (op0),
+ byte_offset);
+ if (sub == NULL)
+ goto no_subreg_mode_swap;
+ op0 = sub;
}
if (mode1 != mode)
return convert_to_mode (tmode, op0, unsignedp);
--- /dev/null
+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;
+}