aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-09-20 16:11:00 -0400
committerMarek Polacek <polacek@redhat.com>2020-09-23 10:10:33 -0400
commitc48ffe21f8f3478cf08f9442e3f973df358caf2a (patch)
tree17e7d1859baffb39faf67d842123e7d8a595b264 /gcc/builtins.c
parent3457dae55f72bd4ac0f346bbebb02d1613ac4b5c (diff)
downloadgcc-c48ffe21f8f3478cf08f9442e3f973df358caf2a.zip
gcc-c48ffe21f8f3478cf08f9442e3f973df358caf2a.tar.gz
gcc-c48ffe21f8f3478cf08f9442e3f973df358caf2a.tar.bz2
c: Fix -Wduplicated-branches ICE [PR97125]
We crash here because since r11-3302 the C FE uses codes like SWITCH_STMT in the else branches in the attached test, and inchash::add_expr in do_warn_duplicated_branches doesn't handle these front-end codes. In the C++ FE this works because by the time we get to do_warn_duplicated_branches we've already cp_genericize'd the SWITCH_STMT tree into a SWITCH_EXPR. The fix is to call do_warn_duplicated_branches_r only after loops and other structured control constructs have been lowered. gcc/c-family/ChangeLog: PR c/97125 * c-gimplify.c (c_genericize): Only call do_warn_duplicated_branches_r after loops and other structured control constructs have been lowered. gcc/testsuite/ChangeLog: PR c/97125 * c-c++-common/Wduplicated-branches-15.c: New test.
Diffstat (limited to 'gcc/builtins.c')
0 files changed, 0 insertions, 0 deletions