Commit 8adac335 by Adrian Straetling Committed by Ian Lance Taylor

combine.c (make_extraction): Correct offset computation.

	* combine.c (make_extraction): Correct offset computation.
	* gcc.c-torture/execute/20051012-1.c: New test.

From-SVN: r105330
parent 949d5b72
2005-10-12 Adrian Straetling <straetling@de.ibm.com>
* combine.c (make_extraction): Correct offset computation.
2005-10-12 Hans-Peter Nilsson <hp@axis.com> 2005-10-12 Hans-Peter Nilsson <hp@axis.com>
* config/cris/t-linux (LIMITS_H_TEST): Define. * config/cris/t-linux (LIMITS_H_TEST): Define.
......
...@@ -6512,11 +6512,12 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos, ...@@ -6512,11 +6512,12 @@ make_extraction (enum machine_mode mode, rtx inner, HOST_WIDE_INT pos,
offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode); offset -= GET_MODE_SIZE (is_mode) - GET_MODE_SIZE (inner_mode);
/* If this is a constant position, we can move to the desired byte. /* If this is a constant position, we can move to the desired byte.
Be careful not to go beyond the original object. */ Be careful not to go beyond the original object and maintain the
natural alignment of the memory. */
if (pos_rtx == 0) if (pos_rtx == 0)
{ {
enum machine_mode bfmode = smallest_mode_for_size (len, MODE_INT); enum machine_mode bfmode = smallest_mode_for_size (len, MODE_INT);
offset += pos / GET_MODE_BITSIZE (bfmode); offset += (pos / GET_MODE_BITSIZE (bfmode)) * GET_MODE_SIZE (bfmode);
pos %= GET_MODE_BITSIZE (bfmode); pos %= GET_MODE_BITSIZE (bfmode);
} }
......
2005-10-12 Adrian Straetling <straetling@de.ibm.com>
* gcc.c-torture/execute/20051012-1.c: New test.
2005-10-12 Paul Thomas <pault@gcc.gnu.org> 2005-10-12 Paul Thomas <pault@gcc.gnu.org>
PR fortran/18082 PR fortran/18082
extern void abort (void);
struct type
{
int *a;
int b:16;
unsigned int p:9;
} t;
unsigned int
foo ()
{
return t.p;
}
int
main (void)
{
t.p = 8;
if (foo (t) != 8)
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