This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] More PTA carefulness
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 11 Mar 2014 16:27:01 +0100 (CET)
- Subject: [PATCH] More PTA carefulness
- Authentication-results: sourceware.org; auth=none
This adds two asserts that guards possible wrong-code issues in
get_constraint_for_ptr_offset.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2014-03-11 Richard Biener <rguenther@suse.de>
* tree-ssa-structalias.c (get_constraint_for_ptr_offset):
Add asserts to guard possible wrong-code bugs.
Index: gcc/tree-ssa-structalias.c
===================================================================
--- gcc/tree-ssa-structalias.c (revision 208479)
+++ gcc/tree-ssa-structalias.c (working copy)
@@ -3095,7 +3095,7 @@ get_constraint_for_ptr_offset (tree ptr,
if (c.type == ADDRESSOF
/* If this varinfo represents a full variable just use it. */
&& curr->is_full_var)
- c.offset = 0;
+ ;
else if (c.type == ADDRESSOF
/* If we do not know the offset add all subfields. */
&& rhsoffset == UNKNOWN_OFFSET)
@@ -3143,8 +3143,14 @@ get_constraint_for_ptr_offset (tree ptr,
temp = vi_next (temp);
}
}
+ else if (c.type == SCALAR)
+ {
+ gcc_assert (c.offset == 0);
+ c.offset = rhsoffset;
+ }
else
- c.offset = rhsoffset;
+ /* We shouldn't get any DEREFs here. */
+ gcc_unreachable ();
(*results)[j] = c;
}