diff mbox

[4.6] Backport strict-volatile-bitfields fix PR51200

Message ID CAL0py26c7E9wYzymV6GmkMCLOUzQk9iSOyZMQGaDFS-rSYXvzg@mail.gmail.com
State New
Headers show

Commit Message

Joey Ye Dec. 27, 2011, 2:19 a.m. UTC
Fix PR51200. Backport trunk 182545, 182649, 182685 to 4.6.

OK to 4.6?

- Joey

	2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>

	PR middle-end/51200
	* expr.c (store_field): Avoid a direct store if the mode is larger
	than the size of the bit field.
	* stor-layout.c (layout_decl): If flag_strict_volatile_bitfields,
	treat non-volatile bit fields like volatile ones.
	* toplev.c (process_options): Disallow combination of
	-fstrict-volatile-bitfields and ABI versions less than 2.
	* config/arm/arm.c (arm_option_override): Don't enable
	flag_strict_volatile_bitfields if the ABI version is less than 2.
	* config/h8300/h8300.c (h8300_option_override): Likewise.
	* config/rx/rx.c (rx_option_override): Likewise.
	* config/m32c/m32c.c (m32c_option_override): Likewise.
	* config/sh/sh.c (sh_option_override): Likewise.

	2011-12-22  Joey Ye  <joey.ye@arm.com>

	* toplev.c (process_options): Fix typo.

testsute
	2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>

	PR middle-end/51200
	* gcc.target/arm/volatile-bitfields-4.c: New test.
	* c-c++-common/abi-bf.c: New test.

	2011-12-26  Joey Ye  <joey.ye@arm.com>

	PR middle-end/51200
	* gcc.dg/volatile-bitfields-2.c: New test.

Comments

Joey Ye Jan. 16, 2012, 3:21 a.m. UTC | #1
Ping

On Tue, Dec 27, 2011 at 10:19 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
> Fix PR51200. Backport trunk 182545, 182649, 182685 to 4.6.
>
> OK to 4.6?
>
> - Joey
>
>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>
>        PR middle-end/51200
>        * expr.c (store_field): Avoid a direct store if the mode is larger
>        than the size of the bit field.
>        * stor-layout.c (layout_decl): If flag_strict_volatile_bitfields,
>        treat non-volatile bit fields like volatile ones.
>        * toplev.c (process_options): Disallow combination of
>        -fstrict-volatile-bitfields and ABI versions less than 2.
>        * config/arm/arm.c (arm_option_override): Don't enable
>        flag_strict_volatile_bitfields if the ABI version is less than 2.
>        * config/h8300/h8300.c (h8300_option_override): Likewise.
>        * config/rx/rx.c (rx_option_override): Likewise.
>        * config/m32c/m32c.c (m32c_option_override): Likewise.
>        * config/sh/sh.c (sh_option_override): Likewise.
>
>        2011-12-22  Joey Ye  <joey.ye@arm.com>
>
>        * toplev.c (process_options): Fix typo.
>
> testsute
>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>
>        PR middle-end/51200
>        * gcc.target/arm/volatile-bitfields-4.c: New test.
>        * c-c++-common/abi-bf.c: New test.
>
>        2011-12-26  Joey Ye  <joey.ye@arm.com>
>
>        PR middle-end/51200
>        * gcc.dg/volatile-bitfields-2.c: New test.
Joey Ye Feb. 15, 2012, 7:23 a.m. UTC | #2
Ping^2

On Mon, Jan 16, 2012 at 11:21 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
> Ping
>
> On Tue, Dec 27, 2011 at 10:19 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
>> Fix PR51200. Backport trunk 182545, 182649, 182685 to 4.6.
>>
>> OK to 4.6?
>>
>> - Joey
>>
>>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>>
>>        PR middle-end/51200
>>        * expr.c (store_field): Avoid a direct store if the mode is larger
>>        than the size of the bit field.
>>        * stor-layout.c (layout_decl): If flag_strict_volatile_bitfields,
>>        treat non-volatile bit fields like volatile ones.
>>        * toplev.c (process_options): Disallow combination of
>>        -fstrict-volatile-bitfields and ABI versions less than 2.
>>        * config/arm/arm.c (arm_option_override): Don't enable
>>        flag_strict_volatile_bitfields if the ABI version is less than 2.
>>        * config/h8300/h8300.c (h8300_option_override): Likewise.
>>        * config/rx/rx.c (rx_option_override): Likewise.
>>        * config/m32c/m32c.c (m32c_option_override): Likewise.
>>        * config/sh/sh.c (sh_option_override): Likewise.
>>
>>        2011-12-22  Joey Ye  <joey.ye@arm.com>
>>
>>        * toplev.c (process_options): Fix typo.
>>
>> testsute
>>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>>
>>        PR middle-end/51200
>>        * gcc.target/arm/volatile-bitfields-4.c: New test.
>>        * c-c++-common/abi-bf.c: New test.
>>
>>        2011-12-26  Joey Ye  <joey.ye@arm.com>
>>
>>        PR middle-end/51200
>>        * gcc.dg/volatile-bitfields-2.c: New test.
Richard Biener Feb. 15, 2012, 10:17 a.m. UTC | #3
On Wed, Feb 15, 2012 at 8:23 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
> Ping^2

