On 04/03/2021 11:21, Ian Jackson wrote:
Jan Beulich writes ("Re: [PATCH][4.15] crypto: adjust rijndaelEncrypt() prototype 
for gcc11"):
On 03.03.2021 20:09, Julien Grall wrote:
On 01/03/2021 07:57, Jan Beulich wrote:
The upcoming release complains, not entirely unreasonably:

In file included from rijndael.c:33:
.../xen/include/crypto/rijndael.h:55:53: note: previously declared as 'const 
unsigned char[]'
     55 | void    rijndaelEncrypt(const unsigned int [], int, const unsigned 
char [],
        |                                                     
^~~~~~~~~~~~~~~~~~~~~~
rijndael.c:865:8: error: argument 4 of type 'u8[16]' {aka 'unsigned char[16]'} 
with mismatched bound [-Werror=array-parameter=]
    865 |     u8 ct[16])

I think this is an erroneous compiler warning.

It has been idiomatic in some codebases for a long time to write
     const unsigned char[]
as a formal parameter for an array (of whatever size).
AFAICT, this is not what GCC is trying to warn about. It is complaining that the prototype and the declaration doesn't use the same signature.

Indeed, the former is using [] while the declaration is using [16].

So compiler is working as intended when -Warray-parameter is selected (see [1]).

[1] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
--
Julien Grall

Reply via email to