[Bug tree-optimization/38180] CCP does not propagate through constant initializers

Graham Stott graham.stott@btinternet.com
Wed Nov 26 13:03:00 GMT 2008


Hi Richard,

Does this patch work for objects which are both const and volatile

get_symbol_constant_value only looks at TREE_READONLY should it not
also look at TREE_VOLATILE ?

I don't have a upto date tree to hand to try the following testcase on

static const volatile int value = 42;

int foo(void)
{
  return value;
}

Here it's not valid to ccp value into the return value and return 42

Graham


--- On Wed, 26/11/08, rguenth at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org> wrote:

> From: rguenth at gcc dot gnu dot org <gcc-bugzilla@gcc.gnu.org>
> Subject: [Bug tree-optimization/38180] CCP does not propagate through constant initializers
> To: gcc-bugs@gcc.gnu.org
> Date: Wednesday, 26 November, 2008, 12:28 PM
> ------- Comment #3 from rguenth at gcc dot gnu dot org 
> 2008-11-26 12:28 -------
> Subject: Bug 38180
> 
> Author: rguenth
> Date: Wed Nov 26 12:27:33 2008
> New Revision: 142217
> 
> URL:
> http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142217
> Log:
> 2008-11-26  Richard Guenther  <rguenther@suse.de>
> 
>         PR tree-optimization/38180
>         * tree-ssa-ccp.c (get_default_value): Simplify.
>         (likely_value): Likewise.
>         (surely_varying_stmt_p): Properly handle VOP case.
>         (ccp_initialize): Likewise.
>         (ccp_fold): Handle propagating through *&.
>         (fold_const_aggregate_ref): Also handle decls.
> 
>         * gcc.dg/tree-ssa/ssa-ccp-24.c: New testcase.
> 
> Added:
>    
> branches/alias-improvements/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-24.c
> Modified:
>     branches/alias-improvements/gcc/ChangeLog.alias
>     branches/alias-improvements/gcc/tree-ssa-ccp.c
> 
> 
> -- 
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38180



More information about the Gcc-bugs mailing list