This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs
- From: "christer at weinigel dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Mar 2007 20:47:02 -0000
- Subject: [Bug target/31137] New: missing "break" in switch for MULT in avr_rtx_costs
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I have just started reading the gcc code a bit, and while looking at the avr
port I noticed that in the function avr_rtx_costs in avr.c there is some code
to calculate the cost of a multiplication:
case MULT:
switch (mode)
{
case QImode:
if (AVR_HAVE_MUL)
*total = COSTS_N_INSNS (optimize_size ? 3 : 4);
else if (optimize_size)
*total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
else
return false;
case HImode:
if (AVR_HAVE_MUL)
*total = COSTS_N_INSNS (optimize_size ? 7 : 10);
else if (optimize_size)
*total = COSTS_N_INSNS (AVR_MEGA ? 2 : 1);
else
return false;
default:
return false;
}
*total += avr_operand_rtx_cost (XEXP (x, 0), mode, code);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code);
return true;
if AVR_HAVE_MUL is true, the above code will be equal to the following:
case MULT:
switch (mode)
{
case QImode:
*total = COSTS_N_INSNS (optimize_size ? 3 : 4);
case HImode:
*total = COSTS_N_INSNS (optimize_size ? 7 : 10);
default:
return false;
}
*total += avr_operand_rtx_cost (XEXP (x, 0), mode, code);
*total += avr_operand_rtx_cost (XEXP (x, 1), mode, code);
return true;
which I belive is incorrect since it means that the assignments to *total in
the switch statement are useless. It probably doesn't break anything serious
but might give slightly worse optimizations.
--
Summary: missing "break" in switch for MULT in avr_rtx_costs
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: christer at weinigel dot se
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: avr-unknown-none
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31137