[llvm-commits] checking of inbounds for multi dimensional arrary and struct array on isInBoundsIndices()

Jin Gu Kang jaykang10 at imrc.kist.re.kr
Thu Mar 3 15:17:11 PST 2011


Hi Dan

I thought one-past-the-end rule about overflow applies to one past element
of array on c99 and it is same with the rule of inbounds.

Current code is so good implematation about the address immediately
after the end of the object.

Thanks,
Jin-Gu Kang
________________________________
From: Dan Gohman [gohman at apple.com]
Sent: Friday, March 04, 2011 4:42 AM
To: Jin Gu Kang
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] checking of inbounds for multi dimensional arrary and struct array on isInBoundsIndices()

On Mar 2, 2011, at 9:00 PM, Jin Gu Kang wrote:
char a[3][2];
struct test {
  char a;
  int b;
};
struct test foo[3];
[…]
-------------------------------------------------------------------
isInBoundsIndices() doesn't return inbounds flag as true on
a[3][1] = 3,  a[3][2] = 4 and  foo[3].b = 7.

That's the intended behavior. The one-past-the-end rule for inbounds
only applies to the address immediately after the end of the
object, which would be just &a[3][0] and &foo[3].a.

Dan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110304/eb5d7e3f/attachment.html>


More information about the llvm-commits mailing list