mariusdr wrote:

I think my issue was that the pointer callback is never called when the 
expression evaluates to a function pointer
https://github.com/llvm/llvm-project/blob/aee5fa1f0c89ac68a2a2eeda7c5900d0a4508fd4/clang/lib/AST/ByteCode/EvalEmitter.cpp#L191-L204

This means that `tryEvaluateObjectSize` returns without actually setting an 
object size in `Result` leaving the variable basically unitialised here

https://github.com/llvm/llvm-project/blob/aee5fa1f0c89ac68a2a2eeda7c5900d0a4508fd4/clang/lib/Sema/SemaChecking.cpp#L1219-L1223

hitting UB. While the AST interpreter recognizes this case by inspecting the 
type for `isFunctionType` and returns false.

  auto CheckedHandleSizeof = [&](QualType Ty, CharUnits &Result) {
    if (Ty.isNull())
      return false;


    Ty = Ty.getNonReferenceType();


    if (Ty->isIncompleteType() || Ty->isFunctionType())
      return false;



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

Reply via email to