https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96571
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-9 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d2472e513c6490b6e2832b07d08731df26e6dc06 commit r9-8909-gd2472e513c6490b6e2832b07d08731df26e6dc06 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Aug 18 07:51:58 2020 +0200 c: Fix -Wunused-but-set-* warning with _Generic [PR96571] The following testcase shows various problems with -Wunused-but-set* warnings and _Generic construct. I think it is best to treat the selector and the ignored expressions as (potentially) read, because when they are parsed, the vars in there are already marked as TREE_USED. 2020-08-18 Jakub Jelinek <ja...@redhat.com> PR c/96571 * c-parser.c (c_parser_generic_selection): Change match_found from bool to int, holding index of the match. Call mark_exp_read on the selector expression and on expressions other than the selected one. * gcc.dg/Wunused-var-4.c: New test. (cherry picked from commit 6d42cbe5ad7a7b46437f2576c9920e44dc14b386)