https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88660
Bug ID: 88660
Summary: Invalid report of "set but used variable" with -O
Product: gcc
Version: 8.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: alexander.hirsch at gin dot de
Target Milestone: ---
Created attachment 45314
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45314&action=edit
testcase triggering the warning
Compiling the attached testcase with -O -Wunused-but-set-variable on gcc >= 8.1
erroneously generates a warning that i is unused.
Removing either the -O flag, the const-modifier or replacing the
switch-statement by e.g. an if leads to no warning being reported.
The warning also does not appear in gcc 7.4.