This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ tree-ssa ] Fix checking failure in ssa-ccp
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 14 Feb 2003 17:04:43 -0700
- Subject: [ tree-ssa ] Fix checking failure in ssa-ccp
- Reply-to: law at redhat dot com
* tree-ssa-ccp.c (def_to_undefined): Improve sanity checking code
so that it can detect invalid VARYING->UNDEFINED transitions.
(set_lattice_value): Improve sanity checking code so that it
does not trip on valid VARYING->CONSTANT transitions.
Index: tree-ssa-ccp.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-ccp.c,v
retrieving revision 1.1.2.51
diff -c -3 -p -r1.1.2.51 tree-ssa-ccp.c
*** tree-ssa-ccp.c 14 Feb 2003 22:16:29 -0000 1.1.2.51
--- tree-ssa-ccp.c 14 Feb 2003 23:59:26 -0000
*************** def_to_undefined (var)
*** 834,847 ****
value *value = get_value (var);
#ifdef ENABLE_CHECKING
! /* In theory VARYING -> UNDEFINED should also trigger an abort.
! However, our implementation will claim that some objects initially
! have a VARYING value (the first time we call get_value for them).
! Thus, it can appear that we get a VARYING -> UNDEFINED transition
! when all that is really happening is we are setting the initial
! value for the object to UNDEFINED. */
if (value->lattice_val == CONSTANT)
abort ();
#endif
if (value->lattice_val != UNDEFINED)
--- 834,847 ----
value *value = get_value (var);
#ifdef ENABLE_CHECKING
! /* CONSTANT->UNDEFINED is never a valid state transition. */
if (value->lattice_val == CONSTANT)
abort ();
+
+ /* VARYING->UNDEFINED is generally not a valid state transition,
+ except for values which are initialized to VARYING. */
+ if (value->lattice_val == VARYING
+ && get_default_value (var).lattice_val != VARYING)
#endif
if (value->lattice_val != UNDEFINED)
*************** set_lattice_value (var, val)
*** 908,915 ****
add_var_to_ssa_edges_worklist (var);
#ifdef ENABLE_CHECKING
! /* VARYING -> CONSTANT is an invalid state transition. */
! if (old_val->lattice_val == VARYING)
abort ();
#endif
--- 908,917 ----
add_var_to_ssa_edges_worklist (var);
#ifdef ENABLE_CHECKING
! /* VARYING -> CONSTANT is an invalid state transition, except
! for objects which start off in a VARYING state. */
! if (old_val->lattice_val == VARYING
! && get_default_value (var).lattice_val != VARYING)
abort ();
#endif
* tree-ssa-ccp.c (def_to_undefined): Improve sanity checking code
so that it can detect invalid VARYING->UNDEFINED transitions.
(set_lattice_value): Improve sanity checking code so that it
does not trip on valid VARYING->CONSTANT transitions.