All hunks apart from the expr.c hunk from 182545 are ok (thus, all hunks
that are explicitly guarded with -fstrict-volatile-bitfields).

Please use -p for diffs, I couldn't spot the place in expr.c you patch,
the line-numbers are off and the patch isn't against the 4.6 branch.

Please state how you tested you backports.

r182649 is ok (obvious ontop of 182545), likewise r182685.

Richard.

> On Mon, Jan 16, 2012 at 11:21 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
>> Ping
>>
>> On Tue, Dec 27, 2011 at 10:19 AM, Ye Joey <joey.ye.cc@gmail.com> wrote:
>>> Fix PR51200. Backport trunk 182545, 182649, 182685 to 4.6.
>>>
>>> OK to 4.6?
>>>
>>> - Joey
>>>
>>>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>>>
>>>        PR middle-end/51200
>>>        * expr.c (store_field): Avoid a direct store if the mode is larger
>>>        than the size of the bit field.
>>>        * stor-layout.c (layout_decl): If flag_strict_volatile_bitfields,
>>>        treat non-volatile bit fields like volatile ones.
>>>        * toplev.c (process_options): Disallow combination of
>>>        -fstrict-volatile-bitfields and ABI versions less than 2.
>>>        * config/arm/arm.c (arm_option_override): Don't enable
>>>        flag_strict_volatile_bitfields if the ABI version is less than 2.
>>>        * config/h8300/h8300.c (h8300_option_override): Likewise.
>>>        * config/rx/rx.c (rx_option_override): Likewise.
>>>        * config/m32c/m32c.c (m32c_option_override): Likewise.
>>>        * config/sh/sh.c (sh_option_override): Likewise.
>>>
>>>        2011-12-22  Joey Ye  <joey.ye@arm.com>
>>>
>>>        * toplev.c (process_options): Fix typo.
>>>
>>> testsute
>>>        2011-12-20  Bernd Schmidt  <bernds@codesourcery.com>
>>>
>>>        PR middle-end/51200
>>>        * gcc.target/arm/volatile-bitfields-4.c: New test.
>>>        * c-c++-common/abi-bf.c: New test.
>>>
>>>        2011-12-26  Joey Ye  <joey.ye@arm.com>
>>>
>>>        PR middle-end/51200
>>>        * gcc.dg/volatile-bitfields-2.c: New test.
diff mbox

Patch

Index: gcc/testsuite/gcc.dg/volatile-bitfields-2.c
===================================================================
--- gcc/testsuite/gcc.dg/volatile-bitfields-2.c	(revision 0)
+++ gcc/testsuite/gcc.dg/volatile-bitfields-2.c	(revision 182685)
@@ -0,0 +1,15 @@ 
+/* { dg-do run } */
+/* { dg-options "-fstrict-volatile-bitfields" } */
+
+extern void abort(void);
+struct thing {
+  volatile unsigned short a: 8;
+  volatile unsigned short b: 8;
+} t = {1,2};
+
+int main()
+{
+  t.a = 3;
+  if (t.a !=3 || t.b !=2) abort();
+  return 0;
+}
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 182684)
+++ gcc/testsuite/ChangeLog	(revision 182685)
@@ -1,3 +1,8 @@ 
+2011-12-26  Joey Ye  <joey.ye@arm.com>
+
+	PR middle-end/51200
+	* gcc.dg/volatile-bitfields-2.c: New test.
+
 2011-12-23  Jason Merrill  <jason@redhat.com>
 
 	PR c++/51507