https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88753
Bug ID: 88753
Summary: Wrong code since r265463 in tree switch conversion
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
As reported in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84436#c12:
Romain Geissler 2019-01-07 14:41:34 UTC
Hi,
I have tried the following script directly inside docker using the official
"debian:buster" docker image, so I hope it will not require much more
dependencies than what is written here.
Tested with x86-64.
<<END_OF_SCRIPT
#!/bin/bash
set -e
# Install a few dependencies
apt-get update
apt-get install -y curl tar build-essential cmake python
LLVM_DIRECTORY=/llvm
LLVM_TAR="http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz"
CLANG_TAR="http://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz"
COMPILER_RT_TAR="http://releases.llvm.org/7.0.1/compiler-rt-7.0.1.src.tar.xz"
mkdir -p "${LLVM_DIRECTORY}/src"
mkdir -p "${LLVM_DIRECTORY}/build"
cd "${LLVM_DIRECTORY}/src"
curl "${LLVM_TAR}" | tar -Jx --strip-components=1 -f -
mkdir -p "${LLVM_DIRECTORY}/src/tools/clang"
cd "${LLVM_DIRECTORY}/src/tools/clang"
curl "${CLANG_TAR}" | tar -Jx --strip-components=1 -f -
mkdir -p "${LLVM_DIRECTORY}/src/projects/compiler-rt"
cd "${LLVM_DIRECTORY}/src/projects/compiler-rt"
curl "${COMPILER_RT_TAR}" | tar -Jx --strip-components=1 -f -
cd "${LLVM_DIRECTORY}/build"
cmake -G "Unix Makefiles" -C
"${LLVM_DIRECTORY}/src/tools/clang/cmake/caches/PGO.cmake"
"${LLVM_DIRECTORY}/src"
make -j 32 stage2-instrumented-generate-profdata
END_OF_SCRIPT
in order to use your own gcc, make sure that you update the $PATH environment
variable when running cmake/make.
I suggest you build clang both with and without your fix in gcc, then explore
the whole build tree and find all *.o files which differ (I hope there aren't a
lot), to check why they behave differently.
Note that it seems like gcc had an earlier regression, making the clang
bootstrap fail a bit later after building compiler-rt, with an error like:
FAILED: tools/clang/include/clang/AST/StmtNodes.inc
cd /workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins
&&
/workdir/build/final-system/llvm-build/tools/clang/stage2-instrumented-bins/bin/clang-tblgen
-gen-clang-stmt-nodes -I /workdir/src/llvm-8.0.0/clang/include/clang/AST -I
/workdir/src/llvm-8.0.0/llvm/include
/workdir/src/llvm-8.0.0/clang/include/clang/AST/../Basic/StmtNodes.td -o
tools/clang/include/clang/AST/StmtNodes.inc -d
tools/clang/include/clang/AST/StmtNodes.inc.d
This is an unrelated error, which I think comes from a gcc regression too, and
which I will bisect as well.
If you need more info, just ask.
Cheers,
Romain