[Bug tree-optimization/69249] Array-boundary offending code is silently discarded without warnings

2017-09-12 Thread arnd at linaro dot org
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;
}

[Bug tree-optimization/69249] Array-boundary offending code is silently discarded without warnings

2016-01-13 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69249

Richard Biener  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-01-13
  Component|c   |tree-optimization
 Ever confirmed|0   |1
   Severity|major   |enhancement

--- Comment #2 from Richard Biener  ---
Confirmed as diagnostic enhancement request.