On 7/22/21 8:24 PM, Roi Dayan wrote:
> 
> 
> On 2021-07-22 2:33 PM, Ilya Maximets wrote:
>> GCC 11 on Feodra 34 emits a false-positive warning like this:
>>
>>   lib/netdev-dummy.c: In function ‘dummy_packet_stream_run’:
>>   lib/netdev-dummy.c:284:16: error: ‘n’ may be used uninitialized in this
>>                                     function [-Werror=maybe-uninitialized]
>>    284 |             if (retval == n && dp_packet_size(&s->rxbuf) > 2) {
>>        |                ^
>>
>> This breaks the build with --enable-Werror.  Initializing 'n' to
>> avoid the warning.
>>
>> Signed-off-by: Ilya Maximets <[email protected]>
>> ---
>>   lib/netdev-dummy.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
>> index 71df29184..1f386b81b 100644
>> --- a/lib/netdev-dummy.c
>> +++ b/lib/netdev-dummy.c
>> @@ -233,7 +233,7 @@ static int
>>   dummy_packet_stream_run(struct netdev_dummy *dev, struct 
>> dummy_packet_stream *s)
>>   {
>>       int error = 0;
>> -    size_t n;
>> +    size_t n = 0;
>>         stream_run(s->stream);
>>  
> 
> Hi Ilya,
> 
> I'm actually compiling now ovs on FC34 with --enable-Werror and I'm
> not hitting a compilation issue.
> Maybe there is something else related to the compilation issue?
> 
> gcc (GCC) 11.1.1 20210531 (Red Hat 11.1.1-3)

Hmm, you're right.  Default build works.
The issue occurs on a build with -O1:

./configure CC=gcc CFLAGS='-O1' --enable-Werror

I'm usually building with "-g -O1 -fno-omit-framepointer" for
the AddressSanitizer.  And this warning doesn't allow me that.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to