[cfe-dev] Compile time Array Bounds Analysis in LLVM
Friedman, Eli via cfe-dev
cfe-dev at lists.llvm.org
Wed Dec 20 11:22:23 PST 2017
On 12/19/2017 8:51 PM, Mahesh Attarde via cfe-dev wrote:
> I am working on analyzing arrays for dimensions and inferring
> iteration space.
> While going through this i found example
> Compiler did not warn about extended index in first dimension.
> Considering arrays are decayed
> into pointer, Will issuing this as error be false positive?
No; a is equivalent to *(a+8), and "a+8" is undefined behavior
because it points outside the array. -fsanitize=undefined will catch
this at runtime.
> By looking at this it looks like easy problem to solve at AST level.
> What is challenge in this analysis?
Probably just an oversight in the checking code. Briefly looking at it,
it looks like there's a missing call to Sema::CheckArrayAccess?
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev