diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-11-28 22:22:52 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-11-28 22:22:52 +0100 |
commit | 058f0b9e5f073da9d1d98a91e482cbdead1561ee (patch) | |
tree | 54a203fbcbecced881bb3fc81e309166d8c9ad5b /gcc/tree.h | |
parent | 67c24a8bd6141021da49e005c0111bd42bfc7d08 (diff) | |
download | gcc-058f0b9e5f073da9d1d98a91e482cbdead1561ee.zip gcc-058f0b9e5f073da9d1d98a91e482cbdead1561ee.tar.gz gcc-058f0b9e5f073da9d1d98a91e482cbdead1561ee.tar.bz2 |
re PR sanitizer/81275 (-fsanitize=thread produce incorrect -Wreturn-type warning)
PR sanitizer/81275
* tree.c (block_may_fallthru): Return false if SWITCH_ALL_CASES_P
is set on SWITCH_EXPR and !block_may_fallthru (SWITCH_BODY ()).
c/
* c-typeck.c (c_finish_case): Set SWITCH_ALL_CASES_P if
c_switch_covers_all_cases_p returns true.
c-family/
* c-common.c (c_switch_covers_all_cases_p_1,
c_switch_covers_all_cases_p): New functions.
* c-common.h (c_switch_covers_all_cases_p): Declare.
testsuite/
* c-c++-common/tsan/pr81275.c: New test.
From-SVN: r255217
Diffstat (limited to 'gcc/tree.h')
-rw-r--r-- | gcc/tree.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1166,6 +1166,10 @@ extern void protected_set_expr_location (tree, location_t); /* SWITCH_EXPR accessors. These give access to the condition and body. */ #define SWITCH_COND(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 0) #define SWITCH_BODY(NODE) TREE_OPERAND (SWITCH_EXPR_CHECK (NODE), 1) +/* True if there are case labels for all possible values of SWITCH_COND, either + because there is a default: case label or because the case label ranges cover + all values. */ +#define SWITCH_ALL_CASES_P(NODE) (SWITCH_EXPR_CHECK (NODE)->base.private_flag) /* CASE_LABEL_EXPR accessors. These give access to the high and low values of a case label, respectively. */ |