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

John Regehr regehr at cs.utah.edu
Wed Mar 31 13:48:15 PDT 2010


>> - Almost all of the added checks would be destroyed by LLVM after simple 
>> queries to the alias analyzer, so applications running with this check 
>> turned on will not slow down much.
>
> I'm not sure if the above is true.  For example, consider the code:
>
> void foo (int * a, int * b) {
>   *a = *b++;
> }
>
> void bar (int a) {
>   foo (&a, &a);
> }
>
> I think this is undefined behavior in foo() (two writes within a set of 
> sequence points), but it will take inter-procedural alias analysis to 
> determine whether the check can be dropped.
>
> Is this correct, or am I missing something?

You're right, I was imagining that this kind of code would be inlined...

John



More information about the llvm-dev mailing list