[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-glpk] -Wstringop-overflow in function _glp_wclique1
From: |
Heinrich Schuchardt |
Subject: |
[Bug-glpk] -Wstringop-overflow in function _glp_wclique1 |
Date: |
Sun, 1 Oct 2017 06:57:14 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
Hello Andrew,
compiling GLPK 4.63 on arm64 with gcc 7.2 gives the following warning:
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);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It can be avoided by first converting to unsigned int:
120 /* initially all vertices are unmarked */
121 memset(&skip[1], 0, sizeof(char) * (unsigned int)n);
122 /* clear flags of all vertices */
123 memset(&d_flag[1], 0, sizeof(char) * (unsigned int)n);
Best regards
Heinrich Schuchardt
- [Bug-glpk] -Wstringop-overflow in function _glp_wclique1,
Heinrich Schuchardt <=