Commit f8a7df45 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/50472 (Volatile qualification in data is not enough to…

re PR tree-optimization/50472 (Volatile qualification in data is not enough to avoid optimization over pointer to data)

2011-09-26  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/50472
	* gimple-fold.c (fold_const_aggregate_ref_1): Do not fold
	volatile references.

	* gcc.dg/torture/pr50472.c: New testcase.

From-SVN: r179196
parent b5bcaa4a
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472
* gimple-fold.c (fold_const_aggregate_ref_1): Do not fold
volatile references.
2011-09-26 Bingfeng Mei <bmei@broadcom.com> 2011-09-26 Bingfeng Mei <bmei@broadcom.com>
* doc/tm.texi: Correct documentation for TARGET_ADDR_SPACE_SUBSET_P. * doc/tm.texi: Correct documentation for TARGET_ADDR_SPACE_SUBSET_P.
* target.def: (addr_space_subset_p): Likewise. * target.def: (addr_space_subset_p): Likewise.
...@@ -2919,6 +2919,9 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree)) ...@@ -2919,6 +2919,9 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
HOST_WIDE_INT offset, size, max_size; HOST_WIDE_INT offset, size, max_size;
tree tem; tree tem;
if (TREE_THIS_VOLATILE (t))
return NULL_TREE;
if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_declaration) if (TREE_CODE_CLASS (TREE_CODE (t)) == tcc_declaration)
return get_symbol_constant_value (t); return get_symbol_constant_value (t);
......
2011-09-26 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50472
* gcc.dg/torture/pr50472.c: New testcase.
2011-09-26 Eric Botcazou <ebotcazou@adacore.com> 2011-09-26 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt22.adb: New test. * gnat.dg/opt22.adb: New test.
......
/* { dg-do compile } */
/* { dg-options "-fdump-tree-optimized" } */
static const unsigned int foo = 1;
unsigned int test( void )
{
const volatile unsigned int *bar = &foo;
return ( *bar );
}
/* { dg-final { scan-tree-dump-not "return 1" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
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