https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84097
Bug ID: 84097 Summary: [8 regression] Incorrect -Wunused-but-set-variable warning Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: sylvestre at debian dot org CC: jakub at gcc dot gnu.org, jason at gcc dot gnu.org, sgunderson at bigfoot dot com, trippels at gcc dot gnu.org, unassigned at gcc dot gnu.org, webrown.cpp at gmail dot com Target Milestone: --- +++ This bug was initially created as a clone of Bug #82728 +++ Seen in Firefox code: /root/firefox-gcc-last/dom/animation/KeyframeUtils.cpp: In member function 'uint32_t mozilla::PropertyPriorityComparator::SubpropertyCount(nsCSSPropertyID) const': /root/firefox-gcc-last/layout/style/nsCSSProps.h:689:29: error: variable 'es_' set but not used [-Werror=unused-but-set-variable] es_ = (nsCSSPropertyID)((enabledstate_) | \ ^~~ #define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(it_, prop_, enabledstate_) \ for (const nsCSSPropertyID *it_ = nsCSSProps::SubpropertyEntryFor(prop_), \ es_ = (nsCSSPropertyID)((enabledstate_) | \ CSSEnabledState(0)); \ *it_ != eCSSProperty_UNKNOWN; ++it_) \ if (nsCSSProps::IsEnabled(*it_, (mozilla::CSSEnabledState) es_)) We can see that es_ is used at the last line. This issue doesn't occur with gcc 7. Unreduced test case http://sylvestre.ledru.info/bordel/gcc-unused-but-set-variable.tar.gz 1.1mb (sorry) $ g++-8 -c -Werror=unused-but-set-variable foo.cpp