Open Quuxplusone opened 3 years ago
Bugzilla Link | PR48460 |
Status | NEW |
Importance | P enhancement |
Reported by | David Svoboda (svoboda@cert.org) |
Reported on | 2020-12-09 09:36:27 -0800 |
Last modified on | 2020-12-10 11:13:02 -0800 |
Version | trunk |
Hardware | Macintosh MacOS X |
CC | blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, josephcsible@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk, svoboda@cert.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
I've just replied to the GCC bug thread: my preferred approach here would be to suppress -Wvla in function parameter types. But that's only really useful if GCC is prepared to make the same change.
In the other thread, you said "warning only in cases where there is a variably-modified type on the stack seems like the better meaning for -Wvla", which I agree with. That sounds like we should only warn on array2, but the approach of suppressing it for only function parameter types would mean we'd actually warn on both array2 and array3. What if we instead suppressed it for types that are pointers after possible decay? Then we would really only warn on array2.
Yes, you're right; only warning on variably-modified types on the stack is the better rule and the one I meant :-)
(There's also the issue that bound of array3 is not checked in any meaningful way by the C specification, but at least static analysis tools can verify it. I wonder if it'd make sense to permit 'static' there?)