How -fsanitize=local-bounds is different from fsanitize=array-bounds

Using Sanitizer in our project.
But not able to find diff between array-bounds & local-bounds sanitizer.
Can anyone explain differnce between these.
Like how instrumentation code and scenarios will be different.

I happened to be asked the same question today. I found the thread r193205 - Split -fsanitize=bounds to -fsanitize=array-bounds (for the frontend-inserted very helpful.

My summary is that array-bounds is a front-end inserted check using the sanitizer runtime, where as local-bounds is a backend inserted check that always traps when it finds a bounds check failure. Being a back-end inserted check on loads local-bounds is more general, but it doesn’t have the frontend information available to give good error messages via the sanitizer framework.

Hope that helps.

1 Like