[Bug optimization/9707] Unnecessary range test in switches with less than 4 cases
pinskia at physics dot uc dot edu
gcc-bugzilla@gcc.gnu.org
Mon Aug 4 04:00:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9707
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-04 04:00 -------
Here is a better version of this (f should produce the same code as g)
int f (int r)
{
switch (r) {
case 1:
return 11;
case 2:
return 12;
case 3:
return 13;
default:
return 20;
}
}
int g(int r)
{
if(r==1)
return 11;
else if (r==2)
return 12;
else if (r==3)
return 13;
else
return 30;
}
More information about the Gcc-bugs
mailing list