Commit 40f94f7d by DJ Delorie Committed by DJ Delorie

expmed.c (strict_volatile_bitfield_p): Fix off-by-one error.

* expmed.c (strict_volatile_bitfield_p): Fix off-by-one error.
* gcc.dg/20141029-1.c: New.

From-SVN: r216844
parent 5cf18d25
2014-10-29 DJ Delorie <dj@redhat.com>
* expmed.c (strict_volatile_bitfield_p): Fix off-by-one error.
2014-10-29 Martin Liska <mliska@suse.cz>
PR ipa/63587
......@@ -457,7 +457,7 @@ strict_volatile_bitfield_p (rtx op0, unsigned HOST_WIDE_INT bitsize,
/* Check for cases where the C++ memory model applies. */
if (bitregion_end != 0
&& (bitnum - bitnum % modesize < bitregion_start
|| bitnum - bitnum % modesize + modesize > bitregion_end))
|| bitnum - bitnum % modesize + modesize - 1 > bitregion_end))
return false;
return true;
......
2014-10-29 DJ Delorie <dj@redhat.com>
* gcc.dg/20141029-1.c: New.
2014-10-29 Martin Liska <mliska@suse.cz>
PR ipa/63587
......
/* { dg-do compile } */
/* { dg-options "-fstrict-volatile-bitfields -fdump-rtl-final" } */
#define PERIPH (*(volatile struct system_periph *)0x81234)
struct system_periph {
union {
unsigned short WORD;
struct {
unsigned short a:1;
unsigned short b:1;
unsigned short :5;
unsigned short c:1;
unsigned short :8;
} BIT;
} ALL;
};
void
foo()
{
while (1)
{
PERIPH.ALL.BIT.a = 1;
}
}
/* { dg-final { scan-rtl-dump-times "mem/v(/.)*:HI" 4 "final" } } */
/* { dg-final { cleanup-rtl-dump "final" } } */
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