Open Quuxplusone opened 3 years ago
Bugzilla Link | PR48299 |
Status | CONFIRMED |
Importance | P normal |
Reported by | Pascal Cuoq (cuoq@trust-in-soft.com) |
Reported on | 2020-11-25 07:06:23 -0800 |
Last modified on | 2020-12-09 11:36:30 -0800 |
Version | 11.0 |
Hardware | PC All |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, miod@online.fr, nigelp@xmos.com, richard-llvm@metafoo.co.uk |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
_Bug 48300 has been marked as a duplicate of this bug._
Use of any array type as the type in va_arg always results in undefined behavior (when evaluated) because the corresponding argument cannot possibly have a compatible type. So we should warn on this by default.
It doesn't really matter what code we generate given the UB, but we obviously shouldn't crash. Perhaps the most friendly thing would be to perform the usual function parameter decay on the argument (replacing "array of T" or function type T with "pointer to T").
Note that clangs' test/CodeGen/xcore-abi.c uses such an incorrect construct, but not variable-length (grep for v6), so it would be nice to adapt this test to stop doing nonsensical as well.