[clang] [clang] Fix crashes when passing VLA to va_arg (PR #119563)
Robear Selwans via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 11 15:05:25 PST 2024
mo7sen wrote:
> While you're here, maybe look at emitting an undefined-behavior warning for this construct? A VLA is never compatible with a function argument: if you try to write an array in an function type, it gets promoted to a pointer. So this construct is guaranteed to produce broken results (which is why nobody has tripped over this before).
Assuming the actual argument is a struct and the `va_arg(args, uint8_t[sizeof(struct)])` is just to get the struct bytes, would that still be considered undefined behaviour?
https://github.com/llvm/llvm-project/pull/119563
More information about the cfe-commits
mailing list