https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107197
Bug ID: 107197
Summary: valgrind error in function same_line_p during build
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: dcb314 at hotmail dot com
Target Milestone: ---
I've just had a go at building gcc trunk with -O3 under valgrind and
I got the following error:
/home/dcb/gcc/working/./gcc/xgcc -B/home/dcb/gcc/working/./gcc/
-B/home/dcb/gcc/results.20221009.valgrind/x86_64-pc-linux-gnu/bin/
-B/home/dcb/gcc/results.20221009.valgrind/x86_64-pc-linux-gnu/lib/ -isystem
/home/dcb/gcc/results.20221009.valgrind/x86_64-pc-linux-gnu/include -isystem
/home/dcb/gcc/results.20221009.valgrind/x86_64-pc-linux-gnu/sys-include -g
-O3 -O2 -g -O3 -DIN_GCC -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem
./include -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
-I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
-I../../../trunk.git/libgcc/../include
-I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -g0
-finhibit-size-directive -fno-inline -fno-exceptions
-fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize
-fbuilding-libgcc -fno-stack-protector -I. -I. -I../.././gcc
-I../../../trunk.git/libgcc -I../../../trunk.git/libgcc/.
-I../../../trunk.git/libgcc/../gcc -I../../../trunk.git/libgcc/../include
-I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -o
crtendS.o -MT crtendS.o -MD -MP -MF crtendS.dep -fno-omit-frame-pointer
-fno-asynchronous-unwind-tables -fcf-protection -mshstk -fpic -c
../../../trunk.git/libgcc/crtstuff.c -DCRT_END -DCRTSTUFFS_O
==107792== Conditional jump or move depends on uninitialised value(s)
==107792== at 0xD5004B: same_line_p (tree-cfg.cc:1160)
==107792== by 0xD5004B: assign_discriminators (tree-cfg.cc:1224)
==107792== by 0xD5004B: build_gimple_cfg (tree-cfg.cc:251)
==107792== by 0xD5004B: execute_build_cfg (tree-cfg.cc:371)
$ egrep "^Config|^==" mk.out
Configuring in x86_64-pc-linux-gnu/libgcc
==107792== Conditional jump or move depends on uninitialised value(s)
So the problem occurs when building libgcc. Configure command is
../trunk.git/configure --prefix=/home/dcb/gcc/$PREFIX \
--disable-bootstrap \
--disable-multilib \
--disable-werror \
--with-pkgversion=$HASH \
--enable-checking=valgrind \
--enable-languages=c,c++
and to get -O3 into it, I have
sed 's/-O2/-O3/' < Makefile > Makefile.tmp
diff Makefile Makefile.tmp
mv Makefile.tmp Makefile
for the top-level Makefile.