alberto-santini / concorde-easy-build

Fork of the Concorde TSP solver with an easier build procedure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation Error in Concorde Solver: Uninitialized Variable Description

0505daniel opened this issue · comments

Thank you for your contribution to helping easily build the concorde solver.

Issue: Compilation Error in Concorde Solver: Uninitialized Variable

Description

After resolving previous issues with CPLEX not being found, I have now encountered a compilation error while building the Concorde solver on my system. The error arises during the make -j5 command and appears to be related to the potential use of an uninitialized variable in the linkern.c source file.

System Specifications

Operating System: Ubuntu 22.04.3 LTS
CMake Version: 3.22.1
CPLEX Version: 22.1.1.0
Steps Leading to the Issue
Successfully configured the project with CMake, resolving previous CPLEX-related issues.
Proceeded to build the project using make -j5.
Compilation Error Details
The compiler raises an error regarding a potentially uninitialized variable winstack.stack used in the linkern.c file. The relevant part of the error message is as follows:

[  1%] Building C object CMakeFiles/concorde_lp.dir/src/LP/lpcplex8.c.o
[  2%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/allocrus.c.o
[  3%] Building C object CMakeFiles/concorde_bigguy.dir/src/BIGGUY/bigguy.c.o
[  5%] Building C object CMakeFiles/concorde_heldkarp.dir/src/HELDKARP/heldkarp.c.o
[  5%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/edgegen.c.o
[  6%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/util.c.o
[  7%] Linking C static library libconcorde_bigguy.a
[  8%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgelen.c.o
[  8%] Built target concorde_bigguy
[  9%] Building C object CMakeFiles/concorde_linkern.dir/src/LINKERN/linkern.c.o
[ 10%] Linking C static library libconcorde_heldkarp.a
[ 10%] Built target concorde_heldkarp
[ 11%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/first.c.o
[ 12%] Linking C static library libconcorde_lp.a
[ 13%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/zeit.c.o
[ 13%] Built target concorde_lp
[ 15%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/urandom.c.o
[ 16%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/localcut.c.o
[ 17%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/signal.c.o
[ 18%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/xnear.c.o
[ 19%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/delaunay.c.o
[ 20%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/getdata.c.o
[ 21%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/separate.c.o
[ 22%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/tsporacl.c.o
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
In file included from /home/comet/opt/concorde-easy-build/src/INCLUDE/linkern.h:19,
                 from /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:61:
In function ‘free_flipstack’,
    inlined from ‘repeated_lin_kernighan’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:665:5,
    inlined from ‘CClinkern_tour’ at /home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:378:12:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:2281:17: error: ‘winstack.stack’ may be used uninitialized [-Werror=maybe-uninitialized]
 2281 |     CC_IFFREE (f->stack, flippair);
/home/comet/opt/concorde-easy-build/src/INCLUDE/util.h:182:10: note: in definition of macro ‘CC_IFFREE’
  182 |     if ((object)) CC_FREE ((object),type);                                 \
      |          ^~~~~~
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c: In function ‘CClinkern_tour’:
/home/comet/opt/concorde-easy-build/src/LINKERN/linkern.c:423:15: note: ‘winstack’ declared here
  423 |     flipstack winstack, fstack;
      |               ^~~~~~~~
[ 23%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/chunks.c.o
[ 24%] Building C object CMakeFiles/concorde_linkern.dir/src/LINKERN/flip_two.c.o
cc1: all warnings being treated as errors
make[2]: *** [CMakeFiles/concorde_linkern.dir/build.make:76: CMakeFiles/concorde_linkern.dir/src/LINKERN/linkern.c.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 25%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/lift.c.o
make[1]: *** [CMakeFiles/Makefile2:243: CMakeFiles/concorde_linkern.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 26%] Building C object CMakeFiles/concorde_localcut.dir/src/LOCALCUT/intmat.c.o
[ 27%] Building C object CMakeFiles/concorde_edgegen.dir/src/EDGEGEN/mlinkern.c.o
[ 29%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgeutil.c.o
[ 30%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/bgetopt.c.o
[ 31%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/safe_io.c.o
[ 32%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/sortrus.c.o
[ 33%] Linking C static library libconcorde_edgegen.a
[ 34%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/genhash.c.o
[ 34%] Built target concorde_edgegen
[ 35%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/edgemap.c.o
[ 36%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/priority.c.o
[ 37%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/dheaps_i.c.o
[ 38%] Linking C static library libconcorde_localcut.a
[ 39%] Building C object CMakeFiles/concorde_utils.dir/src/UTIL/fastread.c.o
[ 39%] Built target concorde_localcut
[ 40%] Linking C static library libconcorde_utils.a
[ 40%] Built target concorde_utils
make: *** [Makefile:91: all] Error 2

Requested Help

I am looking for advice or guidance on how to address this compilation error. It seems to be a matter of ensuring a variable is initialized before use, but I am uncertain of the best approach to resolving this within the Concorde solver's codebase.

Thank you for your time and assistance.