[Bug tree-optimization/15454] [3.5 Regression] tree-ccp generates wrong code for nested functions

steven at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat May 15 23:36:00 GMT 2004


------- Additional Comments From steven at gcc dot gnu dot org  2004-05-15 11:59 -------
The SSA_NAME_DEF_STMT for CHAIN.3_3 is an empty statement, 
which we apparently assume to be UNDEFINED, so the meet of 
the CONSTANT 0 and the UNDEFINED foo.1_4 in the PHI: 
 
  # baz_1 = PHI <0(0), foo.1_4(1)>; 
 
returns CONSTANT for baz_1, which is clearly a bit too 
optimistic in this case. 
 
I believe we should assume that variables without an 
initializing statement are VARYING. 
 
 
Index: tree-ssa-ccp.c 
=================================================================== 
RCS file: /cvs/gcc/gcc/gcc/tree-ssa-ccp.c,v 
retrieving revision 2.2 
diff -c -3 -p -r2.2 tree-ssa-ccp.c 
*** tree-ssa-ccp.c      14 May 2004 02:29:23 -0000      2.2 
--- tree-ssa-ccp.c      15 May 2004 11:53:24 -0000 
*************** get_default_value (tree var) 
*** 2106,2112 **** 
        enum tree_code code; 
        tree stmt = SSA_NAME_DEF_STMT (var); 
 
!       if (!IS_EMPTY_STMT (stmt)) 
          { 
          code = TREE_CODE (stmt); 
          if (code != MODIFY_EXPR && code != PHI_NODE) 
--- 2106,2114 ---- 
        enum tree_code code; 
        tree stmt = SSA_NAME_DEF_STMT (var); 
 
!       if (IS_EMPTY_STMT (stmt)) 
!       val.lattice_val = VARYING; 
!       else 
          { 
          code = TREE_CODE (stmt); 
          if (code != MODIFY_EXPR && code != PHI_NODE) 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-05-15 10:28:41         |2004-05-15 11:59:08
               date|                            |


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



More information about the Gcc-bugs mailing list