c6dc3dd72b
man gcc: Warn if in a loop with constant number of iterations the compiler detects undefined behavior in some statement during one or more of the iterations. Milkymist pfpu has no jump instructions, so checking for MICROCODE_WORDS instructions should have kept us in bounds of s->microcode, but i++ allowed one loop too many, hw/misc/milkymist-pfpu.c: In function ‘pfpu_write’: hw/misc/milkymist-pfpu.c:365:20: error: loop exit may only be reached after undefined behavior [-Werror=aggressive-loop-optimizations] if (i++ >= MICROCODE_WORDS) { ^ hw/misc/milkymist-pfpu.c:167:14: note: possible undefined statement is here uint32_t insn = s->microcode[pc]; ^ The code can still access out of bounds, because it presumes that PC register always begins at 0, and we allow writing to it. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Acked-by: Michael Walle <michael@walle.cc> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> |
||
---|---|---|
.. | ||
macio | ||
a9scu.c | ||
applesmc.c | ||
arm11scu.c | ||
arm_integrator_debug.c | ||
arm_l2x0.c | ||
arm_sysctl.c | ||
cbus.c | ||
debugexit.c | ||
eccmemctl.c | ||
edu.c | ||
exynos4210_pmu.c | ||
imx_ccm.c | ||
ivshmem.c | ||
Makefile.objs | ||
max111x.c | ||
milkymist-hpdmc.c | ||
milkymist-pfpu.c | ||
mst_fpga.c | ||
omap_clk.c | ||
omap_gpmc.c | ||
omap_l4.c | ||
omap_sdrc.c | ||
omap_tap.c | ||
pc-testdev.c | ||
pci-testdev.c | ||
puv3_pm.c | ||
pvpanic.c | ||
sga.c | ||
slavio_misc.c | ||
tmp105.c | ||
tmp105.h | ||
vmport.c | ||
zynq_slcr.c |