mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 06:49:09 +02:00
expand: Fix GET_MODE_SIZE/GET_MODE_BITSIZE typo [PR124435]
When splitting out store_field_updates_msb_p, r16-7265-ga9e48eca3a6eef accidentally replaced GET_MODE_BITSIZE with GET_MODE_SIZE. A matching rename of to_size to to_bitsize would have overflowed a line, so it seemed worth breaking the endian cases apart. gcc/ PR middle-end/124435 * expr.cc (store_field_updates_msb_p): Use GET_MODE_BITSIZE instead of GET_MODE_SIZE. Handle the two endiannesses separately. gcc/testsuite/ PR middle-end/124435 * gcc.dg/torture/pr124435.c: New test.
This commit is contained in:
@@ -5976,9 +5976,9 @@ mem_ref_refers_to_non_mem_p (tree ref)
|
||||
static bool
|
||||
store_field_updates_msb_p (poly_int64 bitpos, poly_int64 bitsize, rtx to_rtx)
|
||||
{
|
||||
poly_int64 to_size = GET_MODE_SIZE (GET_MODE (to_rtx));
|
||||
poly_int64 bitnum = BYTES_BIG_ENDIAN ? to_size - bitsize - bitpos : bitpos;
|
||||
return maybe_eq (bitnum + bitsize, to_size);
|
||||
return (BYTES_BIG_ENDIAN
|
||||
? maybe_le (bitpos, 0)
|
||||
: maybe_ge (bitpos + bitsize, GET_MODE_BITSIZE (GET_MODE (to_rtx))));
|
||||
}
|
||||
|
||||
/* Expand an assignment that stores the value of FROM into TO. If NONTEMPORAL
|
||||
|
||||
18
gcc/testsuite/gcc.dg/torture/pr124435.c
Normal file
18
gcc/testsuite/gcc.dg/torture/pr124435.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* { dg-do run { target le } } */
|
||||
|
||||
short c;
|
||||
|
||||
__attribute__((__noipa__)) short
|
||||
foo (short s)
|
||||
{
|
||||
__builtin_memmove (1 + (char *) &s, &c, 1);
|
||||
return s >> 10;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
short x = foo (-6);
|
||||
if (x)
|
||||
__builtin_abort();
|
||||
}
|
||||
Reference in New Issue
Block a user