[Bug tree-optimization/96245] Failure to optimize arithmetic pattern in switch
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 20 15:28:57 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96245
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |msebor at gcc dot gnu.org
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I wonder if discouraging this pattern by warning on it and suggesting the
simpler alternative would be worthwhile (either in addition to or in lieu of
the optimization) to help avoid typos resulting from copy-and-paste mistakes
that cannot very well be detected. As in:
void f(int x)
{
switch (x)
{
case 0:
putchar('0');
break;
case 1:
putchar('1');
break;
...
case 7:
putchar('6'); <<< typo
break;
...
}
More information about the Gcc-bugs
mailing list