ojhunt wrote:

> > Here's the reduced code:
> > ```
> > enum errc { not_a_directory };
> > namespace detail {
> > struct ErrorHandler {
> >   ErrorHandler(char *, int *, int *, int *);
> >   __attribute__((__format__(__printf__, 3, 4))) void report(errc, char *);
> > };
> > } // namespace detail
> > using detail::ErrorHandler;
> > int __create_directory_ec, __create_directory_p, 
> > __create_directory_attributes;
> > void __create_directory() {
> >   ErrorHandler err("", &__create_directory_ec, &__create_directory_p,
> >                    &__create_directory_attributes);
> >   err.report(not_a_directory, "");
> > }
> > ```
> > 
> > 
> >     
> >       
> >     
> > 
> >       
> >     
> > 
> >     
> >   
> > repro command: `clang++ -Wunsafe-buffer-usage crash.cpp`
> 
> Isn't `__attribute__((__format__(__printf__, 3, 4))) void report(errc, char 
> *);` a compilation error by default?

Yup, based on the test case I think the argument count tests might not be 
considering the `this` parameter.

We can trivially fix the assertion with a bounds check, but this makes me 
suspicious of the interaction of these attributes with member functions in 
general

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

Reply via email to