tree-cfg: Improve gimple switch verification
authorJakub Jelinek <jakub@redhat.com>
Mon, 31 Aug 2020 08:51:02 +0000 (10:51 +0200)
committerJakub Jelinek <jakub@redhat.com>
Mon, 31 Aug 2020 08:51:02 +0000 (10:51 +0200)
commit39f5b724844a28bea3dbb2a5c0b88bdce89ec4cb
tree1a75c66b8d5f03337b1d66c958ee7409a6d0df78
parente11c4b7f837bc6b4c22b1f5bf41a9d0608d256be
tree-cfg: Improve gimple switch verification

When looking at the verification, I have noticed a bug in it.

The verification that CASE_HIGH (if present) has the same type as CASE_LOW
is only performed for the case label 2 and higher, case label 1 (the first
one after the default label) isn't checked.

The following patch fixes that, it will uselessly also compare
TREE_TYPE (CASE_LOW (elt)) != elt_type for the case label 1, but I think
that isn't that expensive and helps readability of the code.

2020-08-31  Jakub Jelinek  <jakub@redhat.com>

* tree-cfg.c (verify_gimple_switch): If the first non-default case
label has CASE_HIGH, verify it has the same type as CASE_LOW.
gcc/tree-cfg.c