[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CLANG10 interesting warning !
From: |
Domingo Alvarez Duarte |
Subject: |
CLANG10 interesting warning ! |
Date: |
Fri, 17 Jul 2020 16:53:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
Hello !
When compiling with CLANG10 we get this warning:
=====
clang -DHAVE_CONFIG_H -I. -I.. -I. -I./amd -I./api -I./bflib
-I./colamd -I./draft -I./env -I./intopt -I./minisat -I./misc -I./mpl
-I./npp -I./proxy -I./simplex -I./zlib -g -O3 -march=native -DNEBUG
-DWITH_SPLAYTREE -flto
-I/home/mingo/local/clang-10/lib/clang/10.0.0/include
-I/home/mingo/local/clang-10/include -I/home/mingo/local/include -MT
libglpk_la-spxprim.lo -MD -MP -MF .deps/libglpk_la-spxprim.Tpo -c
simplex/spxprim.c -fPIC -DPIC -o .libs/libglpk_la-spxprim.o
simplex/spxprim.c:1526:7: warning: add explicit braces to avoid dangling
else [-Wdangling-else]
else
^
1 warning generated.
=====
And looking at the code it's not clear the intention of the stack of
"if" statements accumulated by previous bug fixes:
=====
#if 1 /* 23/VI-2017 */
/* dual solution may be invalidated due to long step */
if (csa->d_st) ////!!!!!! it seems that this "if" should have
braces !!!!!!!
#endif
#if 0 /* 11/VI-2017 */
if (spx_update_d(lp, d, csa->p, csa->q, trow, tcol) <= 1e-9)
#else
if (spx_update_d_s(lp, d, csa->p, csa->q, &csa->trow, &csa->tcol)
<= 1e-9)
#endif
{ /* successful updating */
csa->d_st = 2;
if (csa->phase == 1)
{ /* adjust reduced cost of xN[q] in adjacent basis, since
* its penalty coefficient changes (see below) */
d[csa->q] -= c[head[csa->p]];
}
}
else
{ /* new reduced costs are inaccurate */
csa->d_st = 0;
}
if (csa->phase == 1)
{ /* xB[p] leaves the basis replacing xN[q], so set its penalty
* coefficient to zero */
c[head[csa->p]] = 0.0;
}
/* update steepest edge weights for adjacent basis, if used */
=====
Cheers !
- CLANG10 interesting warning !,
Domingo Alvarez Duarte <=