Message ID | 20210407083208.2392-1-yejun.guo@intel.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] configure: remove -Werror=vla | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
On Wed, Apr 7, 2021 at 10:44 AM Guo, Yejun <yejun.guo@intel.com> wrote: > > It is not a problem for pointers to VLA used to compute sizes and > offsets in an isolated function, so we can remove this flag. > > We still need to keep in mind not to use actual VLAs on the stack. > As noted in the other thread, VLAs are not supported by all compilers we support, so they cannot be used. - Hendrik
On 07/04/2021 10:02, Hendrik Leppkes wrote: > As noted in the other thread, VLAs are not supported by all compilers > we support, so they cannot be used. We should not be using them as a matter of good practice, as well, IMO. - Derek
Derek Buitenhuis (12021-04-07):
> We should not be using them as a matter of good practice, as well, IMO.
Please follow the discussion. Good practice decourages VLA on the stack,
not pointers to VLA.
Regards,
On 07/04/2021 16:14, Nicolas George wrote: > Please follow the discussion. Good practice decourages VLA on the stack, > not pointers to VLA. I must have missed the discussion as it may be hidden in another thread. A reference would be good for those of us who have not read every single email that has ever come into this mailing list. My 2 cents anyway is that VLA use on the stack is bad practice, same as alloca. Maybe that's 'controversial'. - Derek
On 07/04/2021 16:29, Derek Buitenhuis wrote: > I must have missed the discussion as it may be hidden in another thread. > > A reference would be good for those of us who have not read every single email > that has ever come into this mailing list. > > My 2 cents anyway is that VLA use on the stack is bad practice, same as alloca. > Maybe that's 'controversial'. Sorry, misread - but I struggle to understand where pointers to VLA are considered not bad practice either. - Derek
Derek Buitenhuis (12021-04-07): > Sorry, misread - but I struggle to understand where pointers to VLA are considered > not bad practice either. To answer that, I need to know why you think VLAs are considered bad practice. VLAs on the stack are a bad practice because (1) they may use too much of the stack in an unexpected way, and (2) they require extra registers that ruin optimization in the whole function. Obviously, it does not apply to pointers to VLA. Regards,
On Wed, 7 Apr 2021, at 10:32, Guo, Yejun wrote: > It is not a problem for pointers to VLA used to compute sizes and > offsets in an isolated function, so we can remove this flag. I don't think this is a good idea. > We still need to keep in mind not to use actual VLAs on the stack. If it is not enforced by configure, it will be forgotten.
Jean-Baptiste Kempf (12021-04-07):
> I don't think this is a good idea.
Can you explain the problems about VLA that I do not know about?
Regards,
On 07/04/2021 16:34, Nicolas George wrote: > To answer that, I need to know why you think VLAs are considered bad > practice. > > VLAs on the stack are a bad practice because (1) they may use too much > of the stack in an unexpected way, and (2) they require extra registers > that ruin optimization in the whole function. > > Obviously, it does not apply to pointers to VLA. A few things: 1. I don't see the extremely minor (IMO entirely supeficial) benefit to using pointers-to-VLAs (presumably via av_malloc) to be worth it for disabling the Werror. Is there even a good argument for using them that isn't superficial? 2. It makes more inconsistent code in the codebase, if some use normal allocs, and some are accessed via pointer-to-VLAs. What's the benefit? 3. VLAs are optional in C11, and we use some C11 stuff in a few places if we can - which would make this perhaps mutually incompatible. 4. MSVC does not support VLAs, but supports the rest of C99, last I checked and this would effective remove support for it. You would be surprised how many users (large ones) use MSVC for FFmpeg. I just don't really see the benefits being worth it, but I can see opinions differ. - Derek
diff --git a/configure b/configure index d7a3f507e8..18e9a30ee0 100755 --- a/configure +++ b/configure @@ -6975,7 +6975,6 @@ elif enabled gcc; then check_cflags -Werror=implicit-function-declaration check_cflags -Werror=missing-prototypes check_cflags -Werror=return-type - check_cflags -Werror=vla check_cflags -Wformat check_cflags -fdiagnostics-color=auto enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized