https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249
Arnd Bergmann changed:
What|Removed |Added
CC||arnd at linaro dot org
--- Comment #3 from Arnd Bergmann ---
I see the same behavior on incorrect code (off-by-one bug accessing beyond the
array, in my case with a negative index) on Linux kernel code: The following
snippet produces a warning with all versions up to 4.7, but not with 4.8 or
later (latest tried: gcc-8.0.0):
8<
#define MEDIA_BUS_FMT_YUYV8_2X8 0x2008
#define MEDIA_BUS_FMT_YVYU8_2X8 0x2009
#define MEDIA_BUS_FMT_UYVY8_2X8 0x2006
#define MEDIA_BUS_FMT_VYUY8_2X8 0x2007
static const unsigned int camif_mbus_formats[4] = {
MEDIA_BUS_FMT_YUYV8_2X8,
MEDIA_BUS_FMT_YVYU8_2X8,
MEDIA_BUS_FMT_UYVY8_2X8,
MEDIA_BUS_FMT_VYUY8_2X8,
};
int __camif_subdev_try_format(unsigned int code)
{
int i = sizeof(camif_mbus_formats) / sizeof(camif_mbus_formats[0]);
while (i-- >= 0)
if (camif_mbus_formats[i] == code)
break;
return i;
}