https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94629
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (In reply to David Binderman from comment #6) > (In reply to Jakub Jelinek from comment #5) > > We should for GCC11 discuss if we want to implement some of these checks, > > either in -fanalyzer, or as normal GCC warnings. > > E.g. the > > foo = something; > > // code that can't affect foo > > foo = somethingelse; > > is perhaps something that should be warned as early as possible after > > getting into GIMPLE, before inlining because it is quite common that inlines > > overwrite something, and in the FEs it is likely too early. > > A quick look at recent cppcheck output over the gcc trunk source code > suggests that there are 162 cases of redundant assignment like this. > > Some of them might well be false positives. Can you attach a list? I can seed through them.