On Wed, Nov 19, 2014 at 02:51:11PM +0100, Marek Polacek wrote:
> As the testcase shows, we should really check first that we
> have a MEM_REF, otherwise subsequent TREE_OPERAND might ICE.
> On an invalid testcase we might get e.g. STRING_CST.

Well, addr_object_size should handle STRING_CSTs just fine, so
why not handle STRING_CSTs in there too (similarly to decl_p = true
case).
Supposedly you want decl_p = true for them and need to tweak
  if (!POINTER_TYPE_P (TREE_TYPE (base)) && !DECL_P (base))
but otherwise it should work.
On the other side,
int
foo (int x)
{
  return "foobar"[x];
}
is already handled by -fsanitize=bounds and for some reason
gimple_assign_load_p doesn't consider handled components with
STRING_CST as base as loads so for -fsanitize=object-size
we aren't called for that.

        Jakub

Reply via email to