diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-04 12:37:39 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-09-04 12:37:39 +0000 |
commit | e96292e9c2ad186e9df0d34c93ce39a9a892b111 (patch) | |
tree | 3156c4838771e5bc99a49e5de85bcec907dec839 /gcc/c | |
parent | adace2e7c99d840efdc656875ef85bae0a112ab6 (diff) | |
download | gcc-e96292e9c2ad186e9df0d34c93ce39a9a892b111.tar.gz |
PR sanitizer/67279
* c-typeck.c (build_binary_op): Don't instrument static initializers.
* gcc.dg/ubsan/pr67279.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227491 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index ae1081b357d..a61df71ae8e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-09-04 Marek Polacek <polacek@redhat.com> + + PR sanitizer/67279 + * c-typeck.c (build_binary_op): Don't instrument static initializers. + 2015-09-03 Martin Sebor <msebor@redhat.com> PR c/66516 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index c622a9027e6..dc223969b3e 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -11292,7 +11292,8 @@ build_binary_op (location_t location, enum tree_code code, if ((flag_sanitize & (SANITIZE_SHIFT | SANITIZE_DIVIDE | SANITIZE_FLOAT_DIVIDE)) && do_ubsan_in_current_function () - && (doing_div_or_mod || doing_shift)) + && (doing_div_or_mod || doing_shift) + && !require_constant_value) { /* OP0 and/or OP1 might have side-effects. */ op0 = c_save_expr (op0); |