Fails compiling with gcc 11.2.1, -flto -O3 -Wall -Werror: “declared as a pointer, previously declared as a variable length array” #397

Closed
opened 2026-01-29 20:43:15 +00:00 by claunia · 1 comment
Owner

Originally created by @dilyanpalauzov on GitHub (Sep 16, 2021).

[1/16] Building C object CMakeFiles/brotlienc.dir/c/enc/encode.c.o
FAILED: CMakeFiles/brotlienc.dir/c/enc/encode.c.o 
/usr/local/bin/cc -DBROTLIENC_SHARED_COMPILATION -DBROTLI_HAVE_LOG2=1 -DBROTLI_SHARED_COMPILATION -DOS_LINUX -I../c/include -flto -W -Wall -Werror -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/brotlienc.dir/c/enc/encode.c.o -MF CMakeFiles/brotlienc.dir/c/enc/encode.c.o.d -o CMakeFiles/brotlienc.dir/c/enc/encode.c.o   -c ../c/enc/encode.c
../c/enc/encode.c:1977:66: error: argument 3 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter]
 1977 |     BrotliSharedDictionaryType type, size_t size, const uint8_t* data,
      |                                                   ~~~~~~~~~~~~~~~^~~~
In file included from ../c/enc/encode.c:9:
../c/include/brotli/encode.h:297:37: note: previously declared as a variable length array ‘const uint8_t[data_size]’ {aka ‘const unsigned char[data_size]’}
  297 |     size_t data_size, const uint8_t data[BROTLI_ARRAY_PARAM(data_size)],
      |                       ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
ninja: build stopped: subcommand failed.

See also https://github.com/google/ngx_brotli/issues/124 - this is how nginx compiles ngx_brotli → brotli.

Originally created by @dilyanpalauzov on GitHub (Sep 16, 2021). ``` [1/16] Building C object CMakeFiles/brotlienc.dir/c/enc/encode.c.o FAILED: CMakeFiles/brotlienc.dir/c/enc/encode.c.o /usr/local/bin/cc -DBROTLIENC_SHARED_COMPILATION -DBROTLI_HAVE_LOG2=1 -DBROTLI_SHARED_COMPILATION -DOS_LINUX -I../c/include -flto -W -Wall -Werror -O3 -DNDEBUG -fPIC -MD -MT CMakeFiles/brotlienc.dir/c/enc/encode.c.o -MF CMakeFiles/brotlienc.dir/c/enc/encode.c.o.d -o CMakeFiles/brotlienc.dir/c/enc/encode.c.o -c ../c/enc/encode.c ../c/enc/encode.c:1977:66: error: argument 3 of type ‘const uint8_t *’ {aka ‘const unsigned char *’} declared as a pointer [-Werror=vla-parameter] 1977 | BrotliSharedDictionaryType type, size_t size, const uint8_t* data, | ~~~~~~~~~~~~~~~^~~~ In file included from ../c/enc/encode.c:9: ../c/include/brotli/encode.h:297:37: note: previously declared as a variable length array ‘const uint8_t[data_size]’ {aka ‘const unsigned char[data_size]’} 297 | size_t data_size, const uint8_t data[BROTLI_ARRAY_PARAM(data_size)], | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors ninja: build stopped: subcommand failed. ``` See also https://github.com/google/ngx_brotli/issues/124 - this is how nginx compiles ngx_brotli → brotli.
Author
Owner

@markmi commented on GitHub (Nov 10, 2021):

Looks like #929 ( 27dd726 ) is a pull request for the specifics here.

@markmi commented on GitHub (Nov 10, 2021): Looks like #929 ( 27dd726 ) is a pull request for the specifics here.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#397