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.c | |
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.c')
-rw-r--r-- | gcc/tree.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -12348,6 +12348,12 @@ block_may_fallthru (const_tree block) return false; case SWITCH_EXPR: + /* If there is a default: label or case labels cover all possible + SWITCH_COND values, then the SWITCH_EXPR will transfer control + to some case label in all cases and all we care is whether the + SWITCH_BODY falls through. */ + if (SWITCH_ALL_CASES_P (stmt)) + return block_may_fallthru (SWITCH_BODY (stmt)); return true; case COND_EXPR: |