Hello,

On Mon, Mar 31 2025, Leul Abiy via Gcc wrote:
> Dear Sir/Madam,
>
> I just wanted to ask about the build of gcc. I know it is a required step
> before applying to GCC for the GSoC 2025. However, I get an error.
>
> Here is the error:
>
> /home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/./prev-gcc/xg++
> -B/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/./prev-gcc/
> -B/home/stoplight/GitProjects/install_dir/x86_64-pc-linux-gnu/bin/
> -nostdinc++
> -B/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -B/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
>  
> -I/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
>  
> -I/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/include
>  -I/home/stoplight/GitProjects/GCC-PROJECT/gcc/libstdc++-v3/libsupc++
> -L/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -L/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
>  -fno-PIE -c   -O -fno-checking -gtoggle -DIN_GCC    -fno-exceptions
> -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing
> -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
> -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings -Werror  -DHAVE_CONFIG_H
> -fno-PIE -I. -I. -I../../../gcc -I../../../gcc/. -I../../../gcc/../include
>  -I../../../gcc/../libcpp/include -I../../../gcc/../libcody
>  -I../../../gcc/../libdecnumber -I../../../gcc/../libdecnumber/bid
> -I../libdecnumber -I../../../gcc/../libbacktrace   -o tree-tailcall.o -MT
> tree-tailcall.o -MMD -MP -MF ./.deps/tree-tailcall.TPo
> ../../../gcc/tree-tailcall.cc
> ../../../gcc/tree-tailcall.cc: In function ‘void
> find_tail_calls(basic_block, tailcall**, bool, bool&, bool)’:
> ../../../gcc/tree-tailcall.cc:612:27: error: ‘stmt’ may be used
> uninitialized [-Werror=maybe-uninitialized]
>   612 |   if ((stmt_could_throw_p (cfun, stmt)
>       |        ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
> ../../../gcc/tree-tailcall.cc:480:11: note: ‘stmt’ was declared here
>   480 |   gimple *stmt;
>       |           ^~~~
> cc1plus: all warnings being treated as errors
> make[3]: *** [Makefile:1210: tree-tailcall.o] Error 1
> make[3]: Leaving directory
> '/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object/gcc'
> make[2]: *** [Makefile:5116: all-stage2-gcc] Error 2
> make[2]: Leaving directory
> '/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object'
> make[1]: *** [Makefile:25506: stage2-bubble] Error 2
> make[1]: Leaving directory
> '/home/stoplight/GitProjects/GCC-PROJECT/gcc/build/object'
> make: *** [Makefile:25718: bootstrap] Error 2
>
> ChatGPT doesn't seem to be able to fix it.

Heh, good I'm still somewhat useful :-)

The simple fix is to initialize the variable to nullptr in the source,
of course. :-)

>
> I used this command for configure: ../../configure
> --prefix=$HOME/GCC-Project/install_dir --enable-languages=c,c++. I did this
> in a build/object folder in gcc folder. THe prefix is outside of the gcc
> folder. THen I ran make BOOT_CFLAGS='-O' bootstrap. I tried rerunning it
> with make CFLAGS="-Wno-error=maybe-uninitialized"
> CXXFLAGS="-Wno-error=maybe-uninitialized" BOOT_CFLAGS='-O' bootstrap, but
> it didn't work. Please let me know what I should do next.

As a quick workaround, add --disable-werror to your configure line and
the problem will go away.  I regularly use this option when
bootstrapping in some non-default way (such as with LTO).

In the long run, if the problem persists when using the default
compilation flags (which I assume is not the case), you'll have to fix
it in order to be able to test your patches, even if it means modifying
the code causing the problem upstream.  But don't worry about it at this
stage.

By the way, why do you bootstrap with -O1?  If you want a build suitable
for developing, make sure you disable bootstrap instead.  (Hint:
Subsequent rebuilds of files when the current directory is the gcc
subdirectory then has the magic effect of building them with -O0 -g
which is very nice for debugging).

> I really want to work for gcc this summer.
>

Good luck!

Martin

Reply via email to