On Mon, 29 May 2023, Martin Uecker via Gcc-patches wrote: > Support instrumentation of function arguments for functions > called via a declaration. We can support only simple size
What do you mean by "via a declaration"? If the *definition* is visible (and known to be the definition used at runtime rather than being interposed) then you can determine in some cases that there is UB from bad bounds. If only some other declaration is visible, or the definition might be interposed, VLA sizes in the declaration are equivalent to [*]; it's suspicious if they don't match, but it's not UB and so it would seem rather questionable for UBSan to treat it as such (cf. the rejection in GCC of sanitization for some questionable cases of unsigned integer overflow that aren't UB either). > + /* Give up. If we do not understand a size expression, we can > + also not instrument any of the others because it may have > + side effects affecting them. (We could restart and instrument > + the only the ones with integer constants.) */ > + warning_at (location, 0, "Function call not instrumented."); > + return void_node; This is not a properly formatted diagnostic message (should start with a lowercase letter and not end with '.'). -- Joseph S. Myers jos...@codesourcery.com