[LLVMdev] summer of code idea — checking bounds overflow bugs

Adve, Vikram Sadanand vadve at illinois.edu
Wed Mar 31 12:53:37 PDT 2010


On Mar 31, 2010, at 11:35 AM, John Regehr wrote:
<snip>
>> I'm curious why you think some undefined behavior detectors need to be built 
>> in Clang.  It seems to me that any static analysis could be built using 
>> either LLVM or Clang; there are just tradeoffs to each approach.  What 
>> advantages does Clang provide?
> 
> Some checks must live in Clang because too much information has been lost 
> by the time LLVM sees the code.  There are many examples but here is the 
> canonical one.  A program has undefined behavior if "between two sequence 
> points, an object is modified more than once, or is modified and the prior 
> value is read other than to determine the value to be stored."

I agree.  There are a number of such semantic rules that must be checked in the front end, another common example being type checking rules for types that are lowered down to the IR (e.g., all the class related rules in C++).  SAFECode  as it currently stands doesn't try to address such properties.

> 
> To implement this check in LLVM, we would have to answer the question: 
> Where, in the LLVM code, are the sequence points?
> 
> John

--Vikram





More information about the llvm-dev mailing list