riccibruno added inline comments.
================
Comment at: clang/test/Sema/init-ref-c.c:8
+}
\ No newline at end of file

----------------
ArcsinX wrote:
> riccibruno wrote:
> > I think it would be better to name this test `varargs-arm.c` since this bug 
> > can only happen with the varargs-related builtins (`__builtin_addressof` 
> > takes a reference but has custom type-checking).
> > 
> > Additional test case:
> > ```
> > const __builtin_va_list cva;
> > __builtin_va_end(cva); // expected-error {{binding reference of type 
> > '__builtin_va_list' to value of type 'const __builtin_va_list' drops 
> > 'const' qualifier}}
> > ```
> It's not only about ARM, its about `__builtin_va_list` type which depends on 
> architecture. E.g. on MIPS it also crashes.
> 
> Also it's not about `__builtin_va_*()` and `__builtin_ms_va_*()`,  its about 
> builtins with reference parameters, when we pass incompatible C structures to 
> these builtin calls. May be there could be other builtins with reference 
> parameters in the future.
> 
> We could not pass incompatible structure to `__builtin_addressof()` that is 
> the reason why we could not reproduce the problem with this builtin.
> It's not only about ARM, its about `__builtin_va_list` type which depends on 
> architecture.
> E.g. on MIPS it also crashes.

Sure.

> Also it's not about `__builtin_va_*()` and `__builtin_ms_va_*()`, its about 
> built-ins with
> reference parameters, when we pass incompatible C structures to these builtin 
> calls.
> May be there could be other built-ins with reference parameters in the future.

Right, but currently only these built-ins and `__builtin_addressof()` have a 
parameter of reference type, and as you said `__builtin_addressof()` doesn't 
have this problem.

That said it's not a big deal so I think it's fine if you want to leave it here.



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82805/new/

https://reviews.llvm.org/D82805



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to