bug-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-glpk] misc/wclique1.c:121:7: warning: 'memset': specified size


From: Heinrich Schuchardt
Subject: Re: [Bug-glpk] misc/wclique1.c:121:7: warning: 'memset': specified size between 18446744071562067968 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
Date: Fri, 2 Feb 2018 21:11:05 +0100

Please, add the missing explicit conversions to silence the warning.

Distributions like Debian want to be able to set a compiler flag which treats every warning as error.

Best regards

Heinrich
Am 02.02.18, 20:38, Andrew Makhorin <address@hidden> schrieb:
Hi Heinrich,

>
> when compiling GLPK-4.64 with GCC 7.2 the following warning is shown:
>
> misc/wclique1.c: In function '_glp_wclique1':
> misc/wclique1.c:121:7: warning: 'memset': specified size between
> 18446744071562067968 and 18446744073709551615 exceeds maximum object
> size 9223372036854775807 [-Wstringop-overflow=]
> memset(&skip[1], 0, sizeof(char) * n);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> misc/wclique1.c:123:7: warning: 'memset': specified size between
> 18446744071562067968 and 18446744073709551615 exceeds maximum object
> size 9223372036854775807 [-Wstringop-overflow=]
> memset(&d_flag[1], 0, sizeof(char) * n);
>

Please ignore these warnings. They appear because n being declared as
int is converted to sizeof type which is unsigned long64. However, n
cannot be negative due to a precondition xassert(n >= 0) above. (GCC as
well as many other C compilers want to be smarter than they actually
are.)

Best,

Andrew Makhorin



reply via email to

[Prev in Thread] Current Thread [Next in Thread]