This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/66977] -fsanitize=shift may introduce uninitialized variables
- From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Jul 2015 21:02:24 +0000
- Subject: [Bug sanitizer/66977] -fsanitize=shift may introduce uninitialized variables
- Auto-submitted: auto-generated
- References: <bug-66977-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66977
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This works (can't use unshare_expr here), but I'll try to come up with
something nicer...
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a45755e..f1b6475 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4926,6 +4926,8 @@ build_offset_ref_call_from_tree (tree fn, vec<tree,
va_gc> **args,
fn = TREE_OPERAND (fn, 1);
fn = get_member_function_from_ptrfunc (&object_addr, fn,
complain);
+ if (flag_sanitize & SANITIZE_SHIFT)
+ walk_tree (&object_addr, copy_tree_r, NULL, NULL);
vec_safe_insert (*args, 0, object_addr);
}