ALADDIN icon indicating copy to clipboard operation
ALADDIN copied to clipboard

Maybe-uninitialized error on first build using Docker image

Open BujSet opened this issue 9 months ago • 3 comments

Hello,

I am trying to use Aladdin inside the recommended Docker image. I've run the following:

docker pull xyzsam/gem5-aladdin
docker run -it --rm --mount source=gem5-aladdin-workspace,target=/workspace xyzsam/gem5-aladdin

Once the docker image was running, I ran the following:

cd $ALADDIN_HOME/common
make

I was prompted with the following error:

g++ -g  -std=c++11 -I/usr/include -I/usr/include/include -I/workspace/gem5-aladdin/src/aladdin -Icacti-p -Wno-deprecated-declarations -DLLVM_VERSION=60 -O3 -Werror -Wall -Wno-reorder -Wno-deprecated-declarations -o obj/Program.o -c Program.cpp
Program.cpp: In member function 'std::__cxx11::list<std::pair<const ExecNode*, const ExecNode*> > Program::findLoopBoundaries(const SrcTypes::UniqueLabel*, const SrcTypes::DynamicLabel*) const':
Program.cpp:76:19: error: 'loop_start' may be used uninitialized in this function [-Werror=maybe-uninitialized]
   const ExecNode* loop_start;
                   ^~~~~~~~~~
cc1plus: all warnings being treated as errors
Makefile:99: recipe for target 'obj/Program.o' failed
make: *** [obj/Program.o] Error 1

After looking through the code, this seems like an unnecessary warning. I believe loop_start is set before it's ever read based on the structure of the loop, but may be set at a runtime-dependent time (I think). My workaround was to just add -Wno-maybe-uninitialized to the compilation flags. I think the more appropriate solution would be to restructure the code to perform two loops, one to first determine if loop_start is needed and initialize it, and then another to use it. Does this seem reasonable?

BujSet avatar Apr 08 '25 21:04 BujSet