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
This commit is contained in:
parent
5cf18d250f
commit
40f94f7d73
4 changed files with 37 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
|||
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;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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
|
||||
|
|
28
gcc/testsuite/gcc.dg/20141029-1.c
Normal file
28
gcc/testsuite/gcc.dg/20141029-1.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/* { 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" } } */
|
Loading…
Add table
Reference in a new issue