[Bug tree-optimization/32721] CCP removes volatile qualifiers.

rguenther at suse dot de gcc-bugzilla@gcc.gnu.org
Wed Jul 11 08:45:00 GMT 2007



------- Comment #4 from rguenther at suse dot de  2007-07-11 08:45 -------
Subject: Re:  CCP removes volatile qualifiers.

On Tue, 10 Jul 2007, ramana dot radhakrishnan at celunite dot com wrote:

> (In reply to comment #2)
> > As the decl is volatile as well this is clearly a bogus optimization.
> > 
> 
> Putting a breakpoint on evaluate_stmt in tree-ssa-ccp.c shows that stmt_ann of
> the stmt does not have has_volatile_ops set to true. 
> 
> 
> (gdb) p stmt 
> (gdb) pt
>  <gimple_modify_stmt 0xb7d4fee0 side-effects
>     arg 0 <ssa_name 0xb7d4aed4
>         type <pointer_type 0xb7d44bd0 type <integer_type 0xb7d44b64 int>
>             sizes-gimplified unsigned SI
>             size <integer_cst 0xb7caa460 constant invariant 32>
>             unit size <integer_cst 0xb7caa24c constant invariant 4>
>             align 32 symtab 0 alias set -1 canonical type 0xb7d44bd0>
>         visited var <var_decl 0xb7d5005c spinlock0> def_stmt
> <gimple_modify_stmt 0xb7d4fee0>
>         version 1>
>     arg 1 <addr_expr 0xb7d481c0 type <pointer_type 0xb7d44bd0>
>         constant invariant
>         arg 0 <array_ref 0xb7cb5084 type <integer_type 0xb7d44b64 int>
>             arg 0 <var_decl 0xb7d50000 spinlock>
>             arg 1 <integer_cst 0xb7d4fec4 constant invariant 0>>>
>     try.c:5>
> (gdb) (gdb) p *(stmt->base->ann)
> $17 = {common = {type = STMT_ANN, aux = 0x0, value_handle = 0x0}, vdecl = {
>     common = {type = STMT_ANN, aux = 0x0, value_handle = 0x0}, 
>     out_of_ssa_tag = 0, base_var_processed = 0, used = 0, 
>     need_phi_state = NEED_PHI_STATE_NO, in_vuse_list = 1, in_vdef_list = 0, 
>     is_heapvar = 0, call_clobbered = 1, noalias_state = NO_ALIAS_GLOBAL, 
>     mpt = 0xb7cb6804, symbol_mem_tag = 0x0, partition = 0, base_index = 0, 
>     current_def = 0x0, subvars = 0x0, escape_mask = 3084210192}, fdecl = {
>     common = {type = STMT_ANN, aux = 0x0, value_handle = 0x0}, 
>     reference_vars_info = 0xb7eed528}, stmt = {common = {type = STMT_ANN, 
>       aux = 0x0, value_handle = 0x0}, bb = 0xb7eed528, operands = {
>       def_ops = 0xb7cb6804, use_ops = 0x0, vdef_ops = 0x0, vuse_ops = 0x0, 
>       stores = 0x0, loads = 0x0}, addresses_taken = 0xb7d55010, uid = 0, 
>     references_memory = 0, modified = 0, has_volatile_ops = 0, 
>     makes_clobbering_call = 0}}
> 
> Shouldn't has_volatile_ops get set to true in this case because the stmt
> essentially has one volatile operand here ? 

No, this assignment just assigns pointers (the pointers are not volatile,
just the thing they point to is).  Basically volatile ops is set only
on statements reading/writing memory.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32721



More information about the Gcc-bugs mailing list