mirror of git://gcc.gnu.org/git/gcc.git
re PR tree-optimization/47391 (read from const volatile incorrectly eliminated)
PR tree-optimization/47391 * varpool.c (const_value_known_p): Return false if decl is volatile. * gcc.dg/pr47391.c: New test. From-SVN: r169084
This commit is contained in:
parent
d8debb1d8a
commit
3a2df83199
|
@ -3,6 +3,10 @@
|
|||
* tree-ssa-live.c (remove_unused_scope_block_p): Don't remove
|
||||
DECL_IGNORED_P non-reg vars if they are used.
|
||||
|
||||
PR tree-optimization/47391
|
||||
* varpool.c (const_value_known_p): Return false if
|
||||
decl is volatile.
|
||||
|
||||
2011-01-21 Kai Tietz <kai.tietz@onevision.com>
|
||||
|
||||
PR bootstrap/47215
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2011-01-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/47391
|
||||
* gcc.dg/pr47391.c: New test.
|
||||
|
||||
2011-01-21 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
|
||||
|
||||
* g++.dg/template/char1.C: Use signed char.
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* PR tree-optimization/47391 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
const volatile int v = 1;
|
||||
int i = 0;
|
||||
|
||||
void
|
||||
foo (void)
|
||||
{
|
||||
i = v;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
foo ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "i = 1;" "optimized" } } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
|
@ -1,5 +1,5 @@
|
|||
/* Callgraph handling code.
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010
|
||||
Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Jan Hubicka
|
||||
|
||||
|
@ -370,7 +370,7 @@ const_value_known_p (tree decl)
|
|||
|
||||
gcc_assert (TREE_CODE (decl) == VAR_DECL);
|
||||
|
||||
if (!TREE_READONLY (decl))
|
||||
if (!TREE_READONLY (decl) || TREE_THIS_VOLATILE (decl))
|
||||
return false;
|
||||
|
||||
/* Gimplifier takes away constructors of local vars */
|
||||
|
|
Loading…
Reference in New Issue