On Thu, Feb 29, 2024 at 07:03:35AM +0000, Paz Offer wrote:
> Hi,
> 
> I am trying to build my code with QEMU and getting compilation error 
> according to the ISO C90 standard:
> 
>       const size_t buf_size = 31;
>       char buffer[buf_size + 1];
> 
>       error: ISO C90 forbids array ‘buffer’ whose size can’t be evaluated 
> [-Werror=vla]
> 
> I noticed that the code builds with '-std=gnu11', which is newer then
> C90, so this is not clear to me why I get this error.
> Where is the correct place to specify the language version for this?

QEMU has set compiler flags to explicitly /forbid/ use of variable
sized arrays on the stack, as it is a known dangerous language
feature. You must refactor your changes to avoid this by using either
a statically sized array, or allocating on the heap.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to