[clang] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

Hood Chatham via cfe-commits cfe-commits at lists.llvm.org
Mon May 12 10:33:13 PDT 2025


================
@@ -52,14 +52,33 @@ static bool CheckWasmBuiltinArgIsInteger(Sema &S, CallExpr *E,
 }
 
 bool SemaWasm::BuiltinWasmRefNullExtern(CallExpr *TheCall) {
-  if (TheCall->getNumArgs() != 0)
+  if (TheCall->getNumArgs() != 0) {
----------------
hoodmane wrote:

If a positive number of arguments are provided, it crashes on this line:
https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaChecking.cpp?plain=1#L171

evaluating `Call->getArg(1)`. But I don't understand why that would crash. If we reach this point in the function, `CallExpr` must have at least one argument, so why should it be a problem to look it up? There is exactly one other instance of `SemaRef.checkArgCount(TheCall, 0)` in the code base, but it's possible that there is no test coverage for errors for that.

https://github.com/llvm/llvm-project/pull/139580


More information about the cfe-commits mailing list