aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-03-20 13:31:28 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-03-20 13:31:28 +0000
commita74560ebeb9e088e410139595a6ca74f6720b502 (patch)
treee41d2e9ebb458f0d0850bf0c73e25755e1e56a6a /gcc
parent32fa36234d74a5241a9a551700f4d44ac5a2c820 (diff)
downloadgcc-a74560ebeb9e088e410139595a6ca74f6720b502.zip
gcc-a74560ebeb9e088e410139595a6ca74f6720b502.tar.gz
gcc-a74560ebeb9e088e410139595a6ca74f6720b502.tar.bz2
re PR sanitizer/80063 (gcc/asan.c: PVS-Studio: Incorrect Block Delimitation (CWE-483))
PR sanitizer/80063 * asan.c (DEF_SANITIZER_BUILTIN): Use do { } while (0). From-SVN: r246278
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/asan.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f8b56a2..90c8556 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-20 Marek Polacek <polacek@redhat.com>
+
+ PR sanitizer/80063
+ * asan.c (DEF_SANITIZER_BUILTIN): Use do { } while (0).
+
2017-03-20 Richard Biener <rguenther@suse.de>
PR tree-optimization/80113
diff --git a/gcc/asan.c b/gcc/asan.c
index edcc6ea..a13679d 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2567,10 +2567,12 @@ initialize_sanitizer_builtins (void)
#define DEF_BUILTIN_STUB(ENUM, NAME)
#undef DEF_SANITIZER_BUILTIN
#define DEF_SANITIZER_BUILTIN(ENUM, NAME, TYPE, ATTRS) \
- decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
- BUILT_IN_NORMAL, NAME, NULL_TREE); \
- set_call_expr_flags (decl, ATTRS); \
- set_builtin_decl (ENUM, decl, true);
+ do { \
+ decl = add_builtin_function ("__builtin_" NAME, TYPE, ENUM, \
+ BUILT_IN_NORMAL, NAME, NULL_TREE); \
+ set_call_expr_flags (decl, ATTRS); \
+ set_builtin_decl (ENUM, decl, true); \
+ } while (0);
#include "sanitizer.def"