analyzer: deal with -fshort-enums
commit3cbab07b08d2f3a3ed34b6ec12e67727c59d285c
authorAlexandre Oliva <oliva@adacore.com>
Thu, 7 Dec 2023 03:38:18 +0000 (7 00:38 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Thu, 7 Dec 2023 03:38:18 +0000 (7 00:38 -0300)
tree33798ed79e792ea0ba76f6b6722f376586888335
parent3d0f3382fa7b5677f35a9becf75ac436cd7eda7b
analyzer: deal with -fshort-enums

On platforms that enable -fshort-enums by default, various switch-enum
analyzer tests fail, because apply_constraints_for_gswitch doesn't
expect the integral promotion type cast.  I've arranged for the code
to cope with those casts.

for  gcc/analyzer/ChangeLog

* region-model.cc (has_nondefault_case_for_value_p): Take
enumerate type as a parameter.
(region_model::apply_constraints_for_gswitch): Cope with
integral promotion type casts.

for  gcc/testsuite/ChangeLog

* gcc.dg/analyzer/switch-short-enum-1.c: New.
* gcc.dg/analyzer/switch-no-short-enum-1.c: New.
gcc/analyzer/region-model.cc
gcc/testsuite/gcc.dg/analyzer/switch-no-short-enum-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/analyzer/switch-short-enum-1.c [new file with mode: 0644]