aboutsummaryrefslogtreecommitdiff
path: root/gcc/ubsan.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-04-11 15:08:08 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-04-11 13:08:08 +0000
commit9f679370006ed036fb1545ebc272d4f1b39641a3 (patch)
tree9c3575235036b0618e6b6a16c1b0684a79a4c3fd /gcc/ubsan.c
parentcb278caa18841ee7a15adab8ca8bb1e99dbb3117 (diff)
downloadgcc-9f679370006ed036fb1545ebc272d4f1b39641a3.zip
gcc-9f679370006ed036fb1545ebc272d4f1b39641a3.tar.gz
gcc-9f679370006ed036fb1545ebc272d4f1b39641a3.tar.bz2
Do not instrument register variables in object-size sanitizer (PR sanitizer/70878).
2017-04-11 Martin Liska <mliska@suse.cz> PR sanitizer/70878 * ubsan.c (instrument_object_size): Do not instrument register variables. 2017-04-11 Martin Liska <mliska@suse.cz> PR sanitizer/70878 * gcc.dg/ubsan/pr70878.c: New test. From-SVN: r246837
Diffstat (limited to 'gcc/ubsan.c')
-rw-r--r--gcc/ubsan.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ubsan.c b/gcc/ubsan.c
index 323c1cc..c01d633 100644
--- a/gcc/ubsan.c
+++ b/gcc/ubsan.c
@@ -1806,7 +1806,11 @@ instrument_object_size (gimple_stmt_iterator *gsi, bool is_lhs)
bool decl_p = DECL_P (inner);
tree base;
if (decl_p)
- base = inner;
+ {
+ if (DECL_REGISTER (inner))
+ return;
+ base = inner;
+ }
else if (TREE_CODE (inner) == MEM_REF)
base = TREE_OPERAND (inner, 0);
else