vitalybuka wrote:

> Instead of an extra UBSan check, is it possible for the front-end to instead 
> add appropriate annotations/attributes to make MemorySanitizer work correctly 
> for this C23 edge case?

Given this is function local check, and trivial loads, we don't need all 
complexity of msan propagating shadow.
So maybe UBSan is reasonable place for such check.

Also msan can not be as aggressive.
In IR we can't be sure what was in original C program. 

E.g.
```
int x;
int y;
...
if (cond) {
  return x;
}
return y;
```

Msan can see this as:
```
%1 = load x;
%2 = load y;
%3 = select %cond, %1, %2
```

So in msan we propagate shadow up to the point we know for sure that this is a 
problem, like branch on uninitialized value or crossing function boundaries.

So I think UBSan is the correct place for the check.


https://github.com/llvm/llvm-project/pull/207529
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to