re PR tree-optimization/46217 (store to volatile is removed)

2010-11-03  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/46217
	* tree-ssa.c (non_rewritable_mem_ref_base): Check if volatile
	flag matches.
	(execute_update_addresses_taken): Likewise.

	* gcc.dg/pr46217.c: New testcase.

From-SVN: r166239
This commit is contained in:
Richard Guenther 2010-11-03 11:05:39 +00:00 committed by Richard Biener
parent 2e681adf5d
commit 02ff830b58
4 changed files with 31 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2010-11-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46217
* tree-ssa.c (non_rewritable_mem_ref_base): Check if volatile
flag matches.
(execute_update_addresses_taken): Likewise.
2010-11-03 Joern Rennecke <joern.rennecke@embecosm.com>
PR bootstrap/44335

View file

@ -1,3 +1,8 @@
2010-11-03 Richard Guenther <rguenther@suse.de>
PR tree-optimization/46217
* gcc.dg/pr46217.c: New testcase.
2010-11-03 Nicola Pero <nicola.pero@meta-innovation.com>
* objc.dg/property/dotsyntax-1.m: New.

View file

@ -0,0 +1,11 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-optimized" } */
int foo(int a)
{
int t;
*(volatile int *)&t = a;
}
/* { dg-final { scan-tree-dump "={v}" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */

View file

@ -1877,7 +1877,8 @@ non_rewritable_mem_ref_base (tree ref)
if (DECL_P (decl)
&& (!integer_zerop (TREE_OPERAND (base, 1))
|| (DECL_SIZE (decl)
!= TYPE_SIZE (TREE_TYPE (base)))))
!= TYPE_SIZE (TREE_TYPE (base)))
|| TREE_THIS_VOLATILE (decl) != TREE_THIS_VOLATILE (base)))
return decl;
}
@ -1993,7 +1994,9 @@ execute_update_addresses_taken (void)
if (DECL_P (decl)
&& (!integer_zerop (TREE_OPERAND (lhs, 1))
|| (DECL_SIZE (decl)
!= TYPE_SIZE (TREE_TYPE (orig_lhs)))))
!= TYPE_SIZE (TREE_TYPE (orig_lhs)))
|| (TREE_THIS_VOLATILE (lhs)
!= TREE_THIS_VOLATILE (decl))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}
@ -2040,7 +2043,9 @@ execute_update_addresses_taken (void)
if (DECL_P (decl)
&& (!integer_zerop (TREE_OPERAND (lhs, 1))
|| (TYPE_MAIN_VARIANT (TREE_TYPE (decl))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_lhs)))))
!= TYPE_MAIN_VARIANT (TREE_TYPE (orig_lhs)))
|| (TREE_THIS_VOLATILE (lhs)
!= TREE_THIS_VOLATILE (decl))))
bitmap_set_bit (not_reg_needs, DECL_UID (decl));
}
